Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kernel/watchdog.c: add sysctl knob hardlockup_panic

The only way to enable a hardlockup to panic the machine is to set
'nmi_watchdog=panic' on the kernel command line.

This makes it awkward for end users and folks who want to run automate
tests (like myself).

Mimic the softlockup_panic knob and create a /proc/sys/kernel/hardlockup_panic
knob.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Cc: Ulrich Obergfell <uobergfe@redhat.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Reviewed-by: Aaron Tomlin <atomlin@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Don Zickus and committed by
Linus Torvalds
ac1f5912 55537871

+16 -3
+3 -2
Documentation/lockup-watchdogs.txt
··· 20 20 details), without letting other interrupts have a chance to run. 21 21 Similarly to the softlockup case, the current stack trace is displayed 22 22 upon detection and the system will stay locked up unless the default 23 - behavior is changed, which can be done through a compile time knob, 24 - "BOOTPARAM_HARDLOCKUP_PANIC", and a kernel parameter, "nmi_watchdog" 23 + behavior is changed, which can be done through a sysctl, 24 + 'hardlockup_panic', a compile time knob, "BOOTPARAM_HARDLOCKUP_PANIC", 25 + and a kernel parameter, "nmi_watchdog" 25 26 (see "Documentation/kernel-parameters.txt" for details). 26 27 27 28 The panic option can be used in combination with panic_timeout (this
+1
include/linux/sched.h
··· 384 384 void __user *buffer, 385 385 size_t *lenp, loff_t *ppos); 386 386 extern unsigned int softlockup_panic; 387 + extern unsigned int hardlockup_panic; 387 388 void lockup_detector_init(void); 388 389 #else 389 390 static inline void touch_softlockup_watchdog(void)
+11
kernel/sysctl.c
··· 888 888 .extra1 = &zero, 889 889 .extra2 = &one, 890 890 }, 891 + #ifdef CONFIG_HARDLOCKUP_DETECTOR 892 + { 893 + .procname = "hardlockup_panic", 894 + .data = &hardlockup_panic, 895 + .maxlen = sizeof(int), 896 + .mode = 0644, 897 + .proc_handler = proc_dointvec_minmax, 898 + .extra1 = &zero, 899 + .extra2 = &one, 900 + }, 901 + #endif 891 902 #ifdef CONFIG_SMP 892 903 { 893 904 .procname = "softlockup_all_cpu_backtrace",
+1 -1
kernel/watchdog.c
··· 112 112 * Should we panic when a soft-lockup or hard-lockup occurs: 113 113 */ 114 114 #ifdef CONFIG_HARDLOCKUP_DETECTOR 115 - static int hardlockup_panic = 115 + unsigned int __read_mostly hardlockup_panic = 116 116 CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE; 117 117 static unsigned long hardlockup_allcpu_dumped; 118 118 /*