Re: watchdog: watchdog_dev: WATCHDOG_KEEP_ON feature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




W dniu 2014-09-10 19:24, Janusz Użycki pisze:
To store relation to the thread:
http://www.spinics.net/lists/linux-watchdog/msg05013.html

I propose to add to the patch rootfs's boot time parameter.
If this time is not zero after the time timer stops pinging.
The parameter is a time when userland is ready to maintain
a watchdog alone if it supports wachdog at all.
The parameter seems to be common for all watchdog drivers
and could be defined by kernel's cmdline
because the time concerns a specific machine, board/kernel
and rootfs.
Some userlands open /dev/watchdog only in critical moments
and after they use magic close. Therefore the patch continues
watchdog's pinging in kernel's space. For the case boot time
parameters should be zero.
It is just idea.
Below is implementation proposal for the idea.

best regards
Janusz

Subject: [PATCH] watchdog: boottime protection feature (requires 'keep on')


Signed-off-by: Janusz Uzycki <j.uzycki@xxxxxxxxxxxxxx>
---
 linux-3.14.17/drivers/watchdog/watchdog_core.c |  4 ++++
 linux-3.14.17/drivers/watchdog/watchdog_dev.c  | 11 +++++++++++
 2 files changed, 15 insertions(+)

diff --git a/linux-3.14.17/drivers/watchdog/watchdog_core.c b/linux-3.14.17/drivers/watchdog/watchdog_core.c
index cec9b55..13f3d3a 100644
--- a/linux-3.14.17/drivers/watchdog/watchdog_core.c
+++ b/linux-3.14.17/drivers/watchdog/watchdog_core.c
@@ -43,6 +43,10 @@
 static DEFINE_IDA(watchdog_ida);
 static struct class *watchdog_class;

+unsigned int boottime = 0;
+module_param(boottime, uint, 0);
+MODULE_PARM_DESC(boottime, "After the boot time active watchdog(s) have to be maintained by userland. 0 disables the protection.");
+
 static void watchdog_check_min_max_timeout(struct watchdog_device *wdd)
 {
        /*
diff --git a/linux-3.14.17/drivers/watchdog/watchdog_dev.c b/linux-3.14.17/drivers/watchdog/watchdog_dev.c
index 51a65f6..4b975da 100644
--- a/linux-3.14.17/drivers/watchdog/watchdog_dev.c
+++ b/linux-3.14.17/drivers/watchdog/watchdog_dev.c
@@ -42,6 +42,7 @@
 #include <linux/init.h>                /* For __init/__exit/... */
 #include <linux/uaccess.h>     /* For copy_to_user/put_user/... */
 #include <linux/jiffies.h>     /* for ping timer */
+#include <linux/time.h>                /* for uptime */

 #include "watchdog_core.h"

@@ -282,6 +283,16 @@ out_ioctl:
 static void watchdog_ping_timer_cb(unsigned long data)
 {
        struct watchdog_device *wdd = (struct watchdog_device *)data;
+ /* After the boot time active watchdog(s) have to be maintained by userland.
+        * The protection works only if boot time is non-zero
+        * and keep on feature is enabled */
+       extern unsigned int boottime;
+       if (boottime) {
+               struct timespec uptime;
+               get_monotonic_boottime(&uptime);
+               if (uptime.tv_sec > boottime)
+                       return;
+       }
        watchdog_ping(wdd);
        /* call next ping half the timeout value */
        mod_timer(&wdd->ping_timer,
--
1.7.11.3


--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux