Re: Interrupt Handling in linux

From: Richard B. Johnson
Date: Fri Jul 09 2004 - 07:21:43 EST


On Fri, 9 Jul 2004, Harish K Harshan wrote:

> Hi.
>
> Can Interrupt handlers in linux, be interrupted by other running
> processes??? to make it more clear, im developing a driver for and ADC
> card, and would like to know if the CPU can or rather WILL schedule
> wnother running process in the middle of the ISR, when a timer interrupt
> comes in. If thats the case, then we need to use spinlocks or other
> mechanisms in our ISR, right?? im new to this, so if theres something not
> clear, it just just that my understanding of this topic is not very deep.
>
> Harish.
>
>

The usual case is that a hardware interrupt occurs, gets dispatched
by the kernel to the interrupt service routine, and is quickly
executed without interruption.

If you don't design your interrupt service code to be interrupted,
it won't be interrupted. However, another CPU may be executing
so you need to protect critical sections of code, including
your ISR, with spin-locks.

If you design your ISR to be interrupted, generally it will because,
especially on a network, there is always something that needs
interrupt service. There are so-called bottom-half handlers that
can be dispatched by your ISR to finish up what could be done
with interrupts enabled.

If your ADC board requires periodic service at a regular
interval as many do, (perhaps for an IIR filter) you might
think about writing code that executes on a timer queue,
rather than an interrupt.


Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
Note 96.31% of all statistics are fiction.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/