ATA driver races with interrupts

Ville-Pertti Keinonen will+freebsd-current at
Tue Aug 3 00:25:12 PDT 2004

Søren Schmidt wrote:

> If the controller doesn't have a bit saying if the interrupt is for 
> us, then its impossible to close the race completely (without the 
> above measures in place). However some devices use the DMA interrupt 
> bits even in PIO mode (ie HPT does this) but I have no docs on the 
> VIA's on that, but its worth a try at least...

The current situation seems to me like ata_generic_intr can't work for 
*any* controller sharing interrupts, even with DMA on a controller that 
sets ATA_BMSTAT_INTERRUPT correctly, since if an interrupt occurs before 
ATA_DMA_ACTIVE is set, ATA_BMSTAT_PORT is never even checked.

IMHO ch->running != NULL is an insufficient condition based on which to 
assume that an interrupt is intended for a specific channel...

Something similar to my patch + disabling interrupts to avoid a race 
between the interrupt and ATA_EXPECT_INTR being set should at least 
improve the situation.  What races would that leave open?

More information about the freebsd-current mailing list