From: Jeff Garzik <jeff@garzik.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: IDE/ATA development list <linux-ide@vger.kernel.org>
Subject: Re: Flexible SFF interrupt handling
Date: Wed, 28 Nov 2007 11:09:38 -0500 [thread overview]
Message-ID: <474D92C2.1080804@garzik.org> (raw)
In-Reply-To: <20071128142947.17221a33@the-village.bc.nu>
Alan Cox wrote:
>> In general, I think we should adopt a flexible or "loose" model for
>> acking interrupts on SFF controllers.
>
> Agreed - especially as the IRQ is often essentially the drive output not
> under any kind of sane control of ours.
Good point (I had not thought of looking at it that way).
>> (a) whenever we are in bus-idle (qc == NULL), and get an interrupt, go
>> ahead and read Status.
>
> Please call into the driver. Quite a few PATA drivers have multiple IRQ
> sources, and SATA many.
Done :) This should simply be a new behavior coded into the existing
interrupt handlers.
Thus you can choose per-driver whether to do this or not.
>> (b) if we are expecting an interrupt, and receive one, check Status (or
>> AltStatus if DMAing).
>
> Providing we are not mid data transfer (which is why we need to get into
> enable/disable_irq for some controllers). Right now its a problem that
> can't occur but on some controllers reading status mid PIO xfer causes
> joyous things like silent corruption.
True..
>> (c) if condition "(b)" indicates busy, initiate status polling every
>> 250ms until timeout occurs or BSY clears.
>
> Yep.
>
>> (d) if N seconds (4?) elapses without an interrupt, initiate polling.
>> keep a history of such "fail-over" events, and note each fail-over'd
>> command's eventual success via polling, success via interrupt, or
>> timeout. Use that history to decide to switch to 100% polling mode
>> (i.e. reach conclusion that interrupt delivery is broken, via observation)
>
> N = 8 sounds good to me (7 being the normal maximum command timeout)
>
>> That should cover no-interrupts, lost interrupts, early interrupts,
>> screaming interrupts, insane devices, and of course normal operation.
>
> Should we also consider resetting the device as one of the strategies (at
> least once off)
>
> Might also want to think at that point about the case of
>
> command
> ....
> timeout
>
> where old IDE checks with the controller to spot lost IRQ cases where a
> command finished and stuff vanished. Old IDE doesn't do much with it but
> we could use that as a good hint that we want to switch to polling mode
> and tell the user their computer sucks.
That's basically where I wanted to go with "(d)". Being able to both
handle interrupts _and_ fall back to polling makes it easy to notice
when interrupts are getting lost. If more than a couple rescues of this
nature occur, do as you describe.
Jeff
next prev parent reply other threads:[~2007-11-28 16:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-28 13:45 Flexible SFF interrupt handling Jeff Garzik
2007-11-28 14:29 ` Alan Cox
2007-11-28 16:09 ` Jeff Garzik [this message]
2007-11-28 14:33 ` Mark Lord
2007-11-28 15:58 ` Jeff Garzik
2007-11-28 16:48 ` Mark Lord
2007-11-28 17:00 ` Mark Lord
2007-11-30 1:08 ` Tejun Heo
2007-11-30 1:11 ` 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=474D92C2.1080804@garzik.org \
--to=jeff@garzik.org \
--cc=alan@lxorguk.ukuu.org.uk \
--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).