Skip to contentSkip to conversation

softlock: fix false panic which can occur if softlockup_thresh is reduced

PATCH Applied Mandeep Singh Baines 2 participants 2 messages Jan 13, 2009 – Jan 14, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 include/linux/sched.h |    3 +++
 kernel/softlockup.c   |    9 +++++++++
 kernel/sysctl.c       |    2 +-
 3 files changed, 13 insertions(+), 1 deletions(-)
include/linux/sched.h +3 -0
index 55e30d1..cd4a9f6 100644
@@ -295,6 +295,9 @@ extern void sched_show_task(struct task_struct *p);
 extern void softlockup_tick(void);
 extern void touch_softlockup_watchdog(void);
 extern void touch_all_softlockup_watchdogs(void);
+extern int proc_dosoftlockup_thresh(struct ctl_table *table, int write,
+				    struct file *filp, void __user *buffer,
+				    size_t *lenp, loff_t *ppos);
 extern unsigned int  softlockup_panic;
 extern unsigned long sysctl_hung_task_check_count;
 extern unsigned long sysctl_hung_task_timeout_secs;
kernel/softlockup.c +9 -0
index dc0b3be..2d850e1 100644
@@ -16,6 +16,7 @@
 #include <linux/lockdep.h>
 #include <linux/notifier.h>
 #include <linux/module.h>
+#include <linux/sysctl.h>
 
 #include <asm/irq_regs.h>
 
@@ -88,6 +89,14 @@ void touch_all_softlockup_watchdogs(void)
 }
 EXPORT_SYMBOL(touch_all_softlockup_watchdogs);
 
+int proc_dosoftlockup_thresh(struct ctl_table *table, int write,
+			     struct file *filp, void __user *buffer,
+			     size_t *lenp, loff_t *ppos)
+{
+	touch_all_softlockup_watchdogs();
+	return proc_dointvec_minmax(table, write, filp, buffer, lenp, ppos);
+}
+
 /*
  * This callback runs from the timer interrupt, and checks
  * whether the watchdog thread has hung or not:
kernel/sysctl.c +1 -1
index 3d56fe7..a3d5828 100644
@@ -766,7 +766,7 @@ static struct ctl_table kern_table[] = {
 		.data		= &softlockup_thresh,
 		.maxlen		= sizeof(int),
 		.mode		= 0644,
-		.proc_handler	= &proc_dointvec_minmax,
+		.proc_handler	= &proc_dosoftlockup_thresh,
 		.strategy	= &sysctl_intvec,
 		.extra1		= &neg_one,
 		.extra2		= &sixty,
Signature · 1 line
1.5.4.5
Applied
#1 lore raw
Quoted 6 lines · Mandeep Singh Baines

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.

Quoted 8 lines

The fix is to touch all watchdogs before changing softlockup_thresh.

---
 include/linux/sched.h |    3 +++
 kernel/softlockup.c   |    9 +++++++++
 kernel/sysctl.c       |    2 +-
 3 files changed, 13 insertions(+), 1 deletions(-)

applied to tip/core/urgent, thanks!

Ingo