Linux-Watchdog Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] softdog: make pretimeout available when SOFT_WATCHDOG_PRETIMEOUT enabled
@ 2021-04-06  9:44 Wang Qing
  2021-04-06 13:32 ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Wang Qing @ 2021-04-06  9:44 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, linux-watchdog, linux-kernel; +Cc: Wang Qing

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.

Signed-off-by: Wang Qing <wangqing@vivo.com>
---
 drivers/watchdog/softdog.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c
index 7a10962..79e52791
--- a/drivers/watchdog/softdog.c
+++ b/drivers/watchdog/softdog.c
@@ -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)
-- 
2.7.4


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

* Re: [PATCH] softdog: make pretimeout available when SOFT_WATCHDOG_PRETIMEOUT enabled
  2021-04-06  9:44 [PATCH] softdog: make pretimeout available when SOFT_WATCHDOG_PRETIMEOUT enabled Wang Qing
@ 2021-04-06 13:32 ` Guenter Roeck
  2021-04-10  2:53   ` 王擎
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2021-04-06 13:32 UTC (permalink / raw)
  To: Wang Qing, Wim Van Sebroeck, linux-watchdog, linux-kernel

On 4/6/21 2:44 AM, Wang Qing wrote:
> 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

> 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.
> 
> Signed-off-by: Wang Qing <wangqing@vivo.com>
> ---
>  drivers/watchdog/softdog.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c
> index 7a10962..79e52791
> --- a/drivers/watchdog/softdog.c
> +++ b/drivers/watchdog/softdog.c
> @@ -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)
> 


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

* Re:Re: [PATCH] softdog: make pretimeout available when SOFT_WATCHDOG_PRETIMEOUT enabled
  2021-04-06 13:32 ` Guenter Roeck
@ 2021-04-10  2:53   ` 王擎
  0 siblings, 0 replies; 3+ messages in thread
From: 王擎 @ 2021-04-10  2:53 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel


>On 4/6/21 2:44 AM, Wang Qing wrote:
>> 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.

>> 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.
>> 
>> Signed-off-by: Wang Qing <wangqing@vivo.com>
>> ---
>>  drivers/watchdog/softdog.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>> 
>> diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c
>> index 7a10962..79e52791
>> --- a/drivers/watchdog/softdog.c
>> +++ b/drivers/watchdog/softdog.c
>> @@ -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)
>> 
>



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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06  9:44 [PATCH] softdog: make pretimeout available when SOFT_WATCHDOG_PRETIMEOUT enabled Wang Qing
2021-04-06 13:32 ` Guenter Roeck
2021-04-10  2:53   ` 王擎

Linux-Watchdog Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-watchdog/0 linux-watchdog/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-watchdog linux-watchdog/ https://lore.kernel.org/linux-watchdog \
		linux-watchdog@vger.kernel.org
	public-inbox-index linux-watchdog

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-watchdog


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git