History

softlockup: allow panic on lockup

allow users to configure the softlockup detector to generate a panic instead of a warning message. high-availability systems might opt for this strict method (combined with panic_timeout= boot option/sysctl), instead of generating softlockup warnings ad infinitum. also, automated tests work better if the system reboots reliably (into a safe kernel) in case of a lockup. The full spectrum of configurability is supported: boot option, sysctl option and Kconfig option. it's default-disabled.

Ingo Molnar committed 18 years ago

Commit 9c44bc01 parent 75d3bce5 files · +62 −2Browse files

Unified · Split

5 files
  1. Documentation/kernel-parameters.txt +3 −0
  2. include/linux/sched.h +2 −1
  3. kernel/softlockup.c +21 −0
  4. kernel/sysctl.c +11 −0
  5. lib/Kconfig.debug +25 −1
Documentation/kernel-parameters.txt+3−0
@@ -1971,6 +1971,9 @@ and is between 256 and 4096 characters. It is defined in the file · 1970 unmodified lines
1971 1971
1972 snd-ymfpci= [HW,ALSA]1972 snd-ymfpci= [HW,ALSA]
1973 1973
1974 softlockup_panic=
1975 [KNL] Should the soft-lockup detector generate panics.
1976
1974 sonypi.*= [HW] Sony Programmable I/O Control Device driver1977 sonypi.*= [HW] Sony Programmable I/O Control Device driver
1975 See Documentation/sonypi.txt1978 See Documentation/sonypi.txt
1976 1979
include/linux/sched.h+2−1
@@ -294,7 +294,8 @@ extern void softlockup_tick(void); · 293 unmodified lines
294extern void spawn_softlockup_task(void);294extern void spawn_softlockup_task(void);
295extern void touch_softlockup_watchdog(void);295extern void touch_softlockup_watchdog(void);
296extern void touch_all_softlockup_watchdogs(void);296extern void touch_all_softlockup_watchdogs(void);
297extern unsigned long softlockup_thresh;297extern unsigned int softlockup_panic;
298extern unsigned long softlockup_thresh;
298extern unsigned long sysctl_hung_task_check_count;299extern unsigned long sysctl_hung_task_check_count;
299extern unsigned long sysctl_hung_task_timeout_secs;300extern unsigned long sysctl_hung_task_timeout_secs;
300extern unsigned long sysctl_hung_task_warnings;301extern unsigned long sysctl_hung_task_warnings;
kernel/softlockup.c+21−0
@@ -27,6 +27,21 @@ static DEFINE_PER_CPU(struct task_struct *, watchdog_task); · 26 unmodified lines
27static int __read_mostly did_panic;27static int __read_mostly did_panic;
28unsigned long __read_mostly softlockup_thresh = 60;28unsigned long __read_mostly softlockup_thresh = 60;
29 29
30/*
31 * Should we panic (and reboot, if panic_timeout= is set) when a
32 * soft-lockup occurs:
33 */
34unsigned int __read_mostly softlockup_panic =
35 CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE;
36
37static int __init softlockup_panic_setup(char *str)
38{
39 softlockup_panic = simple_strtoul(str, NULL, 0);
40
41 return 1;
42}
43__setup("softlockup_panic=", softlockup_panic_setup);
44
30static int45static int
31softlock_panic(struct notifier_block *this, unsigned long event, void *ptr)46softlock_panic(struct notifier_block *this, unsigned long event, void *ptr)
32{47{
@@ -120,6 +135,9 @@ void softlockup_tick(void) · 87 unmodified lines
120 else135 else
121 dump_stack();136 dump_stack();
122 spin_unlock(&print_lock);137 spin_unlock(&print_lock);
138
139 if (softlockup_panic)
140 panic("softlockup: hung tasks");
123}141}
124 142
125/*143/*
@@ -172,6 +190,9 @@ static void check_hung_task(struct task_struct *t, unsigned long now) · 46 unmodified lines
172 190
173 t->last_switch_timestamp = now;191 t->last_switch_timestamp = now;
174 touch_nmi_watchdog();192 touch_nmi_watchdog();
193
194 if (softlockup_panic)
195 panic("softlockup: blocked tasks");
175}196}
176 197
177/*198/*
kernel/sysctl.c+11−0
@@ -727,6 +727,17 @@ static struct ctl_table kern_table[] = { · 726 unmodified lines
727 },727 },
728#endif728#endif
729#ifdef CONFIG_DETECT_SOFTLOCKUP729#ifdef CONFIG_DETECT_SOFTLOCKUP
730 {
731 .ctl_name = CTL_UNNUMBERED,
732 .procname = "softlockup_panic",
733 .data = &softlockup_panic,
734 .maxlen = sizeof(int),
735 .mode = 0644,
736 .proc_handler = &proc_doulongvec_minmax,
737 .strategy = &sysctl_intvec,
738 .extra1 = &zero,
739 .extra2 = &one,
740 },
730 {741 {
731 .ctl_name = CTL_UNNUMBERED,742 .ctl_name = CTL_UNNUMBERED,
732 .procname = "softlockup_thresh",743 .procname = "softlockup_thresh",
lib/Kconfig.debug+25−1
@@ -147,7 +147,7 @@ config DETECT_SOFTLOCKUP · 146 unmodified lines
147 help147 help
148 Say Y here to enable the kernel to detect "soft lockups",148 Say Y here to enable the kernel to detect "soft lockups",
149 which are bugs that cause the kernel to loop in kernel149 which are bugs that cause the kernel to loop in kernel
150 mode for more than 10 seconds, without giving other tasks a150 mode for more than 60 seconds, without giving other tasks a
151 chance to run.151 chance to run.
152 152
153 When a soft-lockup is detected, the kernel will print the153 When a soft-lockup is detected, the kernel will print the
@@ -159,6 +159,30 @@ config DETECT_SOFTLOCKUP · 5 unmodified lines
159 can be detected via the NMI-watchdog, on platforms that159 can be detected via the NMI-watchdog, on platforms that
160 support it.)160 support it.)
161 161
162config BOOTPARAM_SOFTLOCKUP_PANIC
163 bool "Panic (Reboot) On Soft Lockups"
164 depends on DETECT_SOFTLOCKUP
165 help
166 Say Y here to enable the kernel to panic on "soft lockups",
167 which are bugs that cause the kernel to loop in kernel
168 mode for more than 60 seconds, without giving other tasks a
169 chance to run.
170
171 The panic can be used in combination with panic_timeout,
172 to cause the system to reboot automatically after a
173 lockup has been detected. This feature is useful for
174 high-availability systems that have uptime guarantees and
175 where a lockup must be resolved ASAP.
176
177 Say N if unsure.
178
179config BOOTPARAM_SOFTLOCKUP_PANIC_VALUE
180 int
181 depends on DETECT_SOFTLOCKUP
182 range 0 1
183 default 0 if !BOOTPARAM_SOFTLOCKUP_PANIC
184 default 1 if BOOTPARAM_SOFTLOCKUP_PANIC
185
162config SCHED_DEBUG186config SCHED_DEBUG
163 bool "Collect scheduler debugging info"187 bool "Collect scheduler debugging info"
164 depends on DEBUG_KERNEL && PROC_FS188 depends on DEBUG_KERNEL && PROC_FS

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t