linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: "zhao, forrest" <forrest.zhao@intel.com>,
	alan@lxorguk.ukuu.org.uk, axboe@suse.de, albertcc@tw.ibm.com,
	lkosewsk@gmail.com, linux-ide@vger.kernel.org
Subject: Re: [PATCH 13/14] ahci: convert to new EH
Date: Fri, 21 Apr 2006 10:34:37 +0900	[thread overview]
Message-ID: <444836AD.1030801@gmail.com> (raw)
In-Reply-To: <44473BC1.2070900@pobox.com>

Jeff Garzik wrote:
> Tejun Heo wrote:
>> On Thu, Apr 20, 2006 at 02:01:12PM +0800, zhao, forrest wrote:
>>> Hi, Tejun
>>>
>>> When testing hotplug and reading your patches, I thought an interrupt
>>> lost might occur on AHCI in the following case:
>>>
>>> 1 system boot up with SATA disk A attached to port 1 and disk B attached
>>> to port 2
>>> 2 disk B at port 2 is hot-unplugged
>>> 3 ata_eh_revive() will execute several round of soft-reset/hard-reset as
>>> we observed in dmesg
>>> 4 now imagine ata_eh_revive() start to execute the last round of
>>> hard-reset, so the code path comes into ata_do_reset(), then into
>>> ahci_hardreset()
>>> 5 disk B is hot-plugged to port 2, and an interrupt is triggered
>>> 6 CPU respond to this interrupt when code path execute between
>>> ahci_start_engine(); in ahci_hardreset() and
>>> ap->flags &= ~ATA_FLAG_FROZEN; in ata_do_reset();
>>> 7 then this interrupt is lost since no EH is scheduled to handle it.
>>>
>>> I think invoking ata_eh_schedule_port() in ahci_postreset() can fix
>>> the problem, is it right?
>>
>> Hello, Forrest.
>>
>> Yes, you're right.  The problem is that we cannot tell whether such
>> interrupts are due to the reset or some other events.  The goal was to
>> make sure existing devices are okay on EH completion.  If new devices
>> get connected during EH, we might lose the event, which IMHO is okay.
>>
>> Maybe this can be solved by merging EH and probe into one.  Probing
>> and EH revive are pretty similar in the first place.  I'll think about
> 
> Speaking to hotplug specifically, on hardware with plug irqs, it needs 
> to do something like
> 
>     * receive hotplug interrupt
>     * hang out for a while, eating hotplug interrupt events
>       (debounce)
>     * revalidate device
>     * issue unplug and/or plug to SCSI layer

I see.  I'll pay more attention to the debouncing.

>> that.  But I still think it's okay to lose hotplug interrupt during
>> EH.  All the user has to do is simply replug the device or issue
>> manual scan.
> 
> If losing the hotplug interrupt requires the user to do that, no that's 
> definitely not OK...  for a hotplug interrupt during EH, you want to 
> stop what you're doing at the nearest opportunity, and start all over 
> again revalidating the device.  If its a different device, all the 
> accumulated state is flushed.
> 

Hmmm... Well, I initially thought that's a tradeoff libata can take. 
It's a quite small window.  Such events are lost iff the user plugs a 
new device inbetween autopsy completion and reset completion.  ie. while 
EH is actively spitting out messages.

I've been thinking about this since yesterday (except for the time I've 
played HOMM5 demo), and it seems that achieving completely reliable 
device detection can be achieved relatively easily by combining EH 
revive and probing.  And with SError.X bit check at the end, PM should 
be able to do reliable detection, too.

PM is requiring more changes than I initially thought and merging 
probing and EH reviving would take some time too.  And, of course, HOMM5 
demo is out.  So, I don't think I can make it this week.  But on the 
bright side, SCSI part of EH seems to be agreed on and although EH and 
hotplug are a little bit flakey, libata generic PM support really works 
on my working tree!

Thanks.

-- 
tejun

  reply	other threads:[~2006-04-21  1:34 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-11 13:48 [PATCHSET 6/9] new EH implementation, take 2 Tejun Heo
2006-04-11 13:48 ` [PATCH 03/14] libata-eh: add per-dev ata_ering Tejun Heo
2006-04-11 13:48 ` [PATCH 07/14] libata-eh: implement ata_eh_report() Tejun Heo
2006-04-11 13:48 ` [PATCH 09/14] libata-eh: implement ata_eh_finish_qcs() Tejun Heo
2006-04-11 13:48 ` [PATCH 02/14] libata-eh: implement ata_ering Tejun Heo
2006-04-11 13:48 ` [PATCH 08/14] libata-eh: implement ata_eh_revive() Tejun Heo
2006-04-19  9:08   ` zhao, forrest
2006-04-19 10:33     ` Tejun Heo
2006-04-11 13:48 ` [PATCH 04/14] libata-eh: implement EH utility functions Tejun Heo
2006-04-11 13:48 ` [PATCH 01/14] libata-eh: add constants and flags to be used by EH Tejun Heo
2006-04-11 13:48 ` [PATCH 10/14] libata-eh: implement EH methods for BMDMA controllers Tejun Heo
2006-04-11 13:48 ` [PATCH 11/14] ata_piix: convert to new EH Tejun Heo
2006-04-11 13:48 ` [PATCH 05/14] libata-eh: implement ata_eh_determine_qc() Tejun Heo
2006-04-11 13:48 ` [PATCH 06/14] libata-eh: implement ata_eh_autopsy() Tejun Heo
2006-04-11 13:48 ` [PATCH 14/14] sata_sil24: convert to new EH Tejun Heo
2006-04-11 13:48 ` [PATCH 12/14] sata_sil: " Tejun Heo
2006-04-11 13:48 ` [PATCH 13/14] ahci: " Tejun Heo
2006-04-20  6:01   ` zhao, forrest
2006-04-20  7:11     ` Tejun Heo
2006-04-20  7:44       ` Jeff Garzik
2006-04-21  1:34         ` Tejun Heo [this message]
2006-04-20  9:26   ` zhao, forrest
2006-04-21  1:20     ` Tejun Heo
2006-04-27  9:16 ` [PATCHSET 6/9] new EH implementation, take 2 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=444836AD.1030801@gmail.com \
    --to=htejun@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=albertcc@tw.ibm.com \
    --cc=axboe@suse.de \
    --cc=forrest.zhao@intel.com \
    --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).