Commit baf48f6577e581a9adb8fe849dc80e24b21d171d
Committed by
Ingo Molnar
1 parent
e4fa4c9701
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>
Showing 3 changed files with 13 additions and 1 deletions Side-by-side Diff
include/linux/sched.h
... | ... | @@ -293,6 +293,9 @@ |
293 | 293 | extern void softlockup_tick(void); |
294 | 294 | extern void touch_softlockup_watchdog(void); |
295 | 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 | 299 | extern unsigned int softlockup_panic; |
297 | 300 | extern unsigned long sysctl_hung_task_check_count; |
298 | 301 | extern unsigned long sysctl_hung_task_timeout_secs; |
kernel/softlockup.c
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | #include <linux/lockdep.h> |
17 | 17 | #include <linux/notifier.h> |
18 | 18 | #include <linux/module.h> |
19 | +#include <linux/sysctl.h> | |
19 | 20 | |
20 | 21 | #include <asm/irq_regs.h> |
21 | 22 | |
... | ... | @@ -87,6 +88,14 @@ |
87 | 88 | per_cpu(touch_timestamp, cpu) = 0; |
88 | 89 | } |
89 | 90 | EXPORT_SYMBOL(touch_all_softlockup_watchdogs); |
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 | +} | |
90 | 99 | |
91 | 100 | /* |
92 | 101 | * This callback runs from the timer interrupt, and checks |
kernel/sysctl.c
... | ... | @@ -800,7 +800,7 @@ |
800 | 800 | .data = &softlockup_thresh, |
801 | 801 | .maxlen = sizeof(int), |
802 | 802 | .mode = 0644, |
803 | - .proc_handler = &proc_dointvec_minmax, | |
803 | + .proc_handler = &proc_dosoftlockup_thresh, | |
804 | 804 | .strategy = &sysctl_intvec, |
805 | 805 | .extra1 = &neg_one, |
806 | 806 | .extra2 = &sixty, |