Commit 0328ecef authored by Daniel Gollub's avatar Daniel Gollub Committed by Linus Torvalds

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
b7471c6d.

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: default avatarDaniel Gollub <dgollub@suse.de>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 8154549c
...@@ -1085,7 +1085,7 @@ static int __init detect_init_APIC (void) ...@@ -1085,7 +1085,7 @@ static int __init detect_init_APIC (void)
if (l & MSR_IA32_APICBASE_ENABLE) if (l & MSR_IA32_APICBASE_ENABLE)
mp_lapic_addr = l & MSR_IA32_APICBASE_BASE; mp_lapic_addr = l & MSR_IA32_APICBASE_BASE;
if (nmi_watchdog != NMI_NONE) if (nmi_watchdog != NMI_NONE && nmi_watchdog != NMI_DISABLED)
nmi_watchdog = NMI_LOCAL_APIC; nmi_watchdog = NMI_LOCAL_APIC;
printk(KERN_INFO "Found and enabled local APIC!\n"); printk(KERN_INFO "Found and enabled local APIC!\n");
......
...@@ -77,7 +77,7 @@ static int __init check_nmi_watchdog(void) ...@@ -77,7 +77,7 @@ static int __init check_nmi_watchdog(void)
unsigned int *prev_nmi_count; unsigned int *prev_nmi_count;
int cpu; int cpu;
if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DEFAULT)) if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DISABLED))
return 0; return 0;
if (!atomic_read(&nmi_active)) if (!atomic_read(&nmi_active))
...@@ -424,7 +424,7 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file, ...@@ -424,7 +424,7 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
if (!!old_state == !!nmi_watchdog_enabled) if (!!old_state == !!nmi_watchdog_enabled)
return 0; return 0;
if (atomic_read(&nmi_active) < 0) { if (atomic_read(&nmi_active) < 0 || nmi_watchdog == NMI_DISABLED) {
printk( KERN_WARNING "NMI watchdog is permanently disabled\n"); printk( KERN_WARNING "NMI watchdog is permanently disabled\n");
return -EIO; return -EIO;
} }
......
...@@ -85,7 +85,7 @@ int __init check_nmi_watchdog (void) ...@@ -85,7 +85,7 @@ int __init check_nmi_watchdog (void)
int *counts; int *counts;
int cpu; int cpu;
if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DEFAULT)) if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DISABLED))
return 0; return 0;
if (!atomic_read(&nmi_active)) if (!atomic_read(&nmi_active))
...@@ -442,7 +442,7 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file, ...@@ -442,7 +442,7 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
if (!!old_state == !!nmi_watchdog_enabled) if (!!old_state == !!nmi_watchdog_enabled)
return 0; return 0;
if (atomic_read(&nmi_active) < 0) { if (atomic_read(&nmi_active) < 0 || nmi_watchdog == NMI_DISABLED) {
printk( KERN_WARNING "NMI watchdog is permanently disabled\n"); printk( KERN_WARNING "NMI watchdog is permanently disabled\n");
return -EIO; return -EIO;
} }
......
...@@ -33,11 +33,12 @@ extern int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason); ...@@ -33,11 +33,12 @@ extern int nmi_watchdog_tick (struct pt_regs * regs, unsigned reason);
extern atomic_t nmi_active; extern atomic_t nmi_active;
extern unsigned int nmi_watchdog; extern unsigned int nmi_watchdog;
#define NMI_DEFAULT -1 #define NMI_DISABLED -1
#define NMI_NONE 0 #define NMI_NONE 0
#define NMI_IO_APIC 1 #define NMI_IO_APIC 1
#define NMI_LOCAL_APIC 2 #define NMI_LOCAL_APIC 2
#define NMI_INVALID 3 #define NMI_INVALID 3
#define NMI_DEFAULT NMI_DISABLED
struct ctl_table; struct ctl_table;
struct file; struct file;
......
...@@ -64,11 +64,12 @@ extern int setup_nmi_watchdog(char *); ...@@ -64,11 +64,12 @@ extern int setup_nmi_watchdog(char *);
extern atomic_t nmi_active; extern atomic_t nmi_active;
extern unsigned int nmi_watchdog; extern unsigned int nmi_watchdog;
#define NMI_DEFAULT -1 #define NMI_DISABLED -1
#define NMI_NONE 0 #define NMI_NONE 0
#define NMI_IO_APIC 1 #define NMI_IO_APIC 1
#define NMI_LOCAL_APIC 2 #define NMI_LOCAL_APIC 2
#define NMI_INVALID 3 #define NMI_INVALID 3
#define NMI_DEFAULT NMI_DISABLED
struct ctl_table; struct ctl_table;
struct file; struct file;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment