aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-05-12 15:21:04 -0400
committerThomas Gleixner <tglx@linutronix.de>2008-05-25 00:34:44 -0400
commit9c44bc03fff44ff04237a7d92e35304a0e50c331 (patch)
tree64704ff78933a3a3bd8549801308d0557c02980d /kernel
parent75d3bce2fc0a80f435fe12f2c9ed2632c8ac29e4 (diff)
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. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/softlockup.c21
-rw-r--r--kernel/sysctl.c11
2 files changed, 32 insertions, 0 deletions
diff --git a/kernel/softlockup.c b/kernel/softlockup.c
index 01b6522fd92b..78e0ad21cb0c 100644
--- a/kernel/softlockup.c
+++ b/kernel/softlockup.c
@@ -27,6 +27,21 @@ static DEFINE_PER_CPU(struct task_struct *, watchdog_task);
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 int 45static 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)
120 else 135 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)
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/*
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 29116652dca8..2d3b388c402d 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -729,6 +729,17 @@ static struct ctl_table kern_table[] = {
729#ifdef CONFIG_DETECT_SOFTLOCKUP 729#ifdef CONFIG_DETECT_SOFTLOCKUP
730 { 730 {
731 .ctl_name = CTL_UNNUMBERED, 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 },
741 {
742 .ctl_name = CTL_UNNUMBERED,
732 .procname = "softlockup_thresh", 743 .procname = "softlockup_thresh",
733 .data = &softlockup_thresh, 744 .data = &softlockup_thresh,
734 .maxlen = sizeof(unsigned long), 745 .maxlen = sizeof(unsigned long),