[lkml]   [2011]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 1/2] watchdog: iTCO_wdt: optionally leave watchdog enabled during restart
A system reboot may fail, especially when rebooting via kexec, which can
result in a hung system that requires manual intervention.

This patch adds support for a "reboot_timeout", so we can program the
watchdog to reset the system if a reboot hangs.

On the way down, we schedule a watchdog reset for some time in the future:
long enough for the new kernel to boot and set up the watchdog timer itself.

If we reboot via BIOS, BIOS should disable the watchdog itself, so this
shouldn't cause unintended resets, even if the user interrupts the boot.

Signed-off-by: Bjorn Helgaas <>
drivers/watchdog/iTCO_wdt.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
index 5fd020d..66f800c 100644
--- a/drivers/watchdog/iTCO_wdt.c
+++ b/drivers/watchdog/iTCO_wdt.c
@@ -507,6 +507,11 @@ MODULE_PARM_DESC(heartbeat, "Watchdog timeout in seconds. "
"5..76 (TCO v1) or 3..614 (TCO v2), default="

+static int reboot_timeout;
+module_param(reboot_timeout, int, 0);
+ "Schedule reset N seconds after reboot (default=0 (no reset))");
static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
@@ -1050,6 +1055,14 @@ static int __devexit iTCO_wdt_remove(struct platform_device *dev)
static void iTCO_wdt_shutdown(struct platform_device *dev)
+ if (system_state == SYSTEM_RESTART && reboot_timeout) {
+ printk(KERN_CRIT PFX
+ "scheduling watchdog reset %d seconds from now\n",
+ reboot_timeout);
+ iTCO_wdt_set_heartbeat(reboot_timeout);
+ iTCO_wdt_start();
+ }

#define iTCO_wdt_suspend NULL

 \ /
  Last update: 2011-07-06 18:11    [W:0.067 / U:36.304 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site