x86: mce: clear injection state after event Currently when an event is ever injected the machine check code will never read the hardware registers again, but always only look at the fake software injection registers. Clear the injection state after an event has been processed. This way normal hardware events will be processed again after injection. Signed-off-by: Andi Kleen <ak@linux.intel.com>
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index 2cd0a51..9a70b10 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -379,6 +379,18 @@ wrmsrl(msr, v); } +/* + * Switch back to processing hardware events after finishing + * an injected event. + */ +static void mce_end_injection(unsigned long *b) +{ + struct mce *m = &__get_cpu_var(injectm); + + if (m->finished && test_bit(m->bank, b)) + m->finished = 0; +} + /* * Simple lockless ring to communicate PFNs from the exception handler with the * process context work function. This is vastly simplified because there's @@ -598,6 +610,8 @@ mce_wrmsrl(MSR_IA32_MCx_STATUS(i), 0); } + mce_end_injection(*b); + /* * Don't clear MCG_STATUS here because it's only defined for * exceptions. @@ -1081,6 +1095,7 @@ if (worst > 0) mce_report_event(regs); mce_wrmsrl(MSR_IA32_MCG_STATUS, 0); + mce_end_injection(toclear); out: atomic_dec(&mce_entry); sync_core();