From: Jeff Garzik <jgarzik@pobox.com>
To: Tejun Heo <htejun@gmail.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 07:29:44 -0400 [thread overview]
Message-ID: <4450AB28.2030801@pobox.com> (raw)
In-Reply-To: <4450A2C0.4090401@gmail.com>
Tejun Heo wrote:
> 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.
Agreed, I'm not sure either.
> /**
> * 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;
> }
> }
hmmm, I would think something more along the lines of
get HP irq
ack HP irq
ata_I_got_hotplug_event()
if test_and_clear_bit(got_hotplug)
start 1-second timer
timer fires...
clear got_hotplug
handle hotplug, revalidate port
There's not much point in polling, the reason for the debounce period is
to throw away spurious hotplug/unplug/hotplug events the hardware throws
while it is figuring shit out.
Should just need a pause, following by port recovery/revalidate.
>> 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
that's nice
> - PM support with the same level of EH/NCQ/hotplug support as host ports
> (sil24 and working on AHCI)
what kind of PM are you testing on?
> 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.
I leave May 3rd. So sometime between now and then. The goal should be
to get #irq-pio and whatever other work you want into #upstream before I
leave, so that people have a nice long period for testing in -mm.
irq-pio will definitely want some testing, as will your work. Its a lot
to throw at people all at once.
Jeff
next prev parent reply other threads:[~2006-04-27 11:29 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 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 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 01/15] libata-hp: implement ata_eh_detach_dev() Tejun Heo
2006-04-11 14:14 ` [PATCH 02/15] libata-hp: implement ata_eh_hotplug() Tejun Heo
2006-04-11 14:14 ` [PATCH 07/15] libata-hp: implement transportt->user_scan 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 06/15] libata-hp: use ata_scsi_slave_destroy() in low level drivers 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 14/15] ahci: add hotplug support 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 13/15] sata_sil: add hotplug support Tejun Heo
2006-04-11 14:14 ` [PATCH 15/15] sata_sil24: " Tejun Heo
2006-04-11 14:14 ` [PATCH 12/15] sata_sil: new interrupt handler 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-12 1:49 ` [PATCHSET 9/9] add hotplug support 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
2006-04-27 11:29 ` Jeff Garzik [this message]
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=4450AB28.2030801@pobox.com \
--to=jgarzik@pobox.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=albertcc@tw.ibm.com \
--cc=axboe@suse.de \
--cc=htejun@gmail.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).