[PATCH 0/0] Panic on softdog timeout

From: Anithra P Janakiraman
Date: Tue Jan 18 2011 - 07:44:43 EST



Hi.

We currently have no way of determining the reason for failure when a softdog timeout occurs. At the minimum a snapshot of the system would help to determine the cause.
The attached patch invokes panic on softdog timeout iff kdump is configured, if kdump is not configured it works as usual.




Signed-off-by: Anithra P J <anithra@xxxxxxxxxxxxxxxxxx>

---
drivers/watchdog/softdog.c | 14 ++++++++++----
kernel/kexec.c | 1 +
2 files changed, 11 insertions(+), 4 deletions(-)

Index: linux-2.6.37-rc4/drivers/watchdog/softdog.c
===================================================================
--- linux-2.6.37-rc4.orig/drivers/watchdog/softdog.c
+++ linux-2.6.37-rc4/drivers/watchdog/softdog.c
@@ -48,6 +48,7 @@
#include <linux/init.h>
#include <linux/jiffies.h>
#include <linux/uaccess.h>
+#include <linux/kexec.h>

#define PFX "SoftDog: "

@@ -99,10 +100,15 @@
if (soft_noboot)
printk(KERN_CRIT PFX "Triggered - Reboot ignored.\n");
else {
- printk(KERN_CRIT PFX "Initiating system reboot.\n");
- emergency_restart();
- printk(KERN_CRIT PFX "Reboot didn't ?????\n");
- }
+ if (kexec_crash_image) {
+ printk(KERN_CRIT PFX "Initiating kdump. \n");
+ panic("Watchdog timer expired.");
+ } else {
+ printk(KERN_CRIT PFX "Initiating system reboot. \n");
+ emergency_restart();
+ printk(KERN_CRIT PFX "Reboot didn't ?????\n");
+ }
+ }
}

/*
Index: linux-2.6.37-rc4/kernel/kexec.c
===================================================================
--- linux-2.6.37-rc4.orig/kernel/kexec.c
+++ linux-2.6.37-rc4/kernel/kexec.c
@@ -935,6 +935,7 @@
*/
struct kimage *kexec_image;
struct kimage *kexec_crash_image;
+EXPORT_SYMBOL(kexec_crash_image);

static DEFINE_MUTEX(kexec_mutex);