aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2008-06-24 16:52:05 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-08 06:51:41 -0400
commitc376d45432d935e6f1e0ff2d6be3734bcd3ba455 (patch)
treec776405c9734a11e6947b55cd2c44e4d7ec1fcfb
parent2b6addad2d67a2d75ae10a1c8efd18d81d78ff82 (diff)
x86: nmi_watchdog - use NMI_NONE by default
There is no need to keep NMI_DISABLED definition and use it for nmi_watchdog by default. Here is the point why: - IO-APIC and APIC chips are programmed for nmi_watchdog support at very early stage of kernel booting and not having nmi_watchdog specified as boot option lead only to nmi_watchdog becomes to NMI_NONE anyway - enable nmi_watchdog thru /proc/sys/kernel/nmi if it was not specified at boot is not possible too (even having this sysfs entry) Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Cc: macro@linux-mips.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/apic_64.c1
-rw-r--r--arch/x86/kernel/io_apic_64.c2
-rw-r--r--arch/x86/kernel/nmi.c26
-rw-r--r--arch/x86/kernel/smpboot.c1
-rw-r--r--include/asm-x86/nmi.h3
5 files changed, 3 insertions, 30 deletions
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 8c751f731bca..1e3d32e27c14 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -826,7 +826,6 @@ static void __cpuinit lapic_setup_esr(void)
826void __cpuinit end_local_APIC_setup(void) 826void __cpuinit end_local_APIC_setup(void)
827{ 827{
828 lapic_setup_esr(); 828 lapic_setup_esr();
829 nmi_watchdog_default();
830 setup_apic_nmi_watchdog(NULL); 829 setup_apic_nmi_watchdog(NULL);
831 apic_pm_activate(); 830 apic_pm_activate();
832} 831}
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 08c48750888a..2b4c40bc12c9 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -1729,7 +1729,6 @@ static inline void __init check_timer(void)
1729 } 1729 }
1730 unmask_IO_APIC_irq(0); 1730 unmask_IO_APIC_irq(0);
1731 if (!no_timer_check && timer_irq_works()) { 1731 if (!no_timer_check && timer_irq_works()) {
1732 nmi_watchdog_default();
1733 if (nmi_watchdog == NMI_IO_APIC) { 1732 if (nmi_watchdog == NMI_IO_APIC) {
1734 setup_nmi(); 1733 setup_nmi();
1735 enable_8259A_irq(0); 1734 enable_8259A_irq(0);
@@ -1758,7 +1757,6 @@ static inline void __init check_timer(void)
1758 if (timer_irq_works()) { 1757 if (timer_irq_works()) {
1759 apic_printk(APIC_VERBOSE," works.\n"); 1758 apic_printk(APIC_VERBOSE," works.\n");
1760 timer_through_8259 = 1; 1759 timer_through_8259 = 1;
1761 nmi_watchdog_default();
1762 if (nmi_watchdog == NMI_IO_APIC) { 1760 if (nmi_watchdog == NMI_IO_APIC) {
1763 disable_8259A_irq(0); 1761 disable_8259A_irq(0);
1764 setup_nmi(); 1762 setup_nmi();
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index 427c511e7adc..32acda25e3cb 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -52,7 +52,7 @@ static cpumask_t backtrace_mask = CPU_MASK_NONE;
52atomic_t nmi_active = ATOMIC_INIT(0); /* oprofile uses this */ 52atomic_t nmi_active = ATOMIC_INIT(0); /* oprofile uses this */
53EXPORT_SYMBOL(nmi_active); 53EXPORT_SYMBOL(nmi_active);
54 54
55unsigned int nmi_watchdog = NMI_DEFAULT; 55unsigned int nmi_watchdog = NMI_NONE;
56EXPORT_SYMBOL(nmi_watchdog); 56EXPORT_SYMBOL(nmi_watchdog);
57 57
58static int panic_on_timeout; 58static int panic_on_timeout;
@@ -92,14 +92,6 @@ static inline unsigned int get_timer_irqs(int cpu)
92#endif 92#endif
93} 93}
94 94
95/* Run after command line and cpu_init init, but before all other checks */
96void nmi_watchdog_default(void)
97{
98 if (nmi_watchdog != NMI_DEFAULT)
99 return;
100 nmi_watchdog = NMI_NONE;
101}
102
103#ifdef CONFIG_SMP 95#ifdef CONFIG_SMP
104/* 96/*
105 * The performance counters used by NMI_LOCAL_APIC don't trigger when 97 * The performance counters used by NMI_LOCAL_APIC don't trigger when
@@ -127,7 +119,7 @@ int __init check_nmi_watchdog(void)
127 unsigned int *prev_nmi_count; 119 unsigned int *prev_nmi_count;
128 int cpu; 120 int cpu;
129 121
130 if (nmi_watchdog == NMI_NONE || nmi_watchdog == NMI_DISABLED) 122 if (nmi_watchdog == NMI_NONE)
131 return 0; 123 return 0;
132 124
133 if (!atomic_read(&nmi_active)) 125 if (!atomic_read(&nmi_active))
@@ -482,24 +474,12 @@ int proc_nmi_enabled(struct ctl_table *table, int write, struct file *file,
482 if (!!old_state == !!nmi_watchdog_enabled) 474 if (!!old_state == !!nmi_watchdog_enabled)
483 return 0; 475 return 0;
484 476
485 if (atomic_read(&nmi_active) < 0 || nmi_watchdog == NMI_DISABLED) { 477 if (atomic_read(&nmi_active) < 0 || nmi_watchdog == NMI_NONE) {
486 printk(KERN_WARNING 478 printk(KERN_WARNING
487 "NMI watchdog is permanently disabled\n"); 479 "NMI watchdog is permanently disabled\n");
488 return -EIO; 480 return -EIO;
489 } 481 }
490 482
491 /* if nmi_watchdog is not set yet, then set it */
492 nmi_watchdog_default();
493
494#ifdef CONFIG_X86_32
495 if (nmi_watchdog == NMI_NONE) {
496 if (lapic_watchdog_ok())
497 nmi_watchdog = NMI_LOCAL_APIC;
498 else
499 nmi_watchdog = NMI_IO_APIC;
500 }
501#endif
502
503 if (nmi_watchdog == NMI_LOCAL_APIC) { 483 if (nmi_watchdog == NMI_LOCAL_APIC) {
504 if (nmi_watchdog_enabled) 484 if (nmi_watchdog_enabled)
505 enable_lapic_nmi_watchdog(); 485 enable_lapic_nmi_watchdog();
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 3b48d1f4c7c3..3b19441d78b8 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1139,7 +1139,6 @@ static void __init smp_cpu_index_default(void)
1139void __init native_smp_prepare_cpus(unsigned int max_cpus) 1139void __init native_smp_prepare_cpus(unsigned int max_cpus)
1140{ 1140{
1141 preempt_disable(); 1141 preempt_disable();
1142 nmi_watchdog_default();
1143 smp_cpu_index_default(); 1142 smp_cpu_index_default();
1144 current_cpu_data = boot_cpu_data; 1143 current_cpu_data = boot_cpu_data;
1145 cpu_callin_map = cpumask_of_cpu(0); 1144 cpu_callin_map = cpumask_of_cpu(0);
diff --git a/include/asm-x86/nmi.h b/include/asm-x86/nmi.h
index f0e435dd38fb..1348e542360f 100644
--- a/include/asm-x86/nmi.h
+++ b/include/asm-x86/nmi.h
@@ -20,7 +20,6 @@ extern void default_do_nmi(struct pt_regs *);
20#endif 20#endif
21 21
22extern void die_nmi(char *str, struct pt_regs *regs, int do_panic); 22extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
23extern void nmi_watchdog_default(void);
24extern int check_nmi_watchdog(void); 23extern int check_nmi_watchdog(void);
25extern int nmi_watchdog_enabled; 24extern int nmi_watchdog_enabled;
26extern int avail_to_resrv_perfctr_nmi_bit(unsigned int); 25extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);
@@ -38,12 +37,10 @@ extern int nmi_watchdog_tick(struct pt_regs *regs, unsigned reason);
38 37
39extern atomic_t nmi_active; 38extern atomic_t nmi_active;
40extern unsigned int nmi_watchdog; 39extern unsigned int nmi_watchdog;
41#define NMI_DISABLED -1
42#define NMI_NONE 0 40#define NMI_NONE 0
43#define NMI_IO_APIC 1 41#define NMI_IO_APIC 1
44#define NMI_LOCAL_APIC 2 42#define NMI_LOCAL_APIC 2
45#define NMI_INVALID 3 43#define NMI_INVALID 3
46#define NMI_DEFAULT NMI_DISABLED
47 44
48struct ctl_table; 45struct ctl_table;
49struct file; 46struct file;