linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch: softdog and WDIOS_DISABLECARD
@ 2001-05-02  7:33 Shane Wegner
  2001-05-02 11:41 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Shane Wegner @ 2001-05-02  7:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alan Cox

Hi,

I have found a potential problem with the current
implementation of the software watchdog.  I have
CONFIG_WATCHDOG_NOWAYOUT set for a reliable watchdog. 
However, there are instances where I want to explicitly
shut it down.  The problem with disabling
CONFIG_WATCHDOG_NOWAYOUT is that events other than an
explicit shutdown can disable the timer.  A SIGSEGV
perhaps or the daemon being killed by the OOM handler.  In
cases like this, the system should reboot IMO.

This small patch adds the appropriate options to enable and
disable the timer explicitly.

--- softdog.c.orig	Wed May  2 00:15:56 2001
+++ softdog.c	Wed May  2 00:15:19 2001
@@ -130,6 +130,7 @@
 	static struct watchdog_info ident = {
 		identity: "Software Watchdog",
 	};
+	int rv;
 	switch (cmd) {
 		default:
 			return -ENOIOCTLCMD;
@@ -140,6 +141,25 @@
 		case WDIOC_GETSTATUS:
 		case WDIOC_GETBOOTSTATUS:
 			return put_user(0,(int *)arg);
+		case WDIOC_SETOPTIONS:
+			if(copy_from_user(&rv, (int*) arg, sizeof(int)))
+				return -EFAULT;
+
+			if (rv & WDIOS_DISABLECARD) {
+				lock_kernel();
+				del_timer(&watchdog_ticktock);
+				unlock_kernel();
+			return 0;
+			}
+
+			if (rv & WDIOS_ENABLECARD) {
+				lock_kernel();
+				mod_timer(&watchdog_ticktock, jiffies +
+				   (soft_margin * HZ));
+				unlock_kernel();
+				return 0;
+			}
+
 		case WDIOC_KEEPALIVE:
 			mod_timer(&watchdog_ticktock, jiffies+(soft_margin*HZ));
 			return 0;

-- 
Shane Wegner: shane@cm.nu
              http://www.cm.nu/~shane/
PGP:          1024D/FFE3035D
              A0ED DAC4 77EC D674 5487
              5B5C 4F89 9A4E FFE3 035D

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Patch: softdog and WDIOS_DISABLECARD
  2001-05-02  7:33 Patch: softdog and WDIOS_DISABLECARD Shane Wegner
@ 2001-05-02 11:41 ` Alan Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2001-05-02 11:41 UTC (permalink / raw)
  To: Shane Wegner; +Cc: linux-kernel, Alan Cox

> I have found a potential problem with the current
> implementation of the software watchdog.  I have
> CONFIG_WATCHDOG_NOWAYOUT set for a reliable watchdog. 
> However, there are instances where I want to explicitly
> shut it down.  The problem with disabling

It is intentional you cannot shut it down. The whole point of that mode
of operation is that you can make definitive statements about your watchdogs.

You can swap the watchdog process with any simple program that keeps it ticking
while you do other work, then swap back.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-05-02 11:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-02  7:33 Patch: softdog and WDIOS_DISABLECARD Shane Wegner
2001-05-02 11:41 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).