Linux Watchdog driver development
 help / color / mirror / Atom feed
From: "Janusz Użycki" <j.uzycki@elproma.com.pl>
To: Guenter Roeck <linux@roeck-us.net>, linux-watchdog@vger.kernel.org
Cc: Wim Van Sebroeck <wim@iguana.be>
Subject: Re: watchdog: watchdog_dev: WATCHDOG_KEEP_ON feature
Date: Thu, 11 Sep 2014 12:47:29 +0200	[thread overview]
Message-ID: <54117DC1.5030307@elproma.com.pl> (raw)
In-Reply-To: <54108934.8050102@elproma.com.pl>


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@elproma.com.pl>
---
  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

  reply	other threads:[~2014-09-11 10:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <S1751381AbaIDOwq/20140904145246Z+988@vger.kernel.org>
2014-09-04 15:47 ` watchdog: WatchDog Timer Driver Core: ping a hardware watchdog in kernel's space Janusz Użycki
2014-09-07 17:18   ` Guenter Roeck
2014-09-08  1:14     ` watchdog: watchdog_dev: WATCHDOG_KEEP_ON feature Janusz Użycki
2014-09-08  1:18       ` Janusz Użycki
2014-09-08  3:24         ` Guenter Roeck
2014-09-08  3:16       ` Guenter Roeck
2014-09-08 12:14         ` Janusz Użycki
2014-09-10 17:24           ` Janusz Użycki
2014-09-11 10:47             ` Janusz Użycki [this message]
2014-09-17 11:09         ` Janusz Użycki
2014-09-18 11:07           ` watchdog's pm support preffered implementation Janusz Użycki
2014-09-18 21:40             ` Janusz Użycki
2014-09-18 22:02               ` Janusz Użycki
2014-09-19  3:11                 ` Guenter Roeck
2014-09-19  9:46                   ` Janusz Użycki
2014-09-19 11:23                     ` timers vs drivers suspend race Janusz Użycki
2014-09-19 13:44                       ` Janusz Użycki
2014-09-19 16:21                     ` watchdog's pm support preffered implementation Guenter Roeck
2014-09-23 12:07                       ` Janusz Użycki

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=54117DC1.5030307@elproma.com.pl \
    --to=j.uzycki@elproma.com.pl \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --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