From: Tejun Heo <htejun@gmail.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: alan@lxorguk.ukuu.org.uk, axboe@suse.de, albertcc@tw.ibm.com,
lkosewsk@gmail.com, linux-ide@vger.kernel.org
Subject: Re: [PATCHSET 9/9] add hotplug support
Date: Thu, 27 Apr 2006 19:53:52 +0900 [thread overview]
Message-ID: <4450A2C0.4090401@gmail.com> (raw)
In-Reply-To: <44508F12.8010705@pobox.com>
Jeff Garzik wrote:
> Tejun Heo wrote:
>> Hellooooo, all.
>>
>> Finally, the last one. This is the first take of add-hotplug-support
>> patchset. This patchset includes 13 patches.
>>
>> #01-04 implement hotplug framework
>> #05-07 implement warm plug (SCSI scan/delete callbacks)
>> #08-10 hook and activate hotplug
>> #11-13 add LLDD hotplug supports (PHY status change notifications)
>>
>> Hotplugging is implemented as an integral part of EH. A new EH helper
>> ata_eh_hotplug() is defined which should be called after all regular
>> EH is done. LLDDs have to do very little to support hotplug.
>
> I'm going to leave the substantive review of this patchset for the next
> time it gets resent.
Yeap, please don't spend too much time on it. Hotplug has been changed
quite a bit in my current repo.
> Overall,
>
> * my quick review didn't turn up any obvious problems, but that was just
> looking at each patch, not looking at the end result (big picture) at all.
>
> * hotplug design I want to see is (also mentioned in another email):
>
> 1a) user requests bus scan
> or
> 1b) hotplug interrupt
> 2) wait a bit, swallowing any 1a- or 1b-type events that
> appear during the wait (debounce).
> 3) rescan bus, revalidate device(s)
In my working repo, hardware debouncing is done by invoking the
following function in ->prereset() with the port frozen. I'm not very
sure whether debouncing user request is necessary though.
/**
* sata_debounce - debounce SATA phy status
* @link: ATA link to debounce SATA phy status for
* @interval_msec: polling interval in millisecs
* @duration_msec: debounce duration in millisecs
* @timeout_msec: timeout in millisecs
*
* Make sure SStatus of @link reaches stable state, determined by
* holding the same value where DET is not 1 for @duration_msec
* polled every @interval_msec, before @timeout_msec. Note the
* timeout constraints the beginning of the stable state.
*
* LOCKING:
* Kernel thread context (may sleep)
*
* RETURNS:
* 0 on success, -errno on failure.
*/
int sata_debounce(struct ata_link *link, unsigned long interval_msec,
unsigned long duration_msec, unsigned long timeout_msec)
{
unsigned long duration = duration_msec * HZ / 1000;
unsigned long timeout = jiffies + timeout_msec * HZ / 1000;
unsigned long last_jiffies;
u32 last, cur;
int rc;
if ((rc = ata_scr_read(link, SCR_STATUS, &cur)))
return rc;
cur &= 0xf;
last = cur;
last_jiffies = jiffies;
while (1) {
msleep(interval_msec);
if ((rc = ata_scr_read(link, SCR_STATUS, &cur)))
return rc;
cur &= 0xf;
/* DET stable? */
if (cur == last && cur != 1) {
if (time_after(jiffies, last_jiffies + duration))
return 0;
continue;
}
/* unstable, start over */
last = cur;
last_jiffies = jiffies;
/* check timeout */
if (time_after(jiffies, timeout))
return -EBUSY;
}
}
> I'm careful to use "revalidate", because that covers all cases:
>
> - existing device goes away
> - new device appears
> - existing device "blipped", but its still there, so
> we can keep talking to it.
>
Yeap, all bases covered.
I'm currently finishing up PM support. It took a lot longer than I
though but it's shaping up pretty good. Everything is handled nicely,
hotplug, EH, qc deferring (e.g. not issuing ATAPI command if commands
are outstanding to more than three devices for sil24...) are all handled
in generic and unified way. Adding PM support necessitated quite a bit
of changes to EH and hotplug. Currently, major changes in my repo are...
- boot scan, hotplug, EH all rolled up into single EH revive operation.
- simpler EH/irq synchronization. EH now works on its own copy of EH
info created on entry to EH.
- much tighter event handling (almost no EH/hotplug event/info loss
except for pathological cases)
- fine-grained user scan request (user can request scan of specific device)
- ata_link abstraction for PM
- PM support with the same level of EH/NCQ/hotplug support as host ports
(sil24 and working on AHCI)
Above list is what comes to my mind ATM. I probably have forgotten a
lot. I'll make a full list when I post the next round of patches.
Jeff, until when are you available? I think I can post the next round
in a few days (I'm pretty sure this time :). I'm thinking of setting up
a git repo and merge irq-pio there too in the order you requested. If
schedule isn't too tight, it would be nice to push this thing to some
branch in libata-dev.
Thanks.
--
tejun
next prev parent reply other threads:[~2006-04-27 10:53 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-11 14:14 [PATCHSET 9/9] add hotplug support Tejun Heo
2006-04-11 14:14 ` [PATCH 08/15] libata-hp: add hotplug hooks into regular EH Tejun Heo
2006-04-11 14:14 ` [PATCH 04/15] libata-hp: connect ATA hotplug events to SCSI hotplug Tejun Heo
2006-04-11 14:14 ` [PATCH 09/15] libata-hp: activate hotplug by adding a call to ata_eh_hotplug() from EH Tejun Heo
2006-04-13 8:18 ` zhao, forrest
2006-04-13 8:45 ` Tejun Heo
2006-04-13 9:00 ` zhao, forrest
2006-04-13 9:30 ` Tejun Heo
2006-04-11 14:14 ` [PATCH 02/15] libata-hp: implement ata_eh_hotplug() Tejun Heo
2006-04-11 14:14 ` [PATCH 01/15] libata-hp: implement ata_eh_detach_dev() Tejun Heo
2006-04-11 14:14 ` [PATCH 05/15] libata-hp: implement ata_scsi_slave_destroy() Tejun Heo
2006-04-12 5:27 ` Tejun Heo
2006-04-12 22:32 ` Jeff Garzik
2006-04-13 3:46 ` Tejun Heo
2006-04-11 14:14 ` [PATCH 07/15] libata-hp: implement transportt->user_scan Tejun Heo
2006-04-11 14:14 ` [PATCH 03/15] libata-hp: implement ata_eh_scsi_hotplug() Tejun Heo
2006-04-11 14:14 ` [PATCH 06/15] libata-hp: use ata_scsi_slave_destroy() in low level drivers Tejun Heo
2006-04-11 14:14 ` [PATCH 13/15] sata_sil: add hotplug support Tejun Heo
2006-04-11 14:14 ` [PATCH 12/15] sata_sil: new interrupt handler Tejun Heo
2006-04-11 14:14 ` [PATCH 15/15] sata_sil24: add hotplug support Tejun Heo
2006-04-11 14:14 ` [PATCH 10/15] libata-hp: skip EH reset if no device to recover and hotplug pending Tejun Heo
2006-04-11 14:14 ` [PATCH 11/15] sata_sil: add new constants in preparation for new interrupt handler Tejun Heo
2006-04-11 14:14 ` [PATCH 14/15] ahci: add hotplug support Tejun Heo
2006-04-12 1:49 ` [PATCHSET 9/9] " Tejun Heo
2006-04-13 7:53 ` zhao, forrest
2006-04-13 8:49 ` Tejun Heo
2006-04-13 16:07 ` Jeff Garzik
2006-04-13 16:50 ` Tejun Heo
2006-04-27 9:29 ` Jeff Garzik
2006-04-27 10:53 ` Tejun Heo [this message]
2006-04-27 11:29 ` Jeff Garzik
2006-04-27 12:38 ` Tejun Heo
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=4450A2C0.4090401@gmail.com \
--to=htejun@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=albertcc@tw.ibm.com \
--cc=axboe@suse.de \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--cc=lkosewsk@gmail.com \
/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).