From: Bjorn Helgaas <bhelgaas@google.com>
To: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org
Subject: [PATCH 2/2] watchdog: nv_tco: optionally leave watchdog enabled during restart
Date: Wed, 06 Jul 2011 10:09:41 -0600 [thread overview]
Message-ID: <20110706160941.4002.43149.stgit@bhelgaas.mtv.corp.google.com> (raw)
In-Reply-To: <20110706160744.4002.94920.stgit@bhelgaas.mtv.corp.google.com>
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 <bhelgaas@google.com>
---
drivers/watchdog/nv_tco.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/drivers/watchdog/nv_tco.c b/drivers/watchdog/nv_tco.c
index afa78a5..90eac80 100644
--- a/drivers/watchdog/nv_tco.c
+++ b/drivers/watchdog/nv_tco.c
@@ -60,6 +60,11 @@ module_param(heartbeat, int, 0);
MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<heartbeat<39, "
"default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
+static int reboot_timeout;
+module_param(reboot_timeout, int, 0);
+MODULE_PARM_DESC(reboot_timeout,
+ "Schedule reset N seconds after reboot (default=0 (no reset))");
+
static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"
@@ -459,6 +464,14 @@ static int __devexit nv_tco_remove(struct platform_device *dev)
static void nv_tco_shutdown(struct platform_device *dev)
{
tco_timer_stop();
+
+ if (system_state == SYSTEM_RESTART && reboot_timeout) {
+ printk(KERN_CRIT PFX
+ "scheduling watchdog reset %d seconds from now\n",
+ reboot_timeout);
+ tco_timer_set_heartbeat(reboot_timeout);
+ tco_timer_start();
+ }
}
static struct platform_driver nv_tco_driver = {
next prev parent reply other threads:[~2011-07-06 16:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-06 16:09 [PATCH 0/2] [RFC] watchdog reboot timeout Bjorn Helgaas
2011-07-06 16:09 ` [PATCH 1/2] watchdog: iTCO_wdt: optionally leave watchdog enabled during restart Bjorn Helgaas
2011-07-07 15:39 ` Valdis.Kletnieks
2011-07-07 15:53 ` Pádraig Brady
2011-07-12 17:22 ` Bjorn Helgaas
2011-07-06 16:09 ` Bjorn Helgaas [this message]
2011-07-07 13:51 ` [PATCH 0/2] [RFC] watchdog reboot timeout Pádraig Brady
2011-07-12 16:25 ` Bjorn Helgaas
2011-07-12 21:36 ` Pádraig Brady
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=20110706160941.4002.43149.stgit@bhelgaas.mtv.corp.google.com \
--to=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=wim@iguana.be \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®