Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Date | Mon, 16 Jun 2003 17:12:02 +0200 | From | mikpe@csd ... | Subject | [PATCH][2.5.71] fix x86-64 nmi.c oops on Simics |
| |
Andi,
In 2.5, x86-64's nmi.c will semi-enable the local APIC NMI watchdog on Simics, which leads to a kernel oops if disable_lapic_nmi_watchdog() is called. The reason is:
1. setup_apic_nmi_watchdog() calls setup_k7_watchdog() for incorrect CPU models. Simics is model 8 while we should only allow models 6 and 15 (well, 6 can't occur). 2. setup_k7_watchdog() initialises nmi_watchdog_msr [which tells others that we're enabled], and then tries to wrmsr() the MSRs. This fails in Simics with a #GP, you catch the failure and bail out. 3. on return to setup_apic_nmi_watchdog(), the failure goes unnoticed and nmi_active is set to 1. 4. Later someone calls disable_lapic_nmi_watchdog(), which, since nmi_active == 1, goes ahead and wrmsr()s EVNTSEL0. Bang!
The patch below forces setup_apic_nmi_watchdog() to bail out on unknown models, so we never get into this half-initialised situation on Simics. This also merges the code with what's in i386's nmi.c.
With this in place you could remove the error-checking wrmsr()s, but I didn't bother with that at this time.
/Mikael
diff -ruN linux-2.5.71-andi/arch/x86_64/kernel/nmi.c linux-2.5.71-mikpe/arch/x86_64/kernel/nmi.c --- linux-2.5.71-andi/arch/x86_64/kernel/nmi.c 2003-06-16 16:08:35.000000000 +0200 +++ linux-2.5.71-mikpe/arch/x86_64/kernel/nmi.c 2003-06-16 16:20:29.000000000 +0200 @@ -233,7 +236,7 @@ { switch (boot_cpu_data.x86_vendor) { case X86_VENDOR_AMD: - if (boot_cpu_data.x86 < 6) + if (boot_cpu_data.x86 != 6 && boot_cpu_data.x86 != 15) return; setup_k7_watchdog(); break; - 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/
| ![\](/images/icornerr.gif) |