[patch 18/20] i386: Handle P6s without performance counters in nmi watchdog

Greg KH
2007-08-21T06:59:19Z

[-- Attachment #1: i386-handle-p6s-without-performance-counters-in-nmi-watchdog.patch --]
[-- Type: text/plain, Size: 959 bytes --]

-stable review patch. If anyone has any objections, please let us know.

------------------
From: Andi Kleen <ak@suse.de>

I got an oops while booting a 32bit kernel on KVM because it doesn't
implement performance counters used by the NMI watchdog. Handle this
case.

Cc: Avi Kivity <avi@qumranet.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
arch/i386/kernel/cpu/perfctr-watchdog.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

--- a/arch/i386/kernel/cpu/perfctr-watchdog.c
+++ b/arch/i386/kernel/cpu/perfctr-watchdog.c
@@ -346,7 +346,9 @@ static int setup_p6_watchdog(unsigned nm
perfctr_msr = MSR_P6_PERFCTR0;
evntsel_msr = MSR_P6_EVNTSEL0;

- wrmsrl(perfctr_msr, 0UL);
+ /* KVM doesn't implement this MSR */
+ if (wrmsr_safe(perfctr_msr, 0, 0) < 0)
+ return 0;

evntsel = P6_EVNTSEL_INT
| P6_EVNTSEL_OS

--