linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Warner <andyw@pobox.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: linux-ide@vger.kernel.org, Doug Ledford <dledford@redhat.com>
Subject: Re: libata & scsi rescan.
Date: Thu, 7 Oct 2004 21:48:32 -0500	[thread overview]
Message-ID: <20041007214832.C21662@florence.linkmargin.com> (raw)
In-Reply-To: <4165C263.4080102@pobox.com>; from jgarzik@pobox.com on Thu, Oct 07, 2004 at 06:25:39PM -0400

Jeff Garzik wrote:
> Andy Warner wrote:
> > 		sdev = scsi_add_device(ap->host, 0, 0, 0) ;
> 
> > 		sdev = scsi_device_lookup(ap->host, 0, 0, 0);
> 
> These args are wrong.  Consider master/slave configurations.

Like I said: "... (ignore hardcoded values and sloppy error
checking for now)"

> Also, remember my short message about a debounce timer.  It's not as 
> simple as this... you need to make sure the driver doesn't "scream" 
> add_device/remove_device while the SATA bus settles.

I didn't show that logic, but I think the code in the interrupt
handler deals with that:

if ((err & SCR_DIAG_N) && (ap->hotplug_task_state == HOTPLUG_ST_IDLE)) {
	/*
	 * Schedule hotplug task to deal with it.
	 */
	ap->hotplug_task_state = HOTPLUG_ST_PENDING;
	queue_delayed_work(ata_wq, &ap->hotplug_task, 20);
}

[again, ignore locking issues for now]

What this effectively does is start a one-shot on the first
interrupt due to bit 16, and ignore any subsequent transitions.
>= 20 jiffies later (TODO: figure out the optimal value) the other
hotplug_task runs, by which time the bus will have settled. It reads
the value and does what it must. I think this will accomplish
what is needed.

I too want to cache dev in *ap, but that's another bunch of issues
(like either unrolling scsi_scan_host() as called from ata_device_add(),
figuring out ap->dev after scsi_scan_host() has run, or just
letting the hotswap logic add the drives after initting the
host.) I'll get to that after I fixup the scsi_remove_device()
problems.

I think I also need logic to ensure that I don't call scsi_add_device()
twice [if (!(ap->dev)) { ...} springs to mind].

Thanks for confirming that the "sync the disk that just went
away"/scsi_remove_device() problem is structural, not just me
calling the wrong function. I'll look into implementing flags
as you suggest.
-- 
andyw@pobox.com

Andy Warner		Voice: (612) 801-8549	Fax: (208) 575-5634

  reply	other threads:[~2004-10-08  2:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-01 17:39 libata & scsi rescan Andy Warner
2004-10-01 18:32 ` Jeff Garzik
2004-10-01 19:12   ` Andy Warner
2004-10-01 19:30     ` Jeff Garzik
2004-10-04 20:56       ` Andy Warner
2004-10-04 21:05         ` Jeff Garzik
2004-10-06 22:36           ` Andy Warner
2004-10-07  1:07             ` Jeff Garzik
2004-10-07  2:47               ` Andy Warner
2004-10-07  3:17                 ` Jeff Garzik
2004-10-07  3:49                   ` Andy Warner
2004-10-07  3:59                     ` Jeff Garzik
2004-10-07  3:53                   ` Jeff Garzik
2004-10-07 22:14                     ` Andy Warner
2004-10-07 22:21                       ` Jeff Garzik
2004-10-07 22:25                       ` Jeff Garzik
2004-10-08  2:48                         ` Andy Warner [this message]
2004-10-08 15:56                         ` Andy Warner
2004-10-07 22:26                       ` Jeff Garzik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041007214832.C21662@florence.linkmargin.com \
    --to=andyw@pobox.com \
    --cc=dledford@redhat.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).