Skip to contentSkip to conversation

Watchdog:core: constant pinging until userspace timesout when delay very less

RFC PATCH In review anish kumar 3 participants 13 messages Jun 2, 2013 – Jun 28, 2013 Watchdog device drivers

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Watchdog:core: constant pinging until userspace timesout when delay very less

Certain watchdog drivers use a timer to keep kicking the watchdog at a rate of 0.5s (HZ/2) untill userspace times out.They do this as we can't guarantee that watchdog will be pinged fast enough for all system loads, especially if timeout is configured for less than or equal to 1 second(basically small values).

As suggested by Wim Van Sebroeck & Guenter Roeck we should add this functionality of individual watchdog drivers in the core watchdog core.

---
 drivers/watchdog/watchdog_dev.c |   34 +++++++++++++++++++++++++++++-----
 include/linux/watchdog.h        |    1 +
 2 files changed, 30 insertions(+), 5 deletions(-)
drivers/watchdog/watchdog_dev.c +29 -5
index faf4e18..0305803 100644
@@ -41,9 +41,14 @@
 #include <linux/miscdevice.h>	/* For handling misc devices */
 #include <linux/init.h>		/* For __init/__exit/... */
 #include <linux/uaccess.h>	/* For copy_to_user/put_user/... */
+#include <linux/timer.h>
+#include <linux/jiffies.h>
 
 #include "watchdog_core.h"
 
+/* Timer heartbeat (500ms) */
+#define WDT_TIMEOUT	(HZ/2) /* should this be sysfs? */
+
 /* the dev_t structure to store the dynamically allocated watchdog devices */
 static dev_t watchdog_devt;
 /* the watchdog device behind /dev/watchdog */
@@ -73,16 +78,33 @@ static int watchdog_ping(struct watchdog_device *wddev)
 	if (!watchdog_active(wddev))
 		goto out_ping;
 
-	if (wddev->ops->ping)
-		err = wddev->ops->ping(wddev);  /* ping the watchdog */
-	else
-		err = wddev->ops->start(wddev); /* restart watchdog */
+	/* should we check ping interval value i.e. timeout value
+	   if it is less than certain threshold then only we 
+	   should add this logic of periodic pinging? */
+	if (time_before(jiffies, (unsigned long)wddev->timeout)) {
+		if (wddev->ops->ping)
+			err = wddev->ops->ping(wddev);/* ping the watchdog */
+		else
+			err = wddev->ops->start(wddev);/* restart watchdog */
+		mod_timer(&wddev->timer, jiffies + WDT_TIMEOUT);
+	} else {
+		/*
+		 *what we should when we find out that userspace
+		 *has timed out?
+		 **/
+	}
 
 out_ping:
 	mutex_unlock(&wddev->lock);
 	return err;
 }
 
+static void watchdog_ping_wrapper(unsigned long priv)
+{
+	struct watchdog_device *wdd = (void *)priv;
+	watchdog_ping(wdd);
+}
+
 /*
  *	watchdog_start: wrapper to start the watchdog.
  *	@wddev: the watchdog device to start
@@ -109,7 +131,8 @@ static int watchdog_start(struct watchdog_device *wddev)
 	err = wddev->ops->start(wddev);
 	if (err == 0)
 		set_bit(WDOG_ACTIVE, &wddev->status);
-
+	
+	mod_timer(&wddev->timer, jiffies + WDT_TIMEOUT);
 out_start:
 	mutex_unlock(&wddev->lock);
 	return err;
@@ -552,6 +575,7 @@ int watchdog_dev_register(struct watchdog_device *watchdog)
 			old_wdd = NULL;
 		}
 	}
+	setup_timer(&watchdog->timer, 0, (long)watchdog_ping_wrapper);
 	return err;
 }
 
include/linux/watchdog.h +1 -0
index 2a3038e..e5f18f7 100644
@@ -84,6 +84,7 @@ struct watchdog_device {
 	const struct watchdog_ops *ops;
 	unsigned int bootstatus;
 	unsigned int timeout;
+	struct timer_list timer;
 	unsigned int min_timeout;
 	unsigned int max_timeout;
 	void *driver_data;
Signature · 1 line
1.7.10.4
#1 lore raw

drivers/watchdog/watchdog_dev.c static int watchdog_ping(struct watchdog_device *wddev)

Quoted 36 lines · anish kumar

Certain watchdog drivers use a timer to keep kicking the watchdog at a rate of 0.5s (HZ/2) untill userspace times out.They do this as we can't guarantee that watchdog will be pinged fast enough for all system loads, especially if timeout is configured for less than or equal to 1 second(basically small values).

As suggested by Wim Van Sebroeck & Guenter Roeck we should add this functionality of individual watchdog drivers in the core watchdog core.

---
 drivers/watchdog/watchdog_dev.c |   34 +++++++++++++++++++++++++++++-----
 include/linux/watchdog.h        |    1 +
 2 files changed, 30 insertions(+), 5 deletions(-)
drivers/watchdog/watchdog_dev.c +5 -0
index faf4e18..0305803 100644
@@ -41,9 +41,14 @@
 #include <linux/miscdevice.h>  /* For handling misc devices */
 #include <linux/init.h>                /* For __init/__exit/... */
 #include <linux/uaccess.h>     /* For copy_to_user/put_user/... */
+#include <linux/timer.h>
+#include <linux/jiffies.h>
 
 #include "watchdog_core.h"
 
+/* Timer heartbeat (500ms) */
+#define WDT_TIMEOUT    (HZ/2) /* should this be sysfs? */
+
 /* the dev_t structure to store the dynamically allocated watchdog devices */
 static dev_t watchdog_devt;
 /* the watchdog device behind /dev/watchdog */
@@ -73,16 +78,33 @@ static int watchdog_ping(struct watchdog_device *wddev)

I think watchdog_ping function prototype should be changed as nowhere we use the return value.

Quoted 19 lines
drivers/watchdog/watchdog_dev.c +12 -4
        if (!watchdog_active(wddev))
                goto out_ping;
 
-       if (wddev->ops->ping)
-               err = wddev->ops->ping(wddev);  /* ping the watchdog */
-       else
-               err = wddev->ops->start(wddev); /* restart watchdog */
+       /* should we check ping interval value i.e. timeout value
+          if it is less than certain threshold then only we
+          should add this logic of periodic pinging? */
+       if (time_before(jiffies, (unsigned long)wddev->timeout)) {
+               if (wddev->ops->ping)
+                       err = wddev->ops->ping(wddev);/* ping the watchdog */
+               else
+                       err = wddev->ops->start(wddev);/* restart watchdog */
+               mod_timer(&wddev->timer, jiffies + WDT_TIMEOUT);
+       } else {
+               /*
+                *what we should when we find out that userspace

drivers/watchdog/watchdog_dev.c static int watchdog_ping(struct watchdog_device *wddev) · line 102

Quoted 10 lines
drivers/watchdog/watchdog_dev.c +4 -0
+                *has timed out?
+                **/
+       }
 
 out_ping:
        mutex_unlock(&wddev->lock);
        return err;
 }
 
+static void watchdog_ping_wrapper(unsigned long priv)

if we change the watchdog_ping api then we don't need this wrapper.

Quoted 31 lines
drivers/watchdog/watchdog_dev.c +8 -1
+{
+       struct watchdog_device *wdd = (void *)priv;
+       watchdog_ping(wdd);
+}
+
 /*
  *     watchdog_start: wrapper to start the watchdog.
  *     @wddev: the watchdog device to start
@@ -109,7 +131,8 @@ static int watchdog_start(struct watchdog_device *wddev)
        err = wddev->ops->start(wddev);
        if (err == 0)
                set_bit(WDOG_ACTIVE, &wddev->status);
-
+
+       mod_timer(&wddev->timer, jiffies + WDT_TIMEOUT);
 out_start:
        mutex_unlock(&wddev->lock);
        return err;
@@ -552,6 +575,7 @@ int watchdog_dev_register(struct watchdog_device *watchdog)
                        old_wdd = NULL;
                }
        }
+       setup_timer(&watchdog->timer, 0, (long)watchdog_ping_wrapper);
        return err;
 }
 
include/linux/watchdog.h +0 -0
index 2a3038e..e5f18f7 100644

include/linux/watchdog.h struct watchdog_device { · line 87

Quoted 4 lines
include/linux/watchdog.h +1 -0
@@ -84,6 +84,7 @@ struct watchdog_device {
        const struct watchdog_ops *ops;
        unsigned int bootstatus;
        unsigned int timeout;
+       struct timer_list timer;

should we use hrtimer? or timer would do?

Quoted 6 lines
include/linux/watchdog.h +0 -1
        unsigned int min_timeout;
        unsigned int max_timeout;
        void *driver_data;
--

1.7.10.4

#2 lore raw

any inputs?

Quoted 111 lines · anish singh

drivers/watchdog/watchdog_dev.c static int watchdog_ping(struct watchdog_device *wddev)

Quoted 36 lines · anish kumar

Certain watchdog drivers use a timer to keep kicking the watchdog at a rate of 0.5s (HZ/2) untill userspace times out.They do this as we can't guarantee that watchdog will be pinged fast enough for all system loads, especially if timeout is configured for less than or equal to 1 second(basically small values).

As suggested by Wim Van Sebroeck & Guenter Roeck we should add this functionality of individual watchdog drivers in the core watchdog core.

---
 drivers/watchdog/watchdog_dev.c |   34 +++++++++++++++++++++++++++++-----
 include/linux/watchdog.h        |    1 +
 2 files changed, 30 insertions(+), 5 deletions(-)
drivers/watchdog/watchdog_dev.c +5 -0
index faf4e18..0305803 100644
@@ -41,9 +41,14 @@
 #include <linux/miscdevice.h>  /* For handling misc devices */
 #include <linux/init.h>                /* For __init/__exit/... */
 #include <linux/uaccess.h>     /* For copy_to_user/put_user/... */
+#include <linux/timer.h>
+#include <linux/jiffies.h>
 
 #include "watchdog_core.h"
 
+/* Timer heartbeat (500ms) */
+#define WDT_TIMEOUT    (HZ/2) /* should this be sysfs? */
+
 /* the dev_t structure to store the dynamically allocated watchdog devices */
 static dev_t watchdog_devt;
 /* the watchdog device behind /dev/watchdog */
@@ -73,16 +78,33 @@ static int watchdog_ping(struct watchdog_device *wddev)

I think watchdog_ping function prototype should be changed as nowhere we use the return value.

Quoted 19 lines
drivers/watchdog/watchdog_dev.c +12 -4
        if (!watchdog_active(wddev))
                goto out_ping;
 
-       if (wddev->ops->ping)
-               err = wddev->ops->ping(wddev);  /* ping the watchdog */
-       else
-               err = wddev->ops->start(wddev); /* restart watchdog */
+       /* should we check ping interval value i.e. timeout value
+          if it is less than certain threshold then only we
+          should add this logic of periodic pinging? */
+       if (time_before(jiffies, (unsigned long)wddev->timeout)) {
+               if (wddev->ops->ping)
+                       err = wddev->ops->ping(wddev);/* ping the watchdog */
+               else
+                       err = wddev->ops->start(wddev);/* restart watchdog */
+               mod_timer(&wddev->timer, jiffies + WDT_TIMEOUT);
+       } else {
+               /*
+                *what we should when we find out that userspace

drivers/watchdog/watchdog_dev.c static int watchdog_ping(struct watchdog_device *wddev) · line 102

Quoted 10 lines
drivers/watchdog/watchdog_dev.c +4 -0
+                *has timed out?
+                **/
+       }
 
 out_ping:
        mutex_unlock(&wddev->lock);
        return err;
 }
 
+static void watchdog_ping_wrapper(unsigned long priv)

if we change the watchdog_ping api then we don't need this wrapper.

Quoted 31 lines
drivers/watchdog/watchdog_dev.c +8 -1
+{
+       struct watchdog_device *wdd = (void *)priv;
+       watchdog_ping(wdd);
+}
+
 /*
  *     watchdog_start: wrapper to start the watchdog.
  *     @wddev: the watchdog device to start
@@ -109,7 +131,8 @@ static int watchdog_start(struct watchdog_device *wddev)
        err = wddev->ops->start(wddev);
        if (err == 0)
                set_bit(WDOG_ACTIVE, &wddev->status);
-
+
+       mod_timer(&wddev->timer, jiffies + WDT_TIMEOUT);
 out_start:
        mutex_unlock(&wddev->lock);
        return err;
@@ -552,6 +575,7 @@ int watchdog_dev_register(struct watchdog_device *watchdog)
                        old_wdd = NULL;
                }
        }
+       setup_timer(&watchdog->timer, 0, (long)watchdog_ping_wrapper);
        return err;
 }
 
include/linux/watchdog.h +0 -0
index 2a3038e..e5f18f7 100644

include/linux/watchdog.h struct watchdog_device { · line 87

Quoted 4 lines
include/linux/watchdog.h +1 -0
@@ -84,6 +84,7 @@ struct watchdog_device {
        const struct watchdog_ops *ops;
        unsigned int bootstatus;
        unsigned int timeout;
+       struct timer_list timer;

should we use hrtimer? or timer would do?

Quoted 6 lines
include/linux/watchdog.h +0 -1
        unsigned int min_timeout;
        unsigned int max_timeout;
        void *driver_data;
--

1.7.10.4

maintainer
#3 lore raw
In reply to anish kumar
Quoted 11 lines · anish kumar

Certain watchdog drivers use a timer to keep kicking the watchdog at a rate of 0.5s (HZ/2) untill userspace times out.They do this as we can't guarantee that watchdog will be pinged fast enough for all system loads, especially if timeout is configured for less than or equal to 1 second(basically small values).

As suggested by Wim Van Sebroeck & Guenter Roeck we should add this functionality of individual watchdog drivers in the core watchdog core.

Not exactly what I had in mind. My idea was to enable the softdog only if the hardware watchdog's maximum timeout was low (say, less than a couple of minutes), and if a timeout larger than its maximum value was configured. In that case, I would have set the hardware watchdog to its maximum value and use the softdog to ping it at a rate of, say, 50% of this maximum.

If userspace would not ping the watchdog within its configured value, I would stop pinging the hardware watchdog and let it time out.

Guenter

Quoted 96 lines
---
 drivers/watchdog/watchdog_dev.c |   34 +++++++++++++++++++++++++++++-----
 include/linux/watchdog.h        |    1 +
 2 files changed, 30 insertions(+), 5 deletions(-)
drivers/watchdog/watchdog_dev.c +29 -5
index faf4e18..0305803 100644
@@ -41,9 +41,14 @@
 #include <linux/miscdevice.h>	/* For handling misc devices */
 #include <linux/init.h>		/* For __init/__exit/... */
 #include <linux/uaccess.h>	/* For copy_to_user/put_user/... */
+#include <linux/timer.h>
+#include <linux/jiffies.h>
 
 #include "watchdog_core.h"
 
+/* Timer heartbeat (500ms) */
+#define WDT_TIMEOUT	(HZ/2) /* should this be sysfs? */
+
 /* the dev_t structure to store the dynamically allocated watchdog devices */
 static dev_t watchdog_devt;
 /* the watchdog device behind /dev/watchdog */
@@ -73,16 +78,33 @@ static int watchdog_ping(struct watchdog_device *wddev)
 	if (!watchdog_active(wddev))
 		goto out_ping;
 
-	if (wddev->ops->ping)
-		err = wddev->ops->ping(wddev);  /* ping the watchdog */
-	else
-		err = wddev->ops->start(wddev); /* restart watchdog */
+	/* should we check ping interval value i.e. timeout value
+	   if it is less than certain threshold then only we 
+	   should add this logic of periodic pinging? */
+	if (time_before(jiffies, (unsigned long)wddev->timeout)) {
+		if (wddev->ops->ping)
+			err = wddev->ops->ping(wddev);/* ping the watchdog */
+		else
+			err = wddev->ops->start(wddev);/* restart watchdog */
+		mod_timer(&wddev->timer, jiffies + WDT_TIMEOUT);
+	} else {
+		/*
+		 *what we should when we find out that userspace
+		 *has timed out?
+		 **/
+	}
 
 out_ping:
 	mutex_unlock(&wddev->lock);
 	return err;
 }
 
+static void watchdog_ping_wrapper(unsigned long priv)
+{
+	struct watchdog_device *wdd = (void *)priv;
+	watchdog_ping(wdd);
+}
+
 /*
  *	watchdog_start: wrapper to start the watchdog.
  *	@wddev: the watchdog device to start
@@ -109,7 +131,8 @@ static int watchdog_start(struct watchdog_device *wddev)
 	err = wddev->ops->start(wddev);
 	if (err == 0)
 		set_bit(WDOG_ACTIVE, &wddev->status);
-
+	
+	mod_timer(&wddev->timer, jiffies + WDT_TIMEOUT);
 out_start:
 	mutex_unlock(&wddev->lock);
 	return err;
@@ -552,6 +575,7 @@ int watchdog_dev_register(struct watchdog_device *watchdog)
 			old_wdd = NULL;
 		}
 	}
+	setup_timer(&watchdog->timer, 0, (long)watchdog_ping_wrapper);
 	return err;
 }
 
include/linux/watchdog.h +1 -0
index 2a3038e..e5f18f7 100644
@@ -84,6 +84,7 @@ struct watchdog_device {
 	const struct watchdog_ops *ops;
 	unsigned int bootstatus;
 	unsigned int timeout;
+	struct timer_list timer;
 	unsigned int min_timeout;
 	unsigned int max_timeout;
 	void *driver_data;
Signature · 1 line
1.7.10.4
#4 lore raw
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · anish kumar

Certain watchdog drivers use a timer to keep kicking the watchdog at a rate of 0.5s (HZ/2) untill userspace times out.They do this as we can't guarantee that watchdog will be pinged fast enough for all system loads, especially if timeout is configured for less than or equal to 1 second(basically small values).

As suggested by Wim Van Sebroeck & Guenter Roeck we should add this functionality of individual watchdog drivers in the core watchdog core.

Quoted 5 lines
Quoted 1 line

Not exactly what I had in mind. My idea was to enable the softdog only if the hardware watchdog's maximum timeout was low (say, less than a couple of minutes), and if a timeout larger than its maximum value was configured.

watchdog_timeout_invalid wouldn't this check will fail if the user space tries to set maximum timeout more that what driver can support?It would work for pika_wdt.c as it is old watchdog driver and doesn't register with watchdog framwork but new drivers has to pass this api.

OR

Do you want to remove this check and go as explained by you?I would favour this approach though.

Quoted 5 lines

In that case, I would have set the hardware watchdog to its maximum value and use the softdog to ping it at a rate of, say, 50% of this maximum.

If userspace would not ping the watchdog within its configured value, I would stop pinging the hardware watchdog and let it time out.

One more question.Why is the return value of watchdog_ping int? Anyway we discard it.

Quoted 99 lines

Guenter

Quoted 96 lines
---
 drivers/watchdog/watchdog_dev.c |   34 +++++++++++++++++++++++++++++-----
 include/linux/watchdog.h        |    1 +
 2 files changed, 30 insertions(+), 5 deletions(-)
drivers/watchdog/watchdog_dev.c +29 -5
index faf4e18..0305803 100644
@@ -41,9 +41,14 @@
 #include <linux/miscdevice.h>        /* For handling misc devices */
 #include <linux/init.h>              /* For __init/__exit/... */
 #include <linux/uaccess.h>   /* For copy_to_user/put_user/... */
+#include <linux/timer.h>
+#include <linux/jiffies.h>
 
 #include "watchdog_core.h"
 
+/* Timer heartbeat (500ms) */
+#define WDT_TIMEOUT  (HZ/2) /* should this be sysfs? */
+
 /* the dev_t structure to store the dynamically allocated watchdog devices */
 static dev_t watchdog_devt;
 /* the watchdog device behind /dev/watchdog */
@@ -73,16 +78,33 @@ static int watchdog_ping(struct watchdog_device *wddev)
      if (!watchdog_active(wddev))
              goto out_ping;
 
-     if (wddev->ops->ping)
-             err = wddev->ops->ping(wddev);  /* ping the watchdog */
-     else
-             err = wddev->ops->start(wddev); /* restart watchdog */
+     /* should we check ping interval value i.e. timeout value
+        if it is less than certain threshold then only we
+        should add this logic of periodic pinging? */
+     if (time_before(jiffies, (unsigned long)wddev->timeout)) {
+             if (wddev->ops->ping)
+                     err = wddev->ops->ping(wddev);/* ping the watchdog */
+             else
+                     err = wddev->ops->start(wddev);/* restart watchdog */
+             mod_timer(&wddev->timer, jiffies + WDT_TIMEOUT);
+     } else {
+             /*
+              *what we should when we find out that userspace
+              *has timed out?
+              **/
+     }
 
 out_ping:
      mutex_unlock(&wddev->lock);
      return err;
 }
 
+static void watchdog_ping_wrapper(unsigned long priv)
+{
+     struct watchdog_device *wdd = (void *)priv;
+     watchdog_ping(wdd);
+}
+
 /*
  *   watchdog_start: wrapper to start the watchdog.
  *   @wddev: the watchdog device to start
@@ -109,7 +131,8 @@ static int watchdog_start(struct watchdog_device *wddev)
      err = wddev->ops->start(wddev);
      if (err == 0)
              set_bit(WDOG_ACTIVE, &wddev->status);
-
+
+     mod_timer(&wddev->timer, jiffies + WDT_TIMEOUT);
 out_start:
      mutex_unlock(&wddev->lock);
      return err;
@@ -552,6 +575,7 @@ int watchdog_dev_register(struct watchdog_device *watchdog)
                      old_wdd = NULL;
              }
      }
+     setup_timer(&watchdog->timer, 0, (long)watchdog_ping_wrapper);
      return err;
 }
 
include/linux/watchdog.h +1 -1
index 2a3038e..e5f18f7 100644
@@ -84,6 +84,7 @@ struct watchdog_device {
      const struct watchdog_ops *ops;
      unsigned int bootstatus;
      unsigned int timeout;
+     struct timer_list timer;
      unsigned int min_timeout;
      unsigned int max_timeout;
      void *driver_data;
--

1.7.10.4

maintainer
#5 lore raw
Quoted 23 lines · anish singh
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · anish kumar

Certain watchdog drivers use a timer to keep kicking the watchdog at a rate of 0.5s (HZ/2) untill userspace times out.They do this as we can't guarantee that watchdog will be pinged fast enough for all system loads, especially if timeout is configured for less than or equal to 1 second(basically small values).

As suggested by Wim Van Sebroeck & Guenter Roeck we should add this functionality of individual watchdog drivers in the core watchdog core.

Quoted 5 lines
Quoted 1 line

Not exactly what I had in mind. My idea was to enable the softdog only if the hardware watchdog's maximum timeout was low (say, less than a couple of minutes), and if a timeout larger than its maximum value was configured.

watchdog_timeout_invalid wouldn't this check will fail if the user space tries to set maximum timeout more that what driver can support?It would work for pika_wdt.c as it is old watchdog driver and doesn't register with watchdog framwork but new drivers has to pass this api.

Quoted 5 lines

OR

Do you want to remove this check and go as explained by you?I would favour this approach though.

One would still have a check, but the enforced limits would no longer be the driver limits, but larger limits implemented in the watchdog core.

Quoted 8 lines
Quoted 5 lines

In that case, I would have set the hardware watchdog to its maximum value and use the softdog to ping it at a rate of, say, 50% of this maximum.

If userspace would not ping the watchdog within its configured value, I would stop pinging the hardware watchdog and let it time out.

One more question.Why is the return value of watchdog_ping int? Anyway we discard it.

I can not answer that question.

Guenter

#6 lore raw
Quoted 24 lines · Guenter Roeck
Quoted 23 lines · anish singh
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · anish kumar

Certain watchdog drivers use a timer to keep kicking the watchdog at a rate of 0.5s (HZ/2) untill userspace times out.They do this as we can't guarantee that watchdog will be pinged fast enough for all system loads, especially if timeout is configured for less than or equal to 1 second(basically small values).

As suggested by Wim Van Sebroeck & Guenter Roeck we should add this functionality of individual watchdog drivers in the core watchdog core.

Quoted 5 lines
Quoted 1 line

Not exactly what I had in mind. My idea was to enable the softdog only if the hardware watchdog's maximum timeout was low (say, less than a couple of minutes), and if a timeout larger than its maximum value was configured.

watchdog_timeout_invalid wouldn't this check will fail if the user space tries to set maximum timeout more that what driver can support?It would work for pika_wdt.c as it is old watchdog driver and doesn't register with watchdog framwork but new drivers has to pass this api.

Quoted 7 lines
Quoted 5 lines

OR

Do you want to remove this check and go as explained by you?I would favour this approach though.

One would still have a check, but the enforced limits would no longer be the driver limits, but larger limits implemented in the watchdog core.

How much larger would be the big question here?Should it be configurable property(sysfs?) or some hardcoding based on existing drivers?

Before going for next patch, it would be better for me to wait for some more comments.

Quoted 13 lines
Quoted 9 lines
Quoted 6 lines

In that case, I would have set the hardware watchdog to its maximum value and use the softdog to ping it at a rate of, say, 50% of this maximum.

If userspace would not ping the watchdog within its configured value, I would stop pinging the hardware watchdog and let it time out.

One more question.Why is the return value of watchdog_ping int? Anyway we discard it.

I can not answer that question.

Guenter

#7 lore raw

Hello Wim Van Sabroeck,
Can I get your inputs on this?

Quoted 50 lines · anish singh
Quoted 24 lines · Guenter Roeck
Quoted 23 lines · anish singh
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · anish kumar

Certain watchdog drivers use a timer to keep kicking the watchdog at a rate of 0.5s (HZ/2) untill userspace times out.They do this as we can't guarantee that watchdog will be pinged fast enough for all system loads, especially if timeout is configured for less than or equal to 1 second(basically small values).

As suggested by Wim Van Sebroeck & Guenter Roeck we should add this functionality of individual watchdog drivers in the core watchdog core.

Quoted 5 lines
Quoted 1 line

Not exactly what I had in mind. My idea was to enable the softdog only if the hardware watchdog's maximum timeout was low (say, less than a couple of minutes), and if a timeout larger than its maximum value was configured.

watchdog_timeout_invalid wouldn't this check will fail if the user space tries to set maximum timeout more that what driver can support?It would work for pika_wdt.c as it is old watchdog driver and doesn't register with watchdog framwork but new drivers has to pass this api.

Quoted 7 lines
Quoted 5 lines

OR

Do you want to remove this check and go as explained by you?I would favour this approach though.

One would still have a check, but the enforced limits would no longer be the driver limits, but larger limits implemented in the watchdog core.

How much larger would be the big question here?Should it be configurable property(sysfs?) or some hardcoding based on existing drivers?

Before going for next patch, it would be better for me to wait for some more comments.

Quoted 13 lines
Quoted 9 lines
Quoted 6 lines

In that case, I would have set the hardware watchdog to its maximum value and use the softdog to ping it at a rate of, say, 50% of this maximum.

If userspace would not ping the watchdog within its configured value, I would stop pinging the hardware watchdog and let it time out.

One more question.Why is the return value of watchdog_ping int? Anyway we discard it.

I can not answer that question.

Guenter

#8 lore raw

Hello Wim Van,
Can you look into below?

Quoted 54 lines · anish singh

Hello Wim Van Sabroeck,
Can I get your inputs on this?

Quoted 50 lines · anish singh
Quoted 24 lines · Guenter Roeck
Quoted 23 lines · anish singh
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · anish kumar

Certain watchdog drivers use a timer to keep kicking the watchdog at a rate of 0.5s (HZ/2) untill userspace times out.They do this as we can't guarantee that watchdog will be pinged fast enough for all system loads, especially if timeout is configured for less than or equal to 1 second(basically small values).

As suggested by Wim Van Sebroeck & Guenter Roeck we should add this functionality of individual watchdog drivers in the core watchdog core.

Quoted 5 lines
Quoted 1 line

Not exactly what I had in mind. My idea was to enable the softdog only if the hardware watchdog's maximum timeout was low (say, less than a couple of minutes), and if a timeout larger than its maximum value was configured.

watchdog_timeout_invalid wouldn't this check will fail if the user space tries to set maximum timeout more that what driver can support?It would work for pika_wdt.c as it is old watchdog driver and doesn't register with watchdog framwork but new drivers has to pass this api.

Quoted 7 lines
Quoted 5 lines

OR

Do you want to remove this check and go as explained by you?I would favour this approach though.

One would still have a check, but the enforced limits would no longer be the driver limits, but larger limits implemented in the watchdog core.

How much larger would be the big question here?Should it be configurable property(sysfs?) or some hardcoding based on existing drivers?

Before going for next patch, it would be better for me to wait for some more comments.

Quoted 13 lines
Quoted 9 lines
Quoted 6 lines

In that case, I would have set the hardware watchdog to its maximum value and use the softdog to ping it at a rate of, say, 50% of this maximum.

If userspace would not ping the watchdog within its configured value, I would stop pinging the hardware watchdog and let it time out.

One more question.Why is the return value of watchdog_ping int? Anyway we discard it.

I can not answer that question.

Guenter

maintainer
#9 lore raw
Quoted 3 lines · anish singh

Hello Wim Van,
Can you look into below?

Please be patient. Wim tends to be busy.

Guenter

Quoted 60 lines · anish singh
Quoted 54 lines

Hello Wim Van Sabroeck,
Can I get your inputs on this?

Quoted 50 lines · anish singh
Quoted 24 lines · Guenter Roeck
Quoted 23 lines · anish singh
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · anish kumar

Certain watchdog drivers use a timer to keep kicking the watchdog at a rate of 0.5s (HZ/2) untill userspace times out.They do this as we can't guarantee that watchdog will be pinged fast enough for all system loads, especially if timeout is configured for less than or equal to 1 second(basically small values).

As suggested by Wim Van Sebroeck & Guenter Roeck we should add this functionality of individual watchdog drivers in the core watchdog core.

Quoted 5 lines
Quoted 1 line

Not exactly what I had in mind. My idea was to enable the softdog only if the hardware watchdog's maximum timeout was low (say, less than a couple of minutes), and if a timeout larger than its maximum value was configured.

watchdog_timeout_invalid wouldn't this check will fail if the user space tries to set maximum timeout more that what driver can support?It would work for pika_wdt.c as it is old watchdog driver and doesn't register with watchdog framwork but new drivers has to pass this api.

Quoted 7 lines
Quoted 5 lines

OR

Do you want to remove this check and go as explained by you?I would favour this approach though.

One would still have a check, but the enforced limits would no longer be the driver limits, but larger limits implemented in the watchdog core.

How much larger would be the big question here?Should it be configurable property(sysfs?) or some hardcoding based on existing drivers?

Before going for next patch, it would be better for me to wait for some more comments.

Quoted 13 lines
Quoted 9 lines
Quoted 6 lines

In that case, I would have set the hardware watchdog to its maximum value and use the softdog to ping it at a rate of, say, 50% of this maximum.

If userspace would not ping the watchdog within its configured value, I would stop pinging the hardware watchdog and let it time out.

One more question.Why is the return value of watchdog_ping int? Anyway we discard it.

I can not answer that question.

Guenter

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

#10 lore raw
Quoted 5 lines · Guenter Roeck
Quoted 3 lines · anish singh

Hello Wim Van,
Can you look into below?

Please be patient. Wim tends to be busy.

Sorry, I will wait.

Quoted 63 lines

Guenter

Quoted 60 lines · anish singh
Quoted 54 lines

Hello Wim Van Sabroeck,
Can I get your inputs on this?

Quoted 50 lines · anish singh
Quoted 24 lines · Guenter Roeck
Quoted 23 lines · anish singh
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · anish kumar

Certain watchdog drivers use a timer to keep kicking the watchdog at a rate of 0.5s (HZ/2) untill userspace times out.They do this as we can't guarantee that watchdog will be pinged fast enough for all system loads, especially if timeout is configured for less than or equal to 1 second(basically small values).

As suggested by Wim Van Sebroeck & Guenter Roeck we should add this functionality of individual watchdog drivers in the core watchdog core.

Quoted 5 lines
Quoted 1 line

Not exactly what I had in mind. My idea was to enable the softdog only if the hardware watchdog's maximum timeout was low (say, less than a couple of minutes), and if a timeout larger than its maximum value was configured.

watchdog_timeout_invalid wouldn't this check will fail if the user space tries to set maximum timeout more that what driver can support?It would work for pika_wdt.c as it is old watchdog driver and doesn't register with watchdog framwork but new drivers has to pass this api.

Quoted 7 lines
Quoted 5 lines

OR

Do you want to remove this check and go as explained by you?I would favour this approach though.

One would still have a check, but the enforced limits would no longer be the driver limits, but larger limits implemented in the watchdog core.

How much larger would be the big question here?Should it be configurable property(sysfs?) or some hardcoding based on existing drivers?

Before going for next patch, it would be better for me to wait for some more comments.

Quoted 13 lines
Quoted 9 lines
Quoted 6 lines

In that case, I would have set the hardware watchdog to its maximum value and use the softdog to ping it at a rate of, say, 50% of this maximum.

If userspace would not ping the watchdog within its configured value, I would stop pinging the hardware watchdog and let it time out.

One more question.Why is the return value of watchdog_ping int? Anyway we discard it.

I can not answer that question.

Guenter

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

#11 lore raw
In reply to anish kumar

Hi Anish,

Quoted 9 lines

Certain watchdog drivers use a timer to keep kicking the watchdog at a rate of 0.5s (HZ/2) untill userspace times out.They do this as we can't guarantee that watchdog will be pinged fast enough for all system loads, especially if timeout is configured for less than or equal to 1 second(basically small values).

As suggested by Wim Van Sebroeck & Guenter Roeck we should add this functionality of individual watchdog drivers in the core watchdog core.

Have you considered the effect this change has on all watchdog drivers that don't need a timer?

Kind regards,
Wim.

#12 lore raw
Quoted 8 lines · Wim Van Sebroeck

Hi Anish,

Quoted 6 lines

Certain watchdog drivers use a timer to keep kicking the watchdog at a rate of 0.5s (HZ/2) untill userspace times out.They do this as we can't guarantee that watchdog will be pinged fast enough for all system loads, especially if timeout is configured for less than or equal to 1 second(basically small values).

Quoted 6 lines
Quoted 3 lines

As suggested by Wim Van Sebroeck & Guenter Roeck we should add this functionality of individual watchdog drivers in the core watchdog core.

Have you considered the effect this change has on all watchdog drivers that don't need a timer?

No,I will drop this patch.

Quoted 4 lines

Kind regards,
Wim.