Re: Interrupt Handling Doubts ....

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

 



On Mon, Sep 06, 2004 at 11:45:52PM +0530, Dhiman, Gaurav wrote:
> [...] 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 ?

Yes.

> -          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.

Good point. I guess that's a bug then.

> -          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.

It seems that in 2.4 kernels it was possible to globally disable
interrupts using cli()/sti(), which in turn uses the global lock:
cli() -> __global_cli() -> get_irqlock() -> wait_on_irq()

As of 2.6 these functions are obsolete.

> -          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.

It helps to keep track of the recursion depth. Using this variable the
kernel can tell whether it has to restore user context or another kernel
context.

> -          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. [...]

Because we are now restoring the previously interrupted context and it
would result in countless race conditions if interrupts were enabled.

Regards,
Clemens

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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