Re: [PATCH 11/12] libata: use IRQ expecting

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Tejun Heo
Date: Saturday, June 26, 2010 - 2:44 am

Hello, Jeff.

On 06/26/2010 11:16 AM, Jeff Garzik wrote:

That's actually what we wanna know.  I'll talk about it below.


Unacked irqs are primarily handled by spurious IRQ handling.  IRQ
expecting is more about lost interrupts and we have enough lost
interrupt cases even on new controllers w/ native interface, both
transient and non-transient.

One of the goals of this whole IRQ exception handling was to make it
dumb easy for drivers to use which also included makes things cheap
enough so that they can be called from hot paths.  Both expect and
unexpect_irq() are very cheap once the IRQ delivery is verified.  If
the processor is taking an interrupt in the first place, this amount
of logic shouldn't matter at all.  There really isn't punishment to
avoid and IMHO not doing it for native controllers is an over
optimization.  It gains almost nothing while losing meaningful
protection.


I'm not saying applying it to only SFF/BMDMA is difficult, just that
it's better to apply it to all drivers in this case.  IRQ expecting is
to protect against misdelivered / lost IRQs and we do have them for
ahci, sil24 or whatever too.  It would of course be silly to pay
significant performance overhead for such protection but as I stated
above, it's _really_ cheap.  If the driver is taking an interrupt and
accessing harddware and even if compared only against the general
complexity of generic IRQ and libata code, the cost of IRQ [un]expect
is negligible and designed precisely that way to allow use cases like
this.


Continuing from the response to the first paragraph.  The IRQ
expecting code isn't interested in the bus state, it's interested only
in the IRQ events and that's what it's expecting.  The same applies to
power state prediction too, so please consider the following NCQ
command execution sequence.

1. issue tags 0, 1, 2, 3
2. IRQ triggers, tags 0, 2 complete
3. IRQ triggers, tags 1, 3 completes

For IRQ expecting, both 1-2 and 2-3 are segments to expect for and for
power state transition too, as it's IRQ itself which forces the cpu to
come out of sleep state.  The reason why I said unexpect in
ata_qc_complete() is okay is that it can still delimit each segment as
long as we have proper irq_expect() call at the beginning of each
segment (all other unexpect calls are ignored).  But, that's kind of
moot point as we can easily do single pair.

Thanks.

-- 
tejun
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCHSET] irq: better lost/spurious irq handling, Tejun Heo, (Sun Jun 13, 8:31 am)
[PATCH 01/12] irq: cleanup irqfixup, Tejun Heo, (Sun Jun 13, 8:31 am)
[PATCH 04/12] irq: kill IRQF_IRQPOLL, Tejun Heo, (Sun Jun 13, 8:31 am)
[PATCH 06/12] irq: implement irq_schedule_poll(), Tejun Heo, (Sun Jun 13, 8:31 am)
[PATCH 07/12] irq: improve spurious IRQ handling, Tejun Heo, (Sun Jun 13, 8:31 am)
[PATCH 11/12] libata: use IRQ expecting, Tejun Heo, (Sun Jun 13, 8:31 am)
[PATCH 12/12] usb: use IRQ watching, Tejun Heo, (Sun Jun 13, 8:31 am)
Re: [PATCH 12/12] usb: use IRQ watching, Greg KH, (Mon Jun 14, 2:41 pm)
Re: [PATCH 12/12] usb: use IRQ watching, Tejun Heo, (Mon Jun 14, 2:52 pm)
Re: [PATCH 12/12] usb: use IRQ watching, Greg KH, (Mon Jun 14, 3:11 pm)
Re: [PATCH 12/12] usb: use IRQ watching, Tejun Heo, (Mon Jun 14, 3:19 pm)
Re: [PATCH 02/12] irq: make spurious poll timer per desc, Konrad Rzeszutek Wilk, (Mon Jun 14, 10:10 pm)
Re: [PATCH 12/12] usb: use IRQ watching, Kay Sievers, (Tue Jun 15, 3:30 am)
Re: [PATCH 12/12] usb: use IRQ watching, Jean Delvare, (Tue Jun 15, 4:05 am)
Re: [PATCH 12/12] usb: use IRQ watching, Tejun Heo, (Tue Jun 15, 4:20 am)
Re: [PATCH 12/12] usb: use IRQ watching, Kay Sievers, (Tue Jun 15, 6:30 am)
Re: [PATCH 12/12] usb: use IRQ watching, Kay Sievers, (Tue Jun 15, 6:36 am)
Re: [PATCH 12/12] usb: use IRQ watching, Tejun Heo, (Tue Jun 15, 10:36 am)
Re: [PATCH 06/12] irq: implement irq_schedule_poll(), Jonathan Corbet, (Tue Jun 15, 10:40 am)
Re: [PATCH 12/12] usb: use IRQ watching, Greg KH, (Tue Jun 15, 10:47 am)
Re: [PATCH 06/12] irq: implement irq_schedule_poll(), Tejun Heo, (Tue Jun 15, 10:51 am)
Re: [PATCH 12/12] usb: use IRQ watching, Tejun Heo, (Tue Jun 15, 10:52 am)
Re: [PATCH 12/12] usb: use IRQ watching, Tejun Heo, (Mon Jun 21, 6:51 am)
Re: [PATCH 11/12] libata: use IRQ expecting, Tejun Heo, (Mon Jun 21, 6:52 am)
Re: [PATCH 12/12] usb: use IRQ watching, Greg KH, (Mon Jun 21, 1:27 pm)
Re: [PATCH 12/12] usb: use IRQ watching, Tejun Heo, (Tue Jun 22, 12:32 am)
Re: [PATCH 11/12] libata: use IRQ expecting, Jeff Garzik, (Thu Jun 24, 5:22 pm)
Re: [PATCH 11/12] libata: use IRQ expecting, Tejun Heo, (Fri Jun 25, 12:44 am)
Re: [PATCH 11/12] libata: use IRQ expecting, Jeff Garzik, (Fri Jun 25, 2:48 am)
Re: [PATCH 11/12] libata: use IRQ expecting, Tejun Heo, (Fri Jun 25, 2:51 am)
Re: [PATCH 11/12] libata: use IRQ expecting, Jeff Garzik, (Fri Jun 25, 8:45 pm)
Re: [PATCH 11/12] libata: use IRQ expecting, Jeff Garzik, (Fri Jun 25, 8:52 pm)
Re: [PATCH 11/12] libata: use IRQ expecting, Tejun Heo, (Sat Jun 26, 1:31 am)
Re: [PATCH 11/12] libata: use IRQ expecting, Jeff Garzik, (Sat Jun 26, 2:16 am)
Re: [PATCH 11/12] libata: use IRQ expecting, Tejun Heo, (Sat Jun 26, 2:44 am)
Re: [PATCH 11/12] libata: use IRQ expecting, Tejun Heo, (Fri Jul 2, 7:41 am)
Re: [PATCH 11/12] libata: use IRQ expecting, Tejun Heo, (Fri Jul 2, 7:53 am)
[GIT PULL] irq: better lost/spurious irq handling, Tejun Heo, (Fri Jul 2, 7:59 am)
Re: [PATCH 11/12] libata: use IRQ expecting, Tejun Heo, (Sat Jul 10, 3:06 am)
Re: [PATCH 11/12] libata: use IRQ expecting, Jeff Garzik, (Wed Jul 14, 12:58 am)
Re: [PATCH 11/12] libata: use IRQ expecting, Tejun Heo, (Wed Jul 14, 2:26 am)
Re: [PATCH 11/12] libata: use IRQ expecting, Jeff Garzik, (Tue Jul 27, 10:37 am)