linux-kernellinux-device-driverinterruptinterrupt-handlingirq

Concurrent interrupt handling for shared IRQ in Linux


What are the things that can be done or needs to be done in the top-half of an ISR handler. I see that the interrupts are disabled first, so when this is done, won't we miss the other interrupts (on the same IRQ line) that might arrive while handling the current interrupt?

Or is there any "entity" that keeps track of the missing interrupts, so that they can be handled after interrupts are enabled back again for that line at the end of the current running ISR?


Solution

  • A quick word on shared interrupts: shared interrupt lines should always use level-sensitive devices which should all be the same level (hi vs. low) as well. With edge-triggered interrupts there would be no way to guarantee that after one device triggers, but before it returns to its steady state, the other device won't trigger. It becomes a race condition that is impossible to avoid.

    Level-triggered interrupts on the other hand stay active until a flag on the device that triggered it has been cleared. While handling the first device, if the second device triggers, then it will wait with the IRQ line held active until the handler enables the IRQ line again.