All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anithra P Janakiraman <anithra@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: dave@linux.vnet.ibm.com, xiyou.wangcong@gmail.com,
	sugaken.r3@gmail.com, alan@lxorguk.ukuu.org.uk,
	srikar@linux.vnet.ibm.com, suzuki@in.ibm.com,
	vatsa@linux.vnet.ibm.com, ananth@in.ibm.com
Subject: [PATCH v2] Softdog enhancement to optionally invoke panic instead of reboot on timer expiry
Date: Tue, 25 Jan 2011 00:03:52 +0530	[thread overview]
Message-ID: <20110125000352.0be09450@linux.vnet.ibm.com> (raw)


Hi,

We currently have no way of determining the reason for failure when a
softdog timeout occurs. We use softdog to watch for critical application
failures, and at the minimum a snapshot of the system would help to
determine the cause. In such a scenario the application could fail but
there isn't a softlockup as such, hence the detect softlockup feature
does not help.
The patch below adds a module parameter soft_panic which when set to
1 causes softdog to invoke panic instead of reboot when the softdog
timer expires. By invoking panic we execute kdump if it is configured
and the vmcore generated by kdump should provide atleast a minimal idea
of the reason for failure.

Based on an original patch by Ken Sugawara <sugaken.r3@gmail.com>
Signed-off-by: Anithra P J <anithra@linux.vnet.ibm.com>
---
 drivers/watchdog/softdog.c |   18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

Index: linux-2.6.38-rc1/drivers/watchdog/softdog.c
===================================================================
--- linux-2.6.38-rc1.orig/drivers/watchdog/softdog.c
+++ linux-2.6.38-rc1/drivers/watchdog/softdog.c
@@ -48,6 +48,7 @@
 #include <linux/init.h>
 #include <linux/jiffies.h>
 #include <linux/uaccess.h>
+#include <linux/kernel.h>
 
 #define PFX "SoftDog: "
 
@@ -75,6 +76,13 @@
 	"Softdog action, set to 1 to ignore reboots, 0 to reboot "
 					"(default depends on ONLY_TESTING)");
 
+
+static int soft_panic;
+
+module_param(soft_panic, int, 0);
+MODULE_PARM_DESC(soft_panic,
+	"Softdog action, set to 1 to panic, 0 to reboot (default 0)");
+
 /*
  *	Our timer
  */
@@ -98,7 +106,10 @@
 
 	if (soft_noboot)
 		printk(KERN_CRIT PFX "Triggered - Reboot ignored.\n");
-	else {
+	else if (soft_panic) {
+		printk(KERN_CRIT PFX "Initiating panic.\n");
+		panic("Software Watchdog Timer expired.");
+	} else {
 		printk(KERN_CRIT PFX "Initiating system reboot.\n");
 		emergency_restart();
 		printk(KERN_CRIT PFX "Reboot didn't ?????\n");
@@ -267,7 +278,8 @@
 };
 
 static char banner[] __initdata = KERN_INFO "Software Watchdog Timer: 0.07 "
-	"initialized. soft_noboot=%d soft_margin=%d sec (nowayout= %d)\n";
+	"initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d "
+	"(nowayout= %d)\n";
 
 static int __init watchdog_init(void)
 {
@@ -298,7 +310,7 @@
 		return ret;
 	}
 
-	printk(banner, soft_noboot, soft_margin, nowayout);
+	printk(banner, soft_noboot, soft_margin, soft_panic, nowayout);
 
 	return 0;
 }




             reply	other threads:[~2011-01-24 18:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24 18:33 Anithra P Janakiraman [this message]
2011-01-25  3:24 ` [PATCH v2] Softdog enhancement to optionally invoke panic instead of reboot on timer expiry Américo Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110125000352.0be09450@linux.vnet.ibm.com \
    --to=anithra@linux.vnet.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=ananth@in.ibm.com \
    --cc=dave@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=sugaken.r3@gmail.com \
    --cc=suzuki@in.ibm.com \
    --cc=vatsa@linux.vnet.ibm.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.