Disabling interrupts and masking interrupts

anish singh anish198519851985 at gmail.com
Thu Mar 7 11:04:15 EST 2013


On Thu, Mar 7, 2013 at 8:47 PM, Kevin Wilson <wkevils at gmail.com> wrote:
> Hi.
> First: Thanks, Anish, for your quick response.
>
> Does this mean that once you are disabling
> interrupts, these interrupts are lost ?  even later, when we will
> enable interrupts, the interrupts from the past that should have been
> created (but interrupts were disabled at that time interval) are in
> fact lost?
When you disable the interrupt source that means that interrupt didn't
happen itself.
>
> And once you mask interrupts, these interrupts
> are not lost, but these masked interrupts will be handled later when
> the interrupt is unmasked ?
yes.There are two kind of masking here one is at the interrupt controller
side and other at the processor side.
When you have masked in the interrupt controller than it is just that the
controller will later send the interrupt to the processor when you have done
unmask operation.
Whereas for processor side masking, if the interrupt which you have
raised is currently being handled and if the same interrupt has come then
all you will do is to mark it pending and handle it later when you are done
with the current interrupt.
Have a look at handle_edge_irq in kernel/irq/
>
> Did I understand correctly ?
> rgs
> Kevin
>
> On Thu, Mar 7, 2013 at 5:00 PM, anish singh <anish198519851985 at gmail.com> wrote:
>> On Thu, Mar 7, 2013 at 7:28 PM, Kevin Wilson <wkevils at gmail.com> wrote:
>>> Hello,
>>> what is the difference between disabling interrupts and masking
>>> interrupts ?  Disabling interrupts is done, AFAIK, with irq_disable().
>> Disabling interrupts means that you have disabled the source of interrupt.
>> Masking means that you are not(CPU) going to handle the interrupts until it is
>> unmasked.
>>> (see below)
>>> Can someone gives an example of how to mask interrupts
>>> with x86/x86_64 ?
>> Not familiar with x86. Try asking in kernel mailing list.I guess you
>> will get more help there.
>>>
>>> irq_disable() in x86 goes to native_irq_disable(), which
>>> eventually calls assembler "cli" command:
>>>
>>> CLI clears the IF bit in the flags.
>>>
>>>
>>> static inline void native_irq_disable(void)
>>> {
>>>         asm volatile("cli": : :"memory");
>>> }
>>> see arch/x86/include/asm/irqflags.h
>>>
>>> rgs,
>>> Kevin
>>>
>>> _______________________________________________
>>> Kernelnewbies mailing list
>>> Kernelnewbies at kernelnewbies.org
>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



More information about the Kernelnewbies mailing list