* [PATCH][2.5.71] fix x86-64 nmi.c oops on Simics
@ 2003-06-16 15:12 mikpe
2003-06-16 15:21 ` Andi Kleen
0 siblings, 1 reply; 2+ messages in thread
From: mikpe @ 2003-06-16 15:12 UTC (permalink / raw)
To: ak; +Cc: linux-kernel
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;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][2.5.71] fix x86-64 nmi.c oops on Simics
2003-06-16 15:12 [PATCH][2.5.71] fix x86-64 nmi.c oops on Simics mikpe
@ 2003-06-16 15:21 ` Andi Kleen
0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2003-06-16 15:21 UTC (permalink / raw)
To: mikpe; +Cc: ak, linux-kernel
On Mon, Jun 16, 2003 at 05:12:02PM +0200, mikpe@csd.uu.se wrote:
> 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:
Thanks. I used to test for Simics explicitely by checking the cpuid
name for "ScrewDriver" in other places. I think I will do this here too.
-Andi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-06-16 15:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-16 15:12 [PATCH][2.5.71] fix x86-64 nmi.c oops on Simics mikpe
2003-06-16 15:21 ` Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).