Re: Interrupt sharing

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Mon Sep 25 2000 - 09:06:26 EST


On Mon, 25 Sep 2000, Mahadev K Cholachagudda wrote:

> Hello to all,
>
> I have one doubt and is as below.
>
>
> Suppose say the two drivers driver1 and driver2 will install the ISR for a
> particular interrupt, say UART0.
> After some time the interrupt is generated. At this moment, which driver's
> ISR is going to execute ?.
>
> If driver1 ISR is get executed, will the driver2's ISR is going to execute
> ?. If say driver2's ISR is going to execute, Is the data that interrupt
> generated is going to be emulated to the driver2's ISR.
>
> please help,
>
> any help is welcome,
>
> with regards,
> Mahadev

Interrupt sharing works only with level interrupts. Your choice of
a UART for an example is unfortunate because the IRQs that they use
(IRQ3 and IRQ4) are not normally configured for level triggering.

That said, if you have a device that shares interrupts, the driver
does not know and does not care that it is sharing an interrupt.
It does not care if, and only if, the driver's ISR is written properly.

A properly-written ISR does not muck with the interrupt controller. It
reads the status registers of the device(s) that it is supposed to
handle, does whatever is necessary to satisfy the device, then gets
to hell out as quickly as possible. Under Linux, getting to hell out
is a simple 'return' from the void ISR procedure.

When your driver returns to the kernel code that called it, the kernel
code determines if the specific interrupt level is still pending. If
it is, it calls the next ISR that uses the same interrupt level. This
means that every ISR that uses the same interrupt level (IRQ) may get
called when there is nothing to do.

This is why a properly written ISR will check its device status and
if there is nothing to do, it will not complain, it will just return.

As you can see shared interrupts have a little more overhead than
non-shared ones, however nothing is ever 'lost'. An interrupt that
occurs during the execution of an interrupt is 'remembered' by the
controller because the the IRQ line will be set true and remain true
until the device requesting it is finally satisfied.

Cheers,
Dick Johnson

Penguin : Linux version 2.2.15 on an i686 machine (797.90 BogoMips).

"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.

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



This archive was generated by hypermail 2b29 : Sat Sep 30 2000 - 21:00:14 EST