diff options
-rw-r--r-- | arch/x86/kernel/apic/Makefile | 7 | ||||
-rw-r--r-- | arch/x86/kernel/traps.c | 2 | ||||
-rw-r--r-- | include/linux/nmi.h | 4 | ||||
-rw-r--r-- | kernel/Makefile | 1 | ||||
-rw-r--r-- | lib/Kconfig.debug | 13 |
5 files changed, 26 insertions, 1 deletions
diff --git a/arch/x86/kernel/apic/Makefile b/arch/x86/kernel/apic/Makefile index 565c1bfc507d..1a4512e48d24 100644 --- a/arch/x86/kernel/apic/Makefile +++ b/arch/x86/kernel/apic/Makefile | |||
@@ -2,7 +2,12 @@ | |||
2 | # Makefile for local APIC drivers and for the IO-APIC code | 2 | # Makefile for local APIC drivers and for the IO-APIC code |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-$(CONFIG_X86_LOCAL_APIC) += apic.o apic_noop.o probe_$(BITS).o ipi.o nmi.o | 5 | obj-$(CONFIG_X86_LOCAL_APIC) += apic.o apic_noop.o probe_$(BITS).o ipi.o |
6 | ifneq ($(CONFIG_NMI_WATCHDOG),y) | ||
7 | obj-$(CONFIG_X86_LOCAL_APIC) += nmi.o | ||
8 | endif | ||
9 | obj-$(CONFIG_NMI_WATCHDOG) += hw_nmi.o | ||
10 | |||
6 | obj-$(CONFIG_X86_IO_APIC) += io_apic.o | 11 | obj-$(CONFIG_X86_IO_APIC) += io_apic.o |
7 | obj-$(CONFIG_SMP) += ipi.o | 12 | obj-$(CONFIG_SMP) += ipi.o |
8 | 13 | ||
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 51ef893ffa65..973cbc4f044f 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -406,6 +406,7 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs) | |||
406 | == NOTIFY_STOP) | 406 | == NOTIFY_STOP) |
407 | return; | 407 | return; |
408 | 408 | ||
409 | #ifndef CONFIG_NMI_WATCHDOG | ||
409 | /* | 410 | /* |
410 | * Ok, so this is none of the documented NMI sources, | 411 | * Ok, so this is none of the documented NMI sources, |
411 | * so it must be the NMI watchdog. | 412 | * so it must be the NMI watchdog. |
@@ -413,6 +414,7 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs) | |||
413 | if (nmi_watchdog_tick(regs, reason)) | 414 | if (nmi_watchdog_tick(regs, reason)) |
414 | return; | 415 | return; |
415 | if (!do_nmi_callback(regs, cpu)) | 416 | if (!do_nmi_callback(regs, cpu)) |
417 | #endif /* !CONFIG_NMI_WATCHDOG */ | ||
416 | unknown_nmi_error(reason, regs); | 418 | unknown_nmi_error(reason, regs); |
417 | #else | 419 | #else |
418 | unknown_nmi_error(reason, regs); | 420 | unknown_nmi_error(reason, regs); |
diff --git a/include/linux/nmi.h b/include/linux/nmi.h index b752e807adde..a42ff0bef708 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h | |||
@@ -47,4 +47,8 @@ static inline bool trigger_all_cpu_backtrace(void) | |||
47 | } | 47 | } |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #ifdef CONFIG_NMI_WATCHDOG | ||
51 | int hw_nmi_is_cpu_stuck(struct pt_regs *); | ||
52 | #endif | ||
53 | |||
50 | #endif | 54 | #endif |
diff --git a/kernel/Makefile b/kernel/Makefile index 864ff75d65f2..8a5abe53ebad 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
@@ -76,6 +76,7 @@ obj-$(CONFIG_AUDIT_TREE) += audit_tree.o | |||
76 | obj-$(CONFIG_KPROBES) += kprobes.o | 76 | obj-$(CONFIG_KPROBES) += kprobes.o |
77 | obj-$(CONFIG_KGDB) += kgdb.o | 77 | obj-$(CONFIG_KGDB) += kgdb.o |
78 | obj-$(CONFIG_DETECT_SOFTLOCKUP) += softlockup.o | 78 | obj-$(CONFIG_DETECT_SOFTLOCKUP) += softlockup.o |
79 | obj-$(CONFIG_NMI_WATCHDOG) += nmi_watchdog.o | ||
79 | obj-$(CONFIG_DETECT_HUNG_TASK) += hung_task.o | 80 | obj-$(CONFIG_DETECT_HUNG_TASK) += hung_task.o |
80 | obj-$(CONFIG_GENERIC_HARDIRQS) += irq/ | 81 | obj-$(CONFIG_GENERIC_HARDIRQS) += irq/ |
81 | obj-$(CONFIG_SECCOMP) += seccomp.o | 82 | obj-$(CONFIG_SECCOMP) += seccomp.o |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 25c3ed594c54..f80b67e72aa0 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -170,6 +170,19 @@ config DETECT_SOFTLOCKUP | |||
170 | can be detected via the NMI-watchdog, on platforms that | 170 | can be detected via the NMI-watchdog, on platforms that |
171 | support it.) | 171 | support it.) |
172 | 172 | ||
173 | config NMI_WATCHDOG | ||
174 | bool "Detect Hard Lockups with an NMI Watchdog" | ||
175 | depends on DEBUG_KERNEL && PERF_EVENTS | ||
176 | default y | ||
177 | help | ||
178 | Say Y here to enable the kernel to use the NMI as a watchdog | ||
179 | to detect hard lockups. This is useful when a cpu hangs for no | ||
180 | reason but can still respond to NMIs. A backtrace is displayed | ||
181 | for reviewing and reporting. | ||
182 | |||
183 | The overhead should be minimal, just an extra NMI every few | ||
184 | seconds. | ||
185 | |||
173 | config BOOTPARAM_SOFTLOCKUP_PANIC | 186 | config BOOTPARAM_SOFTLOCKUP_PANIC |
174 | bool "Panic (Reboot) On Soft Lockups" | 187 | bool "Panic (Reboot) On Soft Lockups" |
175 | depends on DETECT_SOFTLOCKUP | 188 | depends on DETECT_SOFTLOCKUP |