Re: ATA driver races with interrupts

From: Søren Schmidt <sos_at_DeepCore.dk>
Date: Tue, 03 Aug 2004 11:38:53 +0200
Ville-Pertti Keinonen wrote:
> Søren Schmidt wrote:
> 
>> We dont want to disable interrupts, ever.
> 
> That makes avoiding races difficult for some hardware...

Only on HW broken by design :)

>> 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).

Right, I have a change for that as well, but its a bit more work to sort 
out, but basically it makes DMA_ACTIVE into two flags, one for having 
loaded the DMA table though busdma, and one for having started the DMA 
engine. I'll try to sort that one out, but its entangled deeply in other 
changes so it needs a bit more work...

> 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.

Reliable solutions needs reliable HW, we can narrow down the race window 
here, but without HW support we cannot close it completely unless we 
serialises access to the channels (what lots of OS's does btw)..


-- 
-Søren
Received on Tue Aug 03 2004 - 07:39:00 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:04 UTC