The fate of IRQs while IF=0

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
yakujabi
Posts: 12
Joined: Mon Feb 25, 2008 11:16 pm

The fate of IRQs while IF=0

Post by yakujabi »

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?
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

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.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Post by Brendan »

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

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.
yakujabi
Posts: 12
Joined: Mon Feb 25, 2008 11:16 pm

Post by yakujabi »

Thanks JamesM & Brendan :)
Post Reply