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

From: Jeff Garzik
Date: Fri Jun 25 2010 - 23:52:38 EST

On 06/25/2010 03:44 AM, Tejun Heo wrote:
I still think calling unexpect_irq() from ata_qc_complete() is correct
as ata_qc_complete() is always a good indicator of completion events.

No, it's not. ata_qc_complete() is an indicator that _one_ completion event occurred, not _all_ completion events for that port.

Converting drivers to use ata_qc_complete_multiple() completely misses the point: ata_qc_complete_multiple() is doing exactly the same thing as those drivers: calling ata_qc_complete() in a loop.

ata_qc_complete() is -- as its name implies -- completing a single qc. Your patch introduces an unconditional controller-wide unexpect_irq() call. It's a layering violation.

You can trivially trace through ata_qc_complete_multiple() after patch #11 is applied, and see the result... for $N completion bits passed to ata_qc_complete_multiple(), you call
in rapid succession $N times, once for each ata_qc_complete() call in the loop of ata_qc_complete_multiple(). For something that is not needed for modern SATA controllers.

The preferred solution would be something that only touches legacy controllers, namely:

*) create ata_port_complete(), with the implementation


*) then call ata_port_complete() in the legacy code that needs unexpect_irq()

We don't want to burden modern SATA drivers with the overhead of dealing with silly PATA/SATA1 legacy irq nastiness, particularly the ugliness of calling

unexpect_irq() + expect_irq()

for a number of NCQ commands, in a tight loop!


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at