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>
This commit is contained in:
Cyrill Gorcunov 2008-06-24 22:52:05 +02:00 committed by Ingo Molnar
parent 2b6addad2d
commit c376d45432
5 changed files with 3 additions and 30 deletions

View File

@ -826,7 +826,6 @@ static void __cpuinit lapic_setup_esr(void)
void __cpuinit end_local_APIC_setup(void) void __cpuinit end_local_APIC_setup(void)
{ {
lapic_setup_esr(); lapic_setup_esr();
nmi_watchdog_default();
setup_apic_nmi_watchdog(NULL); setup_apic_nmi_watchdog(NULL);
apic_pm_activate(); apic_pm_activate();
} }

View File

@ -1729,7 +1729,6 @@ static inline void __init check_timer(void)
} }
unmask_IO_APIC_irq(0); unmask_IO_APIC_irq(0);
if (!no_timer_check && timer_irq_works()) { if (!no_timer_check && timer_irq_works()) {
nmi_watchdog_default();
if (nmi_watchdog == NMI_IO_APIC) { if (nmi_watchdog == NMI_IO_APIC) {
setup_nmi(); setup_nmi();
enable_8259A_irq(0); enable_8259A_irq(0);
@ -1758,7 +1757,6 @@ static inline void __init check_timer(void)
if (timer_irq_works()) { if (timer_irq_works()) {
apic_printk(APIC_VERBOSE," works.\n"); apic_printk(APIC_VERBOSE," works.\n");
timer_through_8259 = 1; timer_through_8259 = 1;
nmi_watchdog_default();
if (nmi_watchdog == NMI_IO_APIC) { if (nmi_watchdog == NMI_IO_APIC) {
disable_8259A_irq(0); disable_8259A_irq(0);
setup_nmi(); setup_nmi();

View File

@ -52,7 +52,7 @@ static cpumask_t backtrace_mask = CPU_MASK_NONE;
atomic_t nmi_active = ATOMIC_INIT(0); /* oprofile uses this */ atomic_t nmi_active = ATOMIC_INIT(0); /* oprofile uses this */
EXPORT_SYMBOL(nmi_active); EXPORT_SYMBOL(nmi_active);
unsigned int nmi_watchdog = NMI_DEFAULT; unsigned int nmi_watchdog = NMI_NONE;
EXPORT_SYMBOL(nmi_watchdog); EXPORT_SYMBOL(nmi_watchdog);
static int panic_on_timeout; static int panic_on_timeout;
@ -92,14 +92,6 @@ static inline unsigned int get_timer_irqs(int cpu)
#endif #endif
} }
/* Run after command line and cpu_init init, but before all other checks */
void nmi_watchdog_default(void)
{
if (nmi_watchdog != NMI_DEFAULT)
return;
nmi_watchdog = NMI_NONE;
}
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
/* /*
* The performance counters used by NMI_LOCAL_APIC don't trigger when * The performance counters used by NMI_LOCAL_APIC don't trigger when
@ -127,7 +119,7 @@ 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_DISABLED) if (nmi_watchdog == NMI_NONE)
return 0; return 0;
if (!atomic_read(&nmi_active)) if (!atomic_read(&nmi_active))
@ -482,24 +474,12 @@ 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 || nmi_watchdog == NMI_DISABLED) { if (atomic_read(&nmi_active) < 0 || nmi_watchdog == NMI_NONE) {
printk(KERN_WARNING printk(KERN_WARNING
"NMI watchdog is permanently disabled\n"); "NMI watchdog is permanently disabled\n");
return -EIO; return -EIO;
} }
/* if nmi_watchdog is not set yet, then set it */
nmi_watchdog_default();
#ifdef CONFIG_X86_32
if (nmi_watchdog == NMI_NONE) {
if (lapic_watchdog_ok())
nmi_watchdog = NMI_LOCAL_APIC;
else
nmi_watchdog = NMI_IO_APIC;
}
#endif
if (nmi_watchdog == NMI_LOCAL_APIC) { if (nmi_watchdog == NMI_LOCAL_APIC) {
if (nmi_watchdog_enabled) if (nmi_watchdog_enabled)
enable_lapic_nmi_watchdog(); enable_lapic_nmi_watchdog();

View File

@ -1139,7 +1139,6 @@ static void __init smp_cpu_index_default(void)
void __init native_smp_prepare_cpus(unsigned int max_cpus) void __init native_smp_prepare_cpus(unsigned int max_cpus)
{ {
preempt_disable(); preempt_disable();
nmi_watchdog_default();
smp_cpu_index_default(); smp_cpu_index_default();
current_cpu_data = boot_cpu_data; current_cpu_data = boot_cpu_data;
cpu_callin_map = cpumask_of_cpu(0); cpu_callin_map = cpumask_of_cpu(0);

View File

@ -20,7 +20,6 @@ extern void default_do_nmi(struct pt_regs *);
#endif #endif
extern void die_nmi(char *str, struct pt_regs *regs, int do_panic); extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
extern void nmi_watchdog_default(void);
extern int check_nmi_watchdog(void); extern int check_nmi_watchdog(void);
extern int nmi_watchdog_enabled; extern int nmi_watchdog_enabled;
extern int avail_to_resrv_perfctr_nmi_bit(unsigned int); extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);
@ -38,12 +37,10 @@ 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_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;