diff options
author | Don Zickus <dzickus@redhat.com> | 2011-03-22 19:34:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-22 20:44:12 -0400 |
commit | fef2c9bc1b54c0261324a96e948c0b849796e896 (patch) | |
tree | a4dd2733621d9fe1f8ec65d9ef30867ed09b640f | |
parent | b1b5f65e53af770ede22c113e249de2f6fa53706 (diff) |
kernel/watchdog.c: allow hardlockup to panic by default
When a cpu is considered stuck, instead of limping along and just printing
a warning, it is sometimes preferred to just panic, let kdump capture the
vmcore and reboot. This gets the machine back into a stable state quickly
while saving the info that got it into a stuck state to begin with.
Add a Kconfig option to allow users to set the hardlockup to panic
by default. Also add in a 'nmi_watchdog=nopanic' to override this.
[akpm@linux-foundation.org: fix strncmp length]
Signed-off-by: Don Zickus <dzickus@redhat.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | Documentation/kernel-parameters.txt | 5 | ||||
-rw-r--r-- | kernel/watchdog.c | 5 | ||||
-rw-r--r-- | lib/Kconfig.debug | 17 |
3 files changed, 24 insertions, 3 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index a3b688287a8d..e9261e938f6a 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -1597,11 +1597,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
1597 | Format: [state][,regs][,debounce][,die] | 1597 | Format: [state][,regs][,debounce][,die] |
1598 | 1598 | ||
1599 | nmi_watchdog= [KNL,BUGS=X86] Debugging features for SMP kernels | 1599 | nmi_watchdog= [KNL,BUGS=X86] Debugging features for SMP kernels |
1600 | Format: [panic,][num] | 1600 | Format: [panic,][nopanic,][num] |
1601 | Valid num: 0 | 1601 | Valid num: 0 |
1602 | 0 - turn nmi_watchdog off | 1602 | 0 - turn nmi_watchdog off |
1603 | When panic is specified, panic when an NMI watchdog | 1603 | When panic is specified, panic when an NMI watchdog |
1604 | timeout occurs. | 1604 | timeout occurs (or 'nopanic' to override the opposite |
1605 | default). | ||
1605 | This is useful when you use a panic=... timeout and | 1606 | This is useful when you use a panic=... timeout and |
1606 | need the box quickly up again. | 1607 | need the box quickly up again. |
1607 | 1608 | ||
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 18bb15776c57..054a67cca9da 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
@@ -48,12 +48,15 @@ static DEFINE_PER_CPU(struct perf_event *, watchdog_ev); | |||
48 | * Should we panic when a soft-lockup or hard-lockup occurs: | 48 | * Should we panic when a soft-lockup or hard-lockup occurs: |
49 | */ | 49 | */ |
50 | #ifdef CONFIG_HARDLOCKUP_DETECTOR | 50 | #ifdef CONFIG_HARDLOCKUP_DETECTOR |
51 | static int hardlockup_panic; | 51 | static int hardlockup_panic = |
52 | CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE; | ||
52 | 53 | ||
53 | static int __init hardlockup_panic_setup(char *str) | 54 | static int __init hardlockup_panic_setup(char *str) |
54 | { | 55 | { |
55 | if (!strncmp(str, "panic", 5)) | 56 | if (!strncmp(str, "panic", 5)) |
56 | hardlockup_panic = 1; | 57 | hardlockup_panic = 1; |
58 | else if (!strncmp(str, "nopanic", 7)) | ||
59 | hardlockup_panic = 0; | ||
57 | else if (!strncmp(str, "0", 1)) | 60 | else if (!strncmp(str, "0", 1)) |
58 | watchdog_enabled = 0; | 61 | watchdog_enabled = 0; |
59 | return 1; | 62 | return 1; |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 191c5c4c89fc..fb0afeff9436 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -171,6 +171,23 @@ config HARDLOCKUP_DETECTOR | |||
171 | def_bool LOCKUP_DETECTOR && PERF_EVENTS && HAVE_PERF_EVENTS_NMI && \ | 171 | def_bool LOCKUP_DETECTOR && PERF_EVENTS && HAVE_PERF_EVENTS_NMI && \ |
172 | !ARCH_HAS_NMI_WATCHDOG | 172 | !ARCH_HAS_NMI_WATCHDOG |
173 | 173 | ||
174 | config BOOTPARAM_HARDLOCKUP_PANIC | ||
175 | bool "Panic (Reboot) On Hard Lockups" | ||
176 | depends on LOCKUP_DETECTOR | ||
177 | help | ||
178 | Say Y here to enable the kernel to panic on "hard lockups", | ||
179 | which are bugs that cause the kernel to loop in kernel | ||
180 | mode with interrupts disabled for more than 60 seconds. | ||
181 | |||
182 | Say N if unsure. | ||
183 | |||
184 | config BOOTPARAM_HARDLOCKUP_PANIC_VALUE | ||
185 | int | ||
186 | depends on LOCKUP_DETECTOR | ||
187 | range 0 1 | ||
188 | default 0 if !BOOTPARAM_HARDLOCKUP_PANIC | ||
189 | default 1 if BOOTPARAM_HARDLOCKUP_PANIC | ||
190 | |||
174 | config BOOTPARAM_SOFTLOCKUP_PANIC | 191 | config BOOTPARAM_SOFTLOCKUP_PANIC |
175 | bool "Panic (Reboot) On Soft Lockups" | 192 | bool "Panic (Reboot) On Soft Lockups" |
176 | depends on LOCKUP_DETECTOR | 193 | depends on LOCKUP_DETECTOR |