diff options
author | Mandeep Singh Baines <msb@google.com> | 2009-01-13 00:15:17 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-14 05:48:07 -0500 |
commit | baf48f6577e581a9adb8fe849dc80e24b21d171d (patch) | |
tree | 279e54b7374a9c52025ded4f9bb718e5382b0340 | |
parent | e4fa4c97016037620f9dc8bafe03e1086b665b4c (diff) |
softlock: fix false panic which can occur if softlockup_thresh is reduced
At run-time, if softlockup_thresh is changed to a much lower value,
touch_timestamp is likely to be much older than the new softlock_thresh.
This will cause a false softlockup to be detected. If softlockup_panic
is enabled, the system will panic.
The fix is to touch all watchdogs before changing softlockup_thresh.
Signed-off-by: Mandeep Singh Baines <msb@google.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/linux/sched.h | 3 | ||||
-rw-r--r-- | kernel/softlockup.c | 9 | ||||
-rw-r--r-- | kernel/sysctl.c | 2 |
3 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 4cae9b81a1f8..54cbabf3b871 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -293,6 +293,9 @@ extern void sched_show_task(struct task_struct *p); | |||
293 | extern void softlockup_tick(void); | 293 | extern void softlockup_tick(void); |
294 | extern void touch_softlockup_watchdog(void); | 294 | extern void touch_softlockup_watchdog(void); |
295 | extern void touch_all_softlockup_watchdogs(void); | 295 | extern void touch_all_softlockup_watchdogs(void); |
296 | extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write, | ||
297 | struct file *filp, void __user *buffer, | ||
298 | size_t *lenp, loff_t *ppos); | ||
296 | extern unsigned int softlockup_panic; | 299 | extern unsigned int softlockup_panic; |
297 | extern unsigned long sysctl_hung_task_check_count; | 300 | extern unsigned long sysctl_hung_task_check_count; |
298 | extern unsigned long sysctl_hung_task_timeout_secs; | 301 | extern unsigned long sysctl_hung_task_timeout_secs; |
diff --git a/kernel/softlockup.c b/kernel/softlockup.c index d9188c66278a..85d5a2455103 100644 --- a/kernel/softlockup.c +++ b/kernel/softlockup.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/lockdep.h> | 16 | #include <linux/lockdep.h> |
17 | #include <linux/notifier.h> | 17 | #include <linux/notifier.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/sysctl.h> | ||
19 | 20 | ||
20 | #include <asm/irq_regs.h> | 21 | #include <asm/irq_regs.h> |
21 | 22 | ||
@@ -88,6 +89,14 @@ void touch_all_softlockup_watchdogs(void) | |||
88 | } | 89 | } |
89 | EXPORT_SYMBOL(touch_all_softlockup_watchdogs); | 90 | EXPORT_SYMBOL(touch_all_softlockup_watchdogs); |
90 | 91 | ||
92 | int proc_dosoftlockup_thresh(struct ctl_table *table, int write, | ||
93 | struct file *filp, void __user *buffer, | ||
94 | size_t *lenp, loff_t *ppos) | ||
95 | { | ||
96 | touch_all_softlockup_watchdogs(); | ||
97 | return proc_dointvec_minmax(table, write, filp, buffer, lenp, ppos); | ||
98 | } | ||
99 | |||
91 | /* | 100 | /* |
92 | * This callback runs from the timer interrupt, and checks | 101 | * This callback runs from the timer interrupt, and checks |
93 | * whether the watchdog thread has hung or not: | 102 | * whether the watchdog thread has hung or not: |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 89d74436318c..596dc31a7116 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -800,7 +800,7 @@ static struct ctl_table kern_table[] = { | |||
800 | .data = &softlockup_thresh, | 800 | .data = &softlockup_thresh, |
801 | .maxlen = sizeof(int), | 801 | .maxlen = sizeof(int), |
802 | .mode = 0644, | 802 | .mode = 0644, |
803 | .proc_handler = &proc_dointvec_minmax, | 803 | .proc_handler = &proc_dosoftlockup_thresh, |
804 | .strategy = &sysctl_intvec, | 804 | .strategy = &sysctl_intvec, |
805 | .extra1 = &neg_one, | 805 | .extra1 = &neg_one, |
806 | .extra2 = &sixty, | 806 | .extra2 = &sixty, |