diff options
| author | Don Zickus <dzickus@redhat.com> | 2010-11-12 11:22:23 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2010-11-18 03:08:23 -0500 |
| commit | 5f2b0ba4d94b3ac23cbc4b7f675d98eb677a760a (patch) | |
| tree | 32fc744a15b13becdb559963ea982f07ce9a1d37 | |
| parent | a89d4bd055718d3b4ddb380ee22951a1300b4096 (diff) | |
x86, nmi_watchdog: Remove the old nmi_watchdog
Now that we have a new nmi_watchdog that is more generic and
sits on top of the perf subsystem, we really do not need the old
nmi_watchdog any more.
In addition, the old nmi_watchdog doesn't really work if you are
using the default clocksource, hpet. The old nmi_watchdog code
relied on local apic interrupts to determine if the cpu is still
alive. With hpet as the clocksource, these interrupts don't
increment any more and the old nmi_watchdog triggers false
postives.
This piece removes the old nmi_watchdog code and stubs out any
variables and functions calls. The stubs are the same ones used
by the new nmi_watchdog code, so it should be well tested.
Signed-off-by: Don Zickus <dzickus@redhat.com>
Cc: fweisbec@gmail.com
Cc: gorcunov@openvz.org
LKML-Reference: <1289578944-28564-2-git-send-email-dzickus@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
| -rw-r--r-- | arch/x86/include/asm/nmi.h | 4 | ||||
| -rw-r--r-- | arch/x86/kernel/apic/Makefile | 5 | ||||
| -rw-r--r-- | arch/x86/kernel/apic/hw_nmi.c | 6 | ||||
| -rw-r--r-- | arch/x86/kernel/apic/nmi.c | 567 | ||||
| -rw-r--r-- | arch/x86/kernel/traps.c | 9 | ||||
| -rw-r--r-- | include/linux/nmi.h | 6 | ||||
| -rw-r--r-- | kernel/sysctl.c | 16 |
7 files changed, 5 insertions, 608 deletions
diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h index 932f0f86b4b7..33292ec848ca 100644 --- a/arch/x86/include/asm/nmi.h +++ b/arch/x86/include/asm/nmi.h | |||
| @@ -17,9 +17,6 @@ int do_nmi_callback(struct pt_regs *regs, int cpu); | |||
| 17 | 17 | ||
| 18 | extern void die_nmi(char *str, struct pt_regs *regs, int do_panic); | 18 | extern void die_nmi(char *str, struct pt_regs *regs, int do_panic); |
| 19 | extern int check_nmi_watchdog(void); | 19 | extern int check_nmi_watchdog(void); |
| 20 | #if !defined(CONFIG_LOCKUP_DETECTOR) | ||
| 21 | extern int nmi_watchdog_enabled; | ||
| 22 | #endif | ||
| 23 | extern int avail_to_resrv_perfctr_nmi_bit(unsigned int); | 20 | extern int avail_to_resrv_perfctr_nmi_bit(unsigned int); |
| 24 | extern int reserve_perfctr_nmi(unsigned int); | 21 | extern int reserve_perfctr_nmi(unsigned int); |
| 25 | extern void release_perfctr_nmi(unsigned int); | 22 | extern void release_perfctr_nmi(unsigned int); |
| @@ -30,7 +27,6 @@ extern void setup_apic_nmi_watchdog(void *); | |||
| 30 | extern void stop_apic_nmi_watchdog(void *); | 27 | extern void stop_apic_nmi_watchdog(void *); |
| 31 | extern void disable_timer_nmi_watchdog(void); | 28 | extern void disable_timer_nmi_watchdog(void); |
| 32 | extern void enable_timer_nmi_watchdog(void); | 29 | extern void enable_timer_nmi_watchdog(void); |
| 33 | extern int nmi_watchdog_tick(struct pt_regs *regs, unsigned reason); | ||
| 34 | extern void cpu_nmi_set_wd_enabled(void); | 30 | extern void cpu_nmi_set_wd_enabled(void); |
| 35 | 31 | ||
| 36 | extern atomic_t nmi_active; | 32 | extern atomic_t nmi_active; |
diff --git a/arch/x86/kernel/apic/Makefile b/arch/x86/kernel/apic/Makefile index 910f20b457c4..3966b564ea47 100644 --- a/arch/x86/kernel/apic/Makefile +++ b/arch/x86/kernel/apic/Makefile | |||
| @@ -3,10 +3,7 @@ | |||
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | obj-$(CONFIG_X86_LOCAL_APIC) += apic.o apic_noop.o probe_$(BITS).o ipi.o | 5 | obj-$(CONFIG_X86_LOCAL_APIC) += apic.o apic_noop.o probe_$(BITS).o ipi.o |
| 6 | ifneq ($(CONFIG_HARDLOCKUP_DETECTOR),y) | 6 | obj-y += hw_nmi.o |
| 7 | obj-$(CONFIG_X86_LOCAL_APIC) += nmi.o | ||
| 8 | endif | ||
| 9 | obj-$(CONFIG_HARDLOCKUP_DETECTOR) += hw_nmi.o | ||
| 10 | 7 | ||
| 11 | obj-$(CONFIG_X86_IO_APIC) += io_apic.o | 8 | obj-$(CONFIG_X86_IO_APIC) += io_apic.o |
| 12 | obj-$(CONFIG_SMP) += ipi.o | 9 | obj-$(CONFIG_SMP) += ipi.o |
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c index cefd6942f0e9..b68b17460016 100644 --- a/arch/x86/kernel/apic/hw_nmi.c +++ b/arch/x86/kernel/apic/hw_nmi.c | |||
| @@ -20,12 +20,14 @@ | |||
| 20 | /* For reliability, we're prepared to waste bits here. */ | 20 | /* For reliability, we're prepared to waste bits here. */ |
| 21 | static DECLARE_BITMAP(backtrace_mask, NR_CPUS) __read_mostly; | 21 | static DECLARE_BITMAP(backtrace_mask, NR_CPUS) __read_mostly; |
| 22 | 22 | ||
| 23 | #ifdef CONFIG_HARDLOCKUP_DETECTOR | ||
| 23 | u64 hw_nmi_get_sample_period(void) | 24 | u64 hw_nmi_get_sample_period(void) |
| 24 | { | 25 | { |
| 25 | return (u64)(cpu_khz) * 1000 * 60; | 26 | return (u64)(cpu_khz) * 1000 * 60; |
| 26 | } | 27 | } |
| 28 | #endif | ||
| 27 | 29 | ||
| 28 | #ifdef ARCH_HAS_NMI_WATCHDOG | 30 | #ifdef arch_trigger_all_cpu_backtrace |
| 29 | void arch_trigger_all_cpu_backtrace(void) | 31 | void arch_trigger_all_cpu_backtrace(void) |
| 30 | { | 32 | { |
| 31 | int i; | 33 | int i; |
| @@ -95,8 +97,6 @@ early_initcall(register_trigger_all_cpu_backtrace); | |||
| 95 | #if defined(CONFIG_X86_LOCAL_APIC) | 97 | #if defined(CONFIG_X86_LOCAL_APIC) |
| 96 | unsigned int nmi_watchdog = NMI_NONE; | 98 | unsigned int nmi_watchdog = NMI_NONE; |
| 97 | EXPORT_SYMBOL(nmi_watchdog); | 99 | EXPORT_SYMBOL(nmi_watchdog); |
| 98 | void acpi_nmi_enable(void) { return; } | ||
| 99 | void acpi_nmi_disable(void) { return; } | ||
| 100 | #endif | 100 | #endif |
| 101 | atomic_t nmi_active = ATOMIC_INIT(0); /* oprofile uses this */ | 101 | atomic_t nmi_active = ATOMIC_INIT(0); /* oprofile uses this */ |
| 102 | EXPORT_SYMBOL(nmi_active); | 102 | EXPORT_SYMBOL(nmi_active); |
diff --git a/arch/x86/kernel/apic/nmi.c b/arch/x86/kernel/apic/nmi.c deleted file mode 100644 index c90041ccb742..000000000000 --- a/arch/x86/kernel/apic/nmi.c +++ /dev/null | |||
| @@ -1,567 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * NMI watchdog support on APIC systems | ||
| 3 | * | ||
| 4 | * Started by Ingo Molnar <mingo@redhat.com> | ||
| 5 | * | ||
| 6 | * Fixes: | ||
| 7 | * Mikael Pettersson : AMD K7 support for local APIC NMI watchdog. | ||
| 8 | * Mikael Pettersson : Power Management for local APIC NMI watchdog. | ||
| 9 | * Mikael Pettersson : Pentium 4 support for local APIC NMI watchdog. | ||
| 10 | * Pavel Machek and | ||
| 11 | * Mikael Pettersson : PM converted to driver model. Disable/enable API. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include <asm/apic.h> | ||
| 15 | |||
| 16 | #include <linux/nmi.h> | ||
| 17 | #include <linux/mm.h> | ||
| 18 | #include <linux/delay.h> | ||
| 19 | #include <linux/interrupt.h> | ||
| 20 | #include <linux/module.h> | ||
| 21 | #include <linux/slab.h> | ||
| 22 | #include <linux/sysdev.h> | ||
| 23 | #include <linux/sysctl.h> | ||
| 24 | #include <linux/percpu.h> | ||
| 25 | #include <linux/kprobes.h> | ||
| 26 | #include <linux/cpumask.h> | ||
| 27 | #include <linux/kernel_stat.h> | ||
| 28 | #include <linux/kdebug.h> | ||
| 29 | #include <linux/smp.h> | ||
| 30 | |||
| 31 | #include <asm/i8259.h> | ||
| 32 | #include <asm/io_apic.h> | ||
| 33 | #include <asm/proto.h> | ||
| 34 | #include <asm/timer.h> | ||
| 35 | |||
| 36 | #include <asm/mce.h> | ||
| 37 | |||
| 38 | #include <asm/mach_traps.h> | ||
| 39 | |||
| 40 | int unknown_nmi_panic; | ||
| 41 | int nmi_watchdog_enabled; | ||
| 42 | |||
| 43 | /* For reliability, we're prepared to waste bits here. */ | ||
| 44 | static DECLARE_BITMAP(backtrace_mask, NR_CPUS) __read_mostly; | ||
| 45 | |||
| 46 | /* nmi_active: | ||
| 47 | * >0: the lapic NMI watchdog is active, but can be disabled | ||
| 48 | * <0: the lapic NMI watchdog has not been set up, and cannot | ||
| 49 | * be enabled | ||
| 50 | * 0: the lapic NMI watchdog is disabled, but can be enabled | ||
| 51 | */ | ||
| 52 | atomic_t nmi_active = ATOMIC_INIT(0); /* oprofile uses this */ | ||
| 53 | EXPORT_SYMBOL(nmi_active); | ||
| 54 | |||
| 55 | unsigned int nmi_watchdog = NMI_NONE; | ||
| 56 | EXPORT_SYMBOL(nmi_watchdog); | ||
| 57 | |||
| 58 | static int panic_on_timeout; | ||
| 59 | |||
| 60 | static unsigned int nmi_hz = HZ; | ||
| 61 | static DEFINE_PER_CPU(short, wd_enabled); | ||
| 62 | static int endflag __initdata; | ||
| 63 | |||
| 64 | static inline unsigned int get_nmi_count(int cpu) | ||
| 65 | { | ||
| 66 | return per_cpu(irq_stat, cpu).__nmi_count; | ||
| 67 | } | ||
| 68 | |||
| 69 | static inline int mce_in_progress(void) | ||
| 70 | { | ||
| 71 | #if defined(CONFIG_X86_MCE) | ||
| 72 | return atomic_read(&mce_entry) > 0; | ||
| 73 | #endif | ||
| 74 | return 0; | ||
| 75 | } | ||
| 76 | |||
| 77 | /* | ||
| 78 | * Take the local apic timer and PIT/HPET into account. We don't | ||
| 79 | * know which one is active, when we have highres/dyntick on | ||
| 80 | */ | ||
| 81 | static inline unsigned int get_timer_irqs(int cpu) | ||
| 82 | { | ||
| 83 | return per_cpu(irq_stat, cpu).apic_timer_irqs + | ||
| 84 | per_cpu(irq_stat, cpu).irq0_irqs; | ||
| 85 | } | ||
| 86 | |||
| 87 | #ifdef CONFIG_SMP | ||
| 88 | /* | ||
| 89 | * The performance counters used by NMI_LOCAL_APIC don't trigger when | ||
| 90 | * the CPU is idle. To make sure the NMI watchdog really ticks on all | ||
| 91 | * CPUs during the test make them busy. | ||
| 92 | */ | ||
| 93 | static __init void nmi_cpu_busy(void *data) | ||
| 94 | { | ||
| 95 | local_irq_enable_in_hardirq(); | ||
| 96 | /* | ||
| 97 | * Intentionally don't use cpu_relax here. This is | ||
| 98 | * to make sure that the performance counter really ticks, | ||
| 99 | * even if there is a simulator or similar that catches the | ||
| 100 | * pause instruction. On a real HT machine this is fine because | ||
| 101 | * all other CPUs are busy with "useless" delay loops and don't | ||
| 102 | * care if they get somewhat less cycles. | ||
| 103 | */ | ||
| 104 | while (endflag == 0) | ||
| 105 | mb(); | ||
| 106 | } | ||
| 107 | #endif | ||
| 108 | |||
| 109 | static void report_broken_nmi(int cpu, unsigned int *prev_nmi_count) | ||
| 110 | { | ||
