How to atomically disable shared device interrupt?
From: Andrey Borzenkov
Date: Wed Feb 04 2009 - 12:31:00 EST
May be I miss something obvious, but I do not see how is it possible to
disable interrupt while also avoiding either "stealing" someone else's
interrupt or getting "IRQ: nobody cared" occasionally.
So consider device that has status register that indicates events of
interest that happened in device. Those events may also generate
interrupt if interrupt generation is enabled; but they also are posted
even if interrupt generation is disabled.
So to check whether interrupt handler should handle (shared) interrupt
it a) checks that interrupts are currently enabled and b) that device
indicates pending events.
No consider what happens when interrupts are disabled on device.
CPU1 CPU2
IRQ posted
disable device interrupts
handler checks IRQ enabled
handler sees IRQ disabled
handler ignores interrupt
Actually the same race happens during enabling of interrupts
CPU1 CPU2
IRQ enabled
other device posts IRQ
handler checks
IRQ enabled
events pending
start processing
but IRQ was posted by some other device in the first place.
Any idea?
Attachment:
signature.asc
Description: This is a digitally signed message part.