What happens to IRQs that fire while interrupts are disabled?
If they just get lost, how do I prevent user-mode tasks that use syscalls repeatedly (which, in turn, disable interrupts) from making the kernel miss important events such as timer IRQs?
The fate of IRQs while IF=0
Normally IRQs are level triggered, so the requesting device will hold its IRQ line low until acknowledged. The PIC does the job of prioritising and multiplexing IRQs for you - the only situation in which you could lose IRQs is if the device sends *multiple* IRQs - you will only recieve one when you reenable interrupts.
Hi,
Also note that for shared level triggered IRQs the PICs/APICs don't know about the second one - if any device's IRQ line is still active when you send the EOI it sends a second IRQ.
For shared edge triggered IRQs you can expect to lose IRQs. This is common for serial ports, and means that if you receive an IRQ from any serial port you need to check all serial ports that share that IRQ line to avoid missing one.
Cheers,
Brendan
Yes, but even for level triggered IRQs nothing is lost (unless it's edge triggered and a second IRQ occurs). The PIC chips and the local APICs both keep track of interrupts received and interrupts in progress (effectively they buffer the IRQ until the CPU is ready for it, and then send the highest priority IRQ to the CPU).JamesM wrote:Normally IRQs are level triggered, so the requesting device will hold its IRQ line low until acknowledged. The PIC does the job of prioritising and multiplexing IRQs for you - the only situation in which you could lose IRQs is if the device sends *multiple* IRQs - you will only recieve one when you reenable interrupts.
Also note that for shared level triggered IRQs the PICs/APICs don't know about the second one - if any device's IRQ line is still active when you send the EOI it sends a second IRQ.
For shared edge triggered IRQs you can expect to lose IRQs. This is common for serial ports, and means that if you receive an IRQ from any serial port you need to check all serial ports that share that IRQ line to avoid missing one.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.