x86_64: Fix to keep watchdog disabled by default for i386/x86_64

Fixed wrong expression which enabled watchdogs even if nmi_watchdog kernel
parameter wasn't set. This regression got slightly introduced with commit
b7471c6da94d30d3deadc55986cc38d1ff57f9ca.

Introduced NMI_DISABLED (-1) which allows to switch the value of NMI_DEFAULT
without breaking the APIC NMI watchdog code (again).

Fixes:
https://bugzilla.novell.com/show_bug.cgi?id=298084
http://bugzilla.kernel.org/show_bug.cgi?id=7839
And likely some more nmi_watchdog=0 related issues.

Signed-off-by: Daniel Gollub <dgollub@suse.de>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Daniel Gollub and committed by Linus Torvalds 0328ecef 8154549c

+9 -7
+1 -1
arch/i386/kernel/apic.c
··· 1085 1085 if (l & MSR_IA32_APICBASE_ENABLE) 1086 1086 mp_lapic_addr = l & MSR_IA32_APICBASE_BASE; 1087 1087 1088 - if (nmi_watchdog != NMI_NONE) 1088 + if (nmi_watchdog != NMI_NONE && nmi_watchdog != NMI_DISABLED) 1089 1089 nmi_watchdog = NMI_LOCAL_APIC; 1090 1090 1091 1091 printk(KERN_INFO "Found and enabled local APIC!\n");
+2 -2
arch/i386/kernel/nmi.c
··· 77 77 unsigned int *prev_nmi_count; 78 78 int cpu; 79 79 80 - if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DEFAULT)) 80 + if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DISABLED)) 81 81 return 0; 82 82 83 83 if (!atomic_read(&nmi_active)) ··· 424 424 if (!!old_state == !!nmi_watchdog_enabled) 425 425 return 0; 426 426 427 - if (atomic_read(&nmi_active) < 0) { 427 + if (atomic_read(&nmi_active) < 0 || nmi_watchdog == NMI_DISABLED) { 428 428 printk( KERN_WARNING "NMI watchdog is permanently disabled\n"); 429 429 return -EIO; 430 430 }
+2 -2
arch/x86_64/kernel/nmi.c
··· 85 85 int *counts; 86 86 int cpu; 87 87 88 - if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DEFAULT)) 88 + if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DISABLED)) 89 89 return 0; 90 90 91 91 if (!atomic_read(&nmi_active)) ··· 442 442 if (!!old_state == !!nmi_watchdog_enabled) 443 443 return 0; 444 444 445 - if (atomic_read(&nmi_active) < 0) { 445 + if (atomic_read(&nmi_active) < 0 || nmi_watchdog == NMI_DISABLED) { 446 446 printk( KERN_WARNING "NMI watchdog is permanently disabled\n"); 447 447 return -EIO; 448 448 }
+2 -1
include/asm-i386/nmi.h
··· 33 33 34 34 extern atomic_t nmi_active; 35 35 extern unsigned int nmi_watchdog; 36 - #define NMI_DEFAULT -1 36 + #define NMI_DISABLED -1 37 37 #define NMI_NONE 0 38 38 #define NMI_IO_APIC 1 39 39 #define NMI_LOCAL_APIC 2 40 40 #define NMI_INVALID 3 41 + #define NMI_DEFAULT NMI_DISABLED 41 42 42 43 struct ctl_table; 43 44 struct file;
+2 -1
include/asm-x86_64/nmi.h
··· 64 64 65 65 extern atomic_t nmi_active; 66 66 extern unsigned int nmi_watchdog; 67 - #define NMI_DEFAULT -1 67 + #define NMI_DISABLED -1 68 68 #define NMI_NONE 0 69 69 #define NMI_IO_APIC 1 70 70 #define NMI_LOCAL_APIC 2 71 71 #define NMI_INVALID 3 72 + #define NMI_DEFAULT NMI_DISABLED 72 73 73 74 struct ctl_table; 74 75 struct file;