Re: Q: x86 interrupt arrival after cli

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Thu May 16 2002 - 12:11:04 EST


On Thu, 16 May 2002, Ion Badulescu wrote:

> On Wed, 15 May 2002 20:27:20 -0400, Bart Trojanowski <bart@jukie.net> wrote:
> > [-- text/plain, encoding quoted-printable, 14 lines --]
> >
> > Quick question for the x86 gurus:
> >
> > If a hardware interrupt arrives within a spin_lock_irqsave &
> > spin_unlock_irqrestore will the interrupt handler associated with said
> > interrupt be called immediately after the spinlock is released?
> >
> > I am interested in any delays, even those less then a jiffie.
>
> The interrupt will occur when the instruction after the "sti" finishes.
> That's a one assembler instruction delay, i.e. a few clock cycles.
>
> *Which* interrupt will be serviced first, however, depends on how
> many interrupt sources you have active and on the IRQ prioritization.
>
> Ion
>
Correct. And the priority for the Intel/IBM class machine is:

<--- HIGHEST ------------------- LOWEST ---->

IRQ0, 1, 8, 9, 10, 11, 12, 13, 14, 15, 3, 4, 5, 6, 7
   | | | | | | | |_ printer
   | | | | | | |____ Floppy
   | | | | | |_______ Fixed disk
   | | | | |__________ Serial 0
   | | | |_____________ Serial 1
   | | |
   | | |___________ IRQ2->IRQ8 cascade RTC
   | |______________ Keyboard
   |_________________ PIT channel 0

IFF the IO-APIC is programmed to emulate the old dual controllers.

Answering;
"I am interested in any delays, even those less then a jiffie."

Any interrupt request that becomes active during your ISR, that
has a higher priority, will be serviced before your ISR gets
another chance to be serviced.

As far as normal delays are concerned, one can make a simple
interrupt routine that just bumps a counter, that works off
from IRQ7 (the printer port), with a 400MHz machine (obsolete now),
I could do 80,000 interrupts per second without missing any.

This number should scale to your CPU speed quite well. FYI, this
is the lowest priority and everything else was running (network
with all its broadcast junk, etc).

As I recall, if I disconnected the network, and didn't touch the
keyboard, I could do over 150,000 interrupts per second without
missing any.

Cheers,
Dick Johnson

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

                 Windows-2000/Professional isn't.

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



This archive was generated by hypermail 2b29 : Thu May 23 2002 - 22:00:12 EST