linux/arch/x86_64
Eric W. Biederman ef3e28c5b9 x86_64: check remote IRR bit before migrating level triggered irq
On x86_64 kernel, level triggered irq migration gets initiated in the
context of that interrupt(after executing the irq handler) and following
steps are followed to do the irq migration.

1. mask IOAPIC RTE entry;     // write to IOAPIC RTE
2. EOI;                       // processor EOI write
3. reprogram IOAPIC RTE entry // write to IOAPIC RTE with new destination and
                              // and interrupt vector due to per cpu vector
                              // allocation.
4. unmask IOAPIC RTE entry;   // write to IOAPIC RTE

Because of the per cpu vector allocation in x86_64 kernels, when the irq
migrates to a different cpu, new vector(corresponding to the new cpu) will
get allocated.

An EOI write to local APIC has a side effect of generating an EOI write for
level trigger interrupts (normally this is a broadcast to all IOAPICs).
The EOI broadcast generated as a side effect of EOI write to processor may
be delayed while the other IOAPIC writes (step 3 and 4) can go through.

Normally, the EOI generated by local APIC for level trigger interrupt
contains vector number.  The IOAPIC will take this vector number and search
the IOAPIC RTE entries for an entry with matching vector number and clear
the remote IRR bit (indicate EOI).  However, if the vector number is
changed (as in step 3) the IOAPIC will not find the RTE entry when the EOI
is received later.  This will cause the remote IRR to get stuck causing the
interrupt hang (no more interrupt from this RTE).

Current x86_64 kernel assumes that remote IRR bit is cleared by the time
IOAPIC RTE is reprogrammed.  Fix this assumption by checking for remote IRR
bit and if it still set, delay the irq migration to the next interrupt
arrival event(hopefully, next time remote IRR bit will get cleared before
the IOAPIC RTE is reprogrammed).

Initial analysis and patch from Nanhai.

Clean up patch from Suresh.

Rewritten to be less intrusive, and to contain a big fat comment by Eric.

[akpm@linux-foundation.org: fix comments]
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Nanhai Zou <nanhai.zou@intel.com>
Acked-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Asit Mallick <asit.k.mallick@intel.com>
Cc: Keith Packard <keith.packard@intel.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-21 18:37:10 -07:00
..
boot Update .gitignore for arch/i386/boot 2007-07-19 14:32:38 -07:00
crypto [CRYPTO] api: Get rid of flags argument to setkey 2006-09-21 11:41:02 +10:00
ia32 x86_64: ia32entry adjustments 2007-07-21 18:37:09 -07:00
kernel x86_64: check remote IRR bit before migrating level triggered irq 2007-07-21 18:37:10 -07:00
lib Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq 2007-02-26 14:17:50 -08:00
mm x86_64: fake apicid_to_node mapping for fake numa 2007-07-21 18:37:10 -07:00
oprofile [PATCH] Move Kprobes and Oprofile to "Instrumentation Support" menu 2005-11-07 07:53:35 -08:00
pci [PATCH] mmconfig: fix unreachable_devices() 2007-02-13 13:26:20 +01:00
vdso x86_64: Add vDSO for x86-64 with gettimeofday/clock_gettime/getcpu 2007-07-21 18:37:08 -07:00
defconfig x86_64: Update defconfig 2007-07-21 18:37:07 -07:00
Kconfig x86_64: Quicklist support for x86_64 2007-07-21 18:37:09 -07:00
Kconfig.debug Allow DEBUG_RODATA and KPROBES to co-exist 2007-06-21 16:02:50 -07:00
Makefile x86_64: Add vDSO for x86-64 with gettimeofday/clock_gettime/getcpu 2007-07-21 18:37:08 -07:00