Skip to contentSkip to conversation

disable NMI watchdog by default

PATCH In review Ingo Molnar 5 participants 5 messages Jan 14, 2007 – Mar 8, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 disable NMI watchdog by default

From: Ingo Molnar <[email protected]>
Subject: [patch] disable NMI watchdog by default

there's a new NMI watchdog related problem: KVM crashes on certain bzImages because ... we enable the NMI watchdog by default (even if the user does not ask for it) , and no other OS on this planet does that so KVM doesnt have emulation for that yet. So KVM injects a #GP, which crashes the Linux guest:

 general protection fault: 0000 [#1]
 PREEMPT SMP
 Modules linked in:
 CPU:    0
 EIP:    0060:[<c011a8ae>]    Not tainted VLI
 EFLAGS: 00000246   (2.6.20-rc5-rt0 #3)
 EIP is at setup_apic_nmi_watchdog+0x26d/0x3d3

and no, i did /not/ request an nmi_watchdog on the boot command line!

Solution: turn off that darn thing! It's a debug tool, not a 'make life harder' tool!!

with this patch the KVM guest boots up just fine.

And with this my laptop (Lenovo T60) also stops its sporadic hard hanging (sometimes in acpi_init(), sometimes later during bootup, sometimes much later during actual use) as well. It hung with both nmi_watchdog=1 and nmi_watchdog=2, so it's generally the fact of NMI injection that is causing problems, not the NMI watchdog variant, nor any particular bootup code.

The patch is unintrusive.

include/asm-i386/nmi.h +1 -1
Index: linux/include/asm-i386/nmi.h
===================================================================
@@ -33,7 +33,7 @@ extern int nmi_watchdog_tick (struct pt_
 
 extern atomic_t nmi_active;
 extern unsigned int nmi_watchdog;
-#define NMI_DEFAULT     -1
+#define NMI_DEFAULT     0
 #define NMI_NONE	0
 #define NMI_IO_APIC	1
 #define NMI_LOCAL_APIC	2
include/asm-x86_64/nmi.h +1 -1
Index: linux/include/asm-x86_64/nmi.h
===================================================================
@@ -63,7 +63,7 @@ extern int setup_nmi_watchdog(char *);
 
 extern atomic_t nmi_active;
 extern unsigned int nmi_watchdog;
-#define NMI_DEFAULT	-1
+#define NMI_DEFAULT	0
 #define NMI_NONE	0
 #define NMI_IO_APIC	1
 #define NMI_LOCAL_APIC	2
#1 lore raw
Quoted 6 lines · Ingo Molnar

And with this my laptop (Lenovo T60) also stops its sporadic hard hanging (sometimes in acpi_init(), sometimes later during bootup, sometimes much later during actual use) as well. It hung with both nmi_watchdog=1 and nmi_watchdog=2, so it's generally the fact of NMI injection that is causing problems, not the NMI watchdog variant, nor any particular bootup code.

I seem to recall a patch sent to lkml that removed nmi_watchdog functionality from ThinkPads exactly because of this. Something to do with SMBIOS code calling int 10h under SMM, and that it would hang hard if NMIs happened at that time.

Signature · 4 lines
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
#3 lore raw
In reply to Ingo Molnar
Quoted 15 lines · Ingo Molnar

From: Ingo Molnar <[email protected]>
Subject: [patch] disable NMI watchdog by default

there's a new NMI watchdog related problem: KVM crashes on certain bzImages because ... we enable the NMI watchdog by default (even if the user does not ask for it) , and no other OS on this planet does that so KVM doesnt have emulation for that yet. So KVM injects a #GP, which crashes the Linux guest:

 general protection fault: 0000 [#1]
 PREEMPT SMP
 Modules linked in:
 CPU:    0
 EIP:    0060:[<c011a8ae>]    Not tainted VLI
 EFLAGS: 00000246   (2.6.20-rc5-rt0 #3)
 EIP is at setup_apic_nmi_watchdog+0x26d/0x3d3

and no, i did /not/ request an nmi_watchdog on the boot command line!

Quoted 7 lines

Solution: turn off that darn thing! It's a debug tool, not a 'make life harder' tool!!

with this patch the KVM guest boots up just fine.

And with this my laptop (Lenovo T60) also stops its sporadic hard hanging (sometimes in acpi_init(), sometimes later during bootup, sometimes much later during actual use) as well. It hung with both nmi_watchdog=1 and nmi_watchdog=2, so it's generally the fact of NMI injection that is causing problems, not the NMI watchdog variant, nor any particular bootup code.

The patch is unintrusive.

I'm missing something, what limits this to systems running under kvm?

Signature · 3 lines
Bill Davidsen <[email protected]>
  "We have more to fear from the bungling of the incompetent than from
the machinations of the wicked."  - from Slashdot
#4 lore raw
Quoted 5 lines · Bill Davidsen
Quoted 3 lines

there's a new NMI watchdog related problem: KVM crashes on certain bzImages because ... we enable the NMI watchdog by default (even if the user does not ask for it) , and no other OS on this planet does that so KVM doesnt have emulation for that yet. So KVM injects a #GP, which crashes the Linux guest:

I'm missing something, what limits this to systems running under kvm?

Most likely kvm doesn't implement the msrs which drive the nmi watchdog. That makes it a kvm bug, not a problem with the nmi watchdog. Emulating it correctly is fairly difficult, though, especially if we want to migrate virtual machines between different processor models, so I hope this goes in.

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.