Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 2056

kernel-2.6.18-238.el5.src.rpm

From: Prarit Bhargava <prarit@redhat.com>
Date: Tue, 13 May 2008 13:43:23 -0400
Subject: [misc] optional panic on softlockup warnings
Message-id: 20080513174307.15786.2932.sendpatchset@prarit.bos.redhat.com
O-Subject: [RHEL5 PATCH]: Optional panic on softlockup warnings
Bugzilla: 445422
RH-Acked-by: Aristeu Rozanski <arozansk@redhat.com>
RH-Acked-by: Alan Cox <alan@redhat.com>
RH-Acked-by: Rik van Riel <riel@redhat.com>
RH-Acked-by: Larry Woodman <lwoodman@redhat.com>

Backport of Ingo's panic on softlockups patch, available here:

http://people.redhat.com/mingo/softlockup-patches/softlockup-allow-panic-on-lockup.patch

I didn't backport the CONFIG option in Ingo's patch -- I don't feel it is
necessary to include it in RHEL (in fact, I'm not so sure it's needed
upstream).

Default behaviour is disabled.

Successfully tested by me.

Resolves BZ 445422.

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index bd4e2a9..234faba 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1628,6 +1628,9 @@ running once the system is up.
 	sonycd535=	[HW,CD]
 			Format: <io>[,<irq>]
 
+	softlockup_panic=
+			[KNL] Should the soft-lockup detector generate panics.
+
 	sonypi.*=	[HW] Sony Programmable I/O Control Device driver
 			See Documentation/sonypi.txt
 
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 1d451e0..f89986c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -221,7 +221,8 @@ extern void softlockup_tick(struct pt_regs *regs);
 extern void spawn_softlockup_task(void);
 extern void touch_softlockup_watchdog(void);
 extern void touch_all_softlockup_watchdogs(void);
-extern int softlockup_thresh;
+extern unsigned int  softlockup_panic;
+extern unsigned long softlockup_thresh;
 #else
 static inline unsigned long softlockup_get_next_event(void)
 {
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 463aca2..0b6258f 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -159,6 +159,7 @@ enum
 	KERN_LOCK_STAT=78,	/* int: enable lock statistics */
 	KERN_PROVE_LOCKING=79,	/* int: enable lock dependancy validation */
 	KERN_SOFTLOCKUP_THRESH=80, /* int: min time to report softlockups */
+	KERN_SOFTLOCKUP_PANIC=81, /* int: panic on softlockup */
 };
 
 
diff --git a/kernel/softlockup.c b/kernel/softlockup.c
index c9aad28..b942e11 100644
--- a/kernel/softlockup.c
+++ b/kernel/softlockup.c
@@ -22,7 +22,21 @@ static DEFINE_PER_CPU(unsigned long, print_timestamp);
 static DEFINE_PER_CPU(struct task_struct *, watchdog_task);
 
 static int did_panic = 0;
-int softlockup_thresh = 10;
+unsigned long softlockup_thresh = 10;
+
+/*
+ * Should we panic (and reboot, if panic_timeout= is set) when a
+ * soft-lockup occurs:
+ */
+unsigned int __read_mostly softlockup_panic = 0;
+
+static int __init softlockup_panic_setup(char *str)
+{
+	softlockup_panic = simple_strtoul(str, NULL, 0);
+
+	return 1;
+}
+__setup("softlockup_panic=", softlockup_panic_setup);
 
 static int
 softlock_panic(struct notifier_block *this, unsigned long event, void *ptr)
@@ -111,6 +125,8 @@ void softlockup_tick(struct pt_regs *regs)
 		dump_stack();
 	spin_unlock(&print_lock);
 
+	if (softlockup_panic)
+		panic("softlockup: hung tasks");
 }
 
 /*
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 7a5ac51..0913b72 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -809,6 +809,16 @@ static ctl_table kern_table[] = {
 		.extra1		= &one,
 		.extra2		= &sixty,
 	},
+	{
+		.ctl_name	= KERN_SOFTLOCKUP_PANIC,
+		.procname	= "softlockup_panic",
+		.data		= &softlockup_panic,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+		.extra1		= &zero,
+		.extra2		= &one,
+	},
 #endif
 #ifdef CONFIG_COMPAT
 	{