Skip to contentSkip to conversation

softdog: make pretimeout available when SOFT_WATCHDOG_PRETIMEOUT enabled

PATCH In review Wang Qing 2 participants 3 messages Apr 6, 2021 – Apr 10, 2021 Watchdog device drivers

lore
Share & tools
lore

Wang Qing

author
#0 lore raw

PATCH 1/1 softdog: make pretimeout available when SOFT_WATCHDOG_PRETIMEOUT enabled

Although softdog supports pretimeout, there is no way to set pretimeout, so pretimeout will never be processed in softdog_ping().

Here add the configuration mechanism for pretimeout and the default value is 1 second, so when CONFIG_SOFT_WATCHDOG_PRETIMEOUT is enabled, the pretimeout function defaults available.

---
 drivers/watchdog/softdog.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/watchdog/softdog.c +11 -0
index 7a10962..79e52791
@@ -35,6 +35,14 @@ MODULE_PARM_DESC(soft_margin,
 	"Watchdog soft_margin in seconds. (0 < soft_margin < 65536, default="
 					__MODULE_STRING(TIMER_MARGIN) ")");
 
+#ifdef CONFIG_SOFT_WATCHDOG_PRETIMEOUT
+#define PRE_TIMER_MARGIN	1		/* Default is 1 seconds */
+static unsigned int soft_pretimeout = PRE_TIMER_MARGIN;	/* in seconds */
+module_param(soft_pretimeout, uint, 0);
+MODULE_PARM_DESC(soft_pretimeout,
+	"Watchdog soft_pretimeout in seconds. (0 < soft_pretimeout < soft_margin, default=1)");
+#endif
+
 static bool nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, bool, 0);
 MODULE_PARM_DESC(nowayout,
@@ -177,6 +185,9 @@ static struct watchdog_device softdog_dev = {
 	.min_timeout = 1,
 	.max_timeout = 65535,
 	.timeout = TIMER_MARGIN,
+#ifdef CONFIG_SOFT_WATCHDOG_PRETIMEOUT
+	.pretimeout = PRE_TIMER_MARGIN,
+#endif
 };
 
 static int __init softdog_init(void)
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 3 lines · Wang Qing

Although softdog supports pretimeout, there is no way to set pretimeout, so pretimeout will never be processed in softdog_ping().

This is wrong. The pretimeout can be set using WDIOC_SETPRETIMEOUT, as with every other driver supporting it. There is no need for a module parameter.

Guenter

Quoted 39 lines

Here add the configuration mechanism for pretimeout and the default value is 1 second, so when CONFIG_SOFT_WATCHDOG_PRETIMEOUT is enabled, the pretimeout function defaults available.

---
 drivers/watchdog/softdog.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/watchdog/softdog.c +11 -0
index 7a10962..79e52791
@@ -35,6 +35,14 @@ MODULE_PARM_DESC(soft_margin,
 	"Watchdog soft_margin in seconds. (0 < soft_margin < 65536, default="
 					__MODULE_STRING(TIMER_MARGIN) ")");
 
+#ifdef CONFIG_SOFT_WATCHDOG_PRETIMEOUT
+#define PRE_TIMER_MARGIN	1		/* Default is 1 seconds */
+static unsigned int soft_pretimeout = PRE_TIMER_MARGIN;	/* in seconds */
+module_param(soft_pretimeout, uint, 0);
+MODULE_PARM_DESC(soft_pretimeout,
+	"Watchdog soft_pretimeout in seconds. (0 < soft_pretimeout < soft_margin, default=1)");
+#endif
+
 static bool nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, bool, 0);
 MODULE_PARM_DESC(nowayout,
@@ -177,6 +185,9 @@ static struct watchdog_device softdog_dev = {
 	.min_timeout = 1,
 	.max_timeout = 65535,
 	.timeout = TIMER_MARGIN,
+#ifdef CONFIG_SOFT_WATCHDOG_PRETIMEOUT
+	.pretimeout = PRE_TIMER_MARGIN,
+#endif
 };
 
 static int __init softdog_init(void)
author
#2 lore raw
Quoted 10 lines · Wang Qing
Quoted 3 lines

Although softdog supports pretimeout, there is no way to set pretimeout, so pretimeout will never be processed in softdog_ping().

This is wrong. The pretimeout can be set using WDIOC_SETPRETIMEOUT, as with every other driver supporting it. There is no need for a module parameter.

Guenter

I saw it, but if I use softdog and enable pretimeout, I hope to get pre processing by default instead of fire. Can we give pretimeout a minimum default value?

Thanks.
Qing wang.

Quoted 40 lines
Quoted 39 lines

Here add the configuration mechanism for pretimeout and the default value is 1 second, so when CONFIG_SOFT_WATCHDOG_PRETIMEOUT is enabled, the pretimeout function defaults available.

---
 drivers/watchdog/softdog.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/watchdog/softdog.c +11 -0
index 7a10962..79e52791
@@ -35,6 +35,14 @@ MODULE_PARM_DESC(soft_margin,
 	"Watchdog soft_margin in seconds. (0 < soft_margin < 65536, default="
 					__MODULE_STRING(TIMER_MARGIN) ")");
 
+#ifdef CONFIG_SOFT_WATCHDOG_PRETIMEOUT
+#define PRE_TIMER_MARGIN	1		/* Default is 1 seconds */
+static unsigned int soft_pretimeout = PRE_TIMER_MARGIN;	/* in seconds */
+module_param(soft_pretimeout, uint, 0);
+MODULE_PARM_DESC(soft_pretimeout,
+	"Watchdog soft_pretimeout in seconds. (0 < soft_pretimeout < soft_margin, default=1)");
+#endif
+
 static bool nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, bool, 0);
 MODULE_PARM_DESC(nowayout,
@@ -177,6 +185,9 @@ static struct watchdog_device softdog_dev = {
 	.min_timeout = 1,
 	.max_timeout = 65535,
 	.timeout = TIMER_MARGIN,
+#ifdef CONFIG_SOFT_WATCHDOG_PRETIMEOUT
+	.pretimeout = PRE_TIMER_MARGIN,
+#endif
 };
 
 static int __init softdog_init(void)