From: mikpe@csd.uu.se
To: ak@suse.de
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH][2.5.71] fix x86-64 nmi.c oops on Simics
Date: Mon, 16 Jun 2003 17:12:02 +0200 [thread overview]
Message-ID: <16109.56898.422086.822671@gargle.gargle.HOWL> (raw)
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;
next reply other threads:[~2003-06-16 14:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-16 15:12 mikpe [this message]
2003-06-16 15:21 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16109.56898.422086.822671@gargle.gargle.HOWL \
--to=mikpe@csd.uu.se \
--cc=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®