[lkml]   [2000]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Interrupt sharing
    Mahadev K Cholachagudda wrote:
    > > When an interrupt is delivered, the kernel calls ALL interrupt handlers
    > > registered for that interrupt. That means all drivers capable of
    > > sharing interrupts should, ideally, have code in their interrupt handler
    > > to exit ASAP if no work is necessary.
    > >
    > > status = RTL_R16(IntrStatus);
    > > /* exit ASAP if no interrupt conditions (0), or
    > > * if the hardware was unplugged (0xFFFF)
    > > */
    > > if ((status == 0) || (status == 0xFFFF))
    > > return;
    > >
    > If this is the case, if i am not wrong the data which is to be delivered to
    > the ISR will be emulated to the each drivers ISR. Is it true ?
    No, there is no emulation because there is nothing to emulate.
    There is no data "delivered" to an interrupt handler.

    The interrupt handler checks to see if the _device_ it serves have
    data, and handles that if necessary. Then the next handler for that
    interrupt is called, and it will check its device and so on.

    Note that you will never ever register two handlers for the same
    interrupt from the _same_ device. That makes no sense. Interrupt
    sharing happens when two different devices need to use the same
    interrupt number, possibly because you have more devices
    than available interrupts. (I.e. PCI have only four
    interrupt lines, but you may have 6 pci slots in your
    machine. Some will have to share.)

    An example:
    Machine have only one free interrupt line. A driver
    for a disk controller loads, and register a handler
    for that interrupt. Then a driver for a ethernet controller
    is loaded, and register a handler for the same interrupt.

    An interrupt happens. The kernel knows it belongs to one or
    both of the two devices, but it can't know which one.
    So it calls the handler for the first one, the disk controller.
    That handler will check if something happened with the disk,
    perhaps a completed write. In that case it does whatever
    it needs, perhaps queuing another write. If nothing needs to be
    done (because the disk didn't actually generate an interrupt) it
    returns immediately.

    When the handler returns
    the kernel also calls the other handler for that interrupt, the
    ethernet controller. It checks to see if anything happened
    with the ethernet, perhaps we received a frame. The frame is
    handled in that case. Or the routine just returns
    if there was nothing to do.

    As you see, no "emulation" of any kind, because each handler
    work solely with its own device.

    Helge Hafting
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 12:38    [W:3.294 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site