ATA driver races with interrupts

Ville-Pertti Keinonen will+freebsd-current at
Tue Aug 3 02:28:01 PDT 2004

Søren Schmidt wrote:

> We dont want to disable interrupts, ever.

That makes avoiding races difficult for some hardware...

> I have one change in a tree here that you could try, but as long as 
> the hardware doesn't support proper interrupt status its impossible to 
> close the race window completely. Please remember that this is part of 
> a bigger patchset, so I might have edited it too much, YMMV,,

It introduces the same race as my patch - if the interrupt occurs after 
ATA_DMA_ACTIVE is set but before running is set, the interrupt may be 
acknowledged (I assume that's what writing BMSTAT_PORT does) but ignored 
(because running == NULL).

It seems to me that reliable solutions would all involve atomically 
(from an interrupt perspective) performing the final activation of the 
transaction and marking the transaction active for the interrupt handler 
to check.  What the correct way to ensure such atomicity in -current is, 
I don't know.

More information about the freebsd-current mailing list