x86, mce, cmci: avoid potential reentry of threshold interrupt
authorAndi Kleen <andi@firstfloor.org>
Thu, 12 Feb 2009 12:49:32 +0000 (13:49 +0100)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 24 Feb 2009 21:24:42 +0000 (13:24 -0800)
Impact: minor bugfix

The threshold handler on AMD (and soon on Intel) could be theoretically
reentered by the hardware. This could lead to corrupted events
because the machine check poll code assumes it is not reentered.

Move the APIC ACK to the end of the interrupt handler to let
the hardware avoid that.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
arch/x86/kernel/cpu/mcheck/threshold.c

index 4319142413d776e2927dfb6913681b21bc88ef32..e4b8a3833fc514939f0dd0484410c62ef188b175 100644 (file)
@@ -15,10 +15,11 @@ void (*mce_threshold_vector)(void) = default_threshold_interrupt;
 
 asmlinkage void mce_threshold_interrupt(void)
 {
-       ack_APIC_irq();
        exit_idle();
        irq_enter();
        inc_irq_stat(irq_threshold_count);
        mce_threshold_vector();
        irq_exit();
+       /* Ack only at the end to avoid potential reentry */
+       ack_APIC_irq();
 }