Interrupt Handling Doubts ....

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 

Hi All,

 

It’s about Interrupt Handling in Linux Kernel.

I have following doubts regarding Interrupt Handling:

 

-          What does the cli() and sti() functions do, I know that “cli” and “sti” instructions in assembly language clear and set the interrupt reporting for a processor which is executing it. But on SMP machines, does cli() and sti() clear and set the interrupt reporting on single processor (processor which is executing it), or it works for all processors (I mean if one processor calls cli(), will it block the interrupt reporting on all the processors). In assembly language I think “cli” and “sti” instructions are for only that processor which executes it and does not affect the interrupt reporting on other processor. Am I right ?

 

-          In handle_IRQ_event() function (http://lxr.linux.no/source/arch/i386/kernel/irq.c?v=2.4.21#L437), before calling the actual interrupt handler why are we checking the flag of only first handler in list. If in case there are multiple drivers sharing a particular handler (that means, for that interrupt line there are more than one interrupt handler to be called), we should check the flag of each handler before calling it, if that flag says that handler need is a fast handler, we need to put the interrupt handling “off” by calling cli() for that handler. In case if the flag of that handler says that it’s a slow handler, we need to set the interrupt handling “on” by calling sti(). But if you check the code of handle_IRQ_event() function, you will find that only the flag of first handler is checked and then all other subsequent handlers in list are called without checking a flag.

 

-          Can someone tell me what’s the use of checking the “global_irq_lock” variable, before invoking the interrupt handler in handle_IRQ_event() function (http://lxr.linux.no/source/arch/i386/kernel/irq.c?v=2.4.21#L437). LDD says that if this variable (global lock) is equal to zero then only the interrupt handler will be invoked. My question is why so, what the benefit we are getting out of it. Also let me know where in kernel the value of this global lock is increased or decreased, it might help in understanding the use of it.

 

-          In hanle_IRQ_event() function (http://lxr.linux.no/source/arch/i386/kernel/irq.c?v=2.4.21#L437), we are calling irq_enter() and irq_exit() function, which actually increase and decreases the cpu specific irq count (local_irq_count variable). Can someone tell me the use of this action, or why this cpu specific interrupt count is maintained.

 

-          Last question, in hanle_IRQ_event() function, why are we calling _cli() function (for disabling the interrupt reporting) once all the interrupt handlers have been invoked. You can find it at the end of hanle_IRQ_event() function (http://lxr.linux.no/source/arch/i386/kernel/irq.c?v=2.4.21#L437).

 

Regards,

Gaurav

 


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux