linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3 v3] watchdog: meson_gxbb_wdt: improve
@ 2021-07-29  7:23 Artem Lapkin
  2021-07-29  7:23 ` [PATCH] watchdog: meson_gxbb_wdt: add nowayout parameter Artem Lapkin
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Artem Lapkin @ 2021-07-29  7:23 UTC (permalink / raw)
  To: narmstrong
  Cc: wim, linux, khilman, jbrunet, christianshewitt,
	martin.blumenstingl, linux-watchdog, linux-arm-kernel,
	linux-amlogic, linux-kernel, art, nick, gouwa

Improve meson_gxbb_wdt driver

Source: https://lore.kernel.org/linux-watchdog/5229d62c-b327-254f-800f-1524f27491b3@roeck-us.net/T/
Remade using all suggestions from Guenter

* Added nowayout module parameter
* Added timeout module parameter
* Removed watchdog_stop_on_reboot (I feel that it is important to keep
the watchdog running during the reboot sequence, in the event that an
abnormal driver freezes the reboot process. This is my  personal opinion
and I hope the driver authors will agree with my proposal, if not just
ignore this last commit)

Artem Lapkin (3):
  watchdog: meson_gxbb_wdt: add nowayout parameter
  watchdog: meson_gxbb_wdt: add timeout parameter
  watchdog: meson_gxbb_wdt: remove stop_on_reboot

 drivers/watchdog/meson_gxbb_wdt.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

-- 
2.25.1


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

* [PATCH] watchdog: meson_gxbb_wdt: add nowayout parameter
  2021-07-29  7:23 [PATCH 0/3 v3] watchdog: meson_gxbb_wdt: improve Artem Lapkin
@ 2021-07-29  7:23 ` Artem Lapkin
  2021-07-29  7:23 ` [PATCH] watchdog: meson_gxbb_wdt: add timeout parameter Artem Lapkin
  2021-07-29  7:23 ` [PATCH] watchdog: meson_gxbb_wdt: remove stop_on_reboot Artem Lapkin
  2 siblings, 0 replies; 7+ messages in thread
From: Artem Lapkin @ 2021-07-29  7:23 UTC (permalink / raw)
  To: narmstrong
  Cc: wim, linux, khilman, jbrunet, christianshewitt,
	martin.blumenstingl, linux-watchdog, linux-arm-kernel,
	linux-amlogic, linux-kernel, art, nick, gouwa

Add nowayout module parameter

Signed-off-by: Artem Lapkin <art@khadas.com>
---
 drivers/watchdog/meson_gxbb_wdt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/watchdog/meson_gxbb_wdt.c b/drivers/watchdog/meson_gxbb_wdt.c
index 5a9ca10fb..5aebc3a09 100644
--- a/drivers/watchdog/meson_gxbb_wdt.c
+++ b/drivers/watchdog/meson_gxbb_wdt.c
@@ -29,6 +29,11 @@
 #define GXBB_WDT_TCNT_SETUP_MASK		(BIT(16) - 1)
 #define GXBB_WDT_TCNT_CNT_SHIFT			16
 
+static bool nowayout = WATCHDOG_NOWAYOUT;
+module_param(nowayout, bool, 0);
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started default="
+		 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+
 struct meson_gxbb_wdt {
 	void __iomem *reg_base;
 	struct watchdog_device wdt_dev;
@@ -175,6 +180,7 @@ static int meson_gxbb_wdt_probe(struct platform_device *pdev)
 	data->wdt_dev.max_hw_heartbeat_ms = GXBB_WDT_TCNT_SETUP_MASK;
 	data->wdt_dev.min_timeout = 1;
 	data->wdt_dev.timeout = DEFAULT_TIMEOUT;
+	watchdog_set_nowayout(&data->wdt_dev, nowayout);
 	watchdog_set_drvdata(&data->wdt_dev, data);
 
 	/* Setup with 1ms timebase */
-- 
2.25.1


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

* [PATCH] watchdog: meson_gxbb_wdt: add timeout parameter
  2021-07-29  7:23 [PATCH 0/3 v3] watchdog: meson_gxbb_wdt: improve Artem Lapkin
  2021-07-29  7:23 ` [PATCH] watchdog: meson_gxbb_wdt: add nowayout parameter Artem Lapkin
@ 2021-07-29  7:23 ` Artem Lapkin
  2021-07-29 14:14   ` Guenter Roeck
  2021-07-29  7:23 ` [PATCH] watchdog: meson_gxbb_wdt: remove stop_on_reboot Artem Lapkin
  2 siblings, 1 reply; 7+ messages in thread
From: Artem Lapkin @ 2021-07-29  7:23 UTC (permalink / raw)
  To: narmstrong
  Cc: wim, linux, khilman, jbrunet, christianshewitt,
	martin.blumenstingl, linux-watchdog, linux-arm-kernel,
	linux-amlogic, linux-kernel, art, nick, gouwa

Add timeout module parameter

Signed-off-by: Artem Lapkin <art@khadas.com>
---
 drivers/watchdog/meson_gxbb_wdt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/watchdog/meson_gxbb_wdt.c b/drivers/watchdog/meson_gxbb_wdt.c
index 5aebc3a09..3f3866878 100644
--- a/drivers/watchdog/meson_gxbb_wdt.c
+++ b/drivers/watchdog/meson_gxbb_wdt.c
@@ -34,6 +34,11 @@ module_param(nowayout, bool, 0);
 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started default="
 		 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
+static unsigned int timeout = DEFAULT_TIMEOUT;
+module_param(timeout, uint, 0);
+MODULE_PARM_DESC(timeout, "Watchdog heartbeat in seconds="
+		 __MODULE_STRING(DEFAULT_TIMEOUT) ")");
+
 struct meson_gxbb_wdt {
 	void __iomem *reg_base;
 	struct watchdog_device wdt_dev;
@@ -180,6 +185,7 @@ static int meson_gxbb_wdt_probe(struct platform_device *pdev)
 	data->wdt_dev.max_hw_heartbeat_ms = GXBB_WDT_TCNT_SETUP_MASK;
 	data->wdt_dev.min_timeout = 1;
 	data->wdt_dev.timeout = DEFAULT_TIMEOUT;
+	watchdog_init_timeout(&data->wdt_dev, timeout, dev);
 	watchdog_set_nowayout(&data->wdt_dev, nowayout);
 	watchdog_set_drvdata(&data->wdt_dev, data);
 
-- 
2.25.1


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

* [PATCH] watchdog: meson_gxbb_wdt: remove stop_on_reboot
  2021-07-29  7:23 [PATCH 0/3 v3] watchdog: meson_gxbb_wdt: improve Artem Lapkin
  2021-07-29  7:23 ` [PATCH] watchdog: meson_gxbb_wdt: add nowayout parameter Artem Lapkin
  2021-07-29  7:23 ` [PATCH] watchdog: meson_gxbb_wdt: add timeout parameter Artem Lapkin
@ 2021-07-29  7:23 ` Artem Lapkin
  2021-07-29 14:23   ` Guenter Roeck
  2 siblings, 1 reply; 7+ messages in thread
From: Artem Lapkin @ 2021-07-29  7:23 UTC (permalink / raw)
  To: narmstrong
  Cc: wim, linux, khilman, jbrunet, christianshewitt,
	martin.blumenstingl, linux-watchdog, linux-arm-kernel,
	linux-amlogic, linux-kernel, art, nick, gouwa

Remove watchdog_stop_on_reboot()

Signed-off-by: Artem Lapkin <art@khadas.com>
---
 drivers/watchdog/meson_gxbb_wdt.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/watchdog/meson_gxbb_wdt.c b/drivers/watchdog/meson_gxbb_wdt.c
index 3f3866878..cafc6cdc0 100644
--- a/drivers/watchdog/meson_gxbb_wdt.c
+++ b/drivers/watchdog/meson_gxbb_wdt.c
@@ -198,7 +198,6 @@ static int meson_gxbb_wdt_probe(struct platform_device *pdev)
 
 	meson_gxbb_wdt_set_timeout(&data->wdt_dev, data->wdt_dev.timeout);
 
-	watchdog_stop_on_reboot(&data->wdt_dev);
 	return devm_watchdog_register_device(dev, &data->wdt_dev);
 }
 
-- 
2.25.1


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

* Re: [PATCH] watchdog: meson_gxbb_wdt: add timeout parameter
  2021-07-29  7:23 ` [PATCH] watchdog: meson_gxbb_wdt: add timeout parameter Artem Lapkin
@ 2021-07-29 14:14   ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2021-07-29 14:14 UTC (permalink / raw)
  To: Artem Lapkin, narmstrong
  Cc: wim, khilman, jbrunet, christianshewitt, martin.blumenstingl,
	linux-watchdog, linux-arm-kernel, linux-amlogic, linux-kernel,
	art, nick, gouwa

On 7/29/21 12:23 AM, Artem Lapkin wrote:
> Add timeout module parameter
> 
> Signed-off-by: Artem Lapkin <art@khadas.com>
> ---
>   drivers/watchdog/meson_gxbb_wdt.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/watchdog/meson_gxbb_wdt.c b/drivers/watchdog/meson_gxbb_wdt.c
> index 5aebc3a09..3f3866878 100644
> --- a/drivers/watchdog/meson_gxbb_wdt.c
> +++ b/drivers/watchdog/meson_gxbb_wdt.c
> @@ -34,6 +34,11 @@ module_param(nowayout, bool, 0);
>   MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started default="
>   		 __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
>   
> +static unsigned int timeout = DEFAULT_TIMEOUT;

DEFAULT_TIMEOUT is already set below. The default for the module parameter
should be 0. This way the watchdog core takes the value from devicetree
unless a module parameter is provided.

Guenter

> +module_param(timeout, uint, 0);
> +MODULE_PARM_DESC(timeout, "Watchdog heartbeat in seconds="
> +		 __MODULE_STRING(DEFAULT_TIMEOUT) ")");
> +
>   struct meson_gxbb_wdt {
>   	void __iomem *reg_base;
>   	struct watchdog_device wdt_dev;
> @@ -180,6 +185,7 @@ static int meson_gxbb_wdt_probe(struct platform_device *pdev)
>   	data->wdt_dev.max_hw_heartbeat_ms = GXBB_WDT_TCNT_SETUP_MASK;
>   	data->wdt_dev.min_timeout = 1;
>   	data->wdt_dev.timeout = DEFAULT_TIMEOUT;
> +	watchdog_init_timeout(&data->wdt_dev, timeout, dev);
>   	watchdog_set_nowayout(&data->wdt_dev, nowayout);
>   	watchdog_set_drvdata(&data->wdt_dev, data);
>   
> 


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

* Re: [PATCH] watchdog: meson_gxbb_wdt: remove stop_on_reboot
  2021-07-29  7:23 ` [PATCH] watchdog: meson_gxbb_wdt: remove stop_on_reboot Artem Lapkin
@ 2021-07-29 14:23   ` Guenter Roeck
  2021-07-30  2:09     ` Art Nikpal
  0 siblings, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2021-07-29 14:23 UTC (permalink / raw)
  To: Artem Lapkin, narmstrong
  Cc: wim, khilman, jbrunet, christianshewitt, martin.blumenstingl,
	linux-watchdog, linux-arm-kernel, linux-amlogic, linux-kernel,
	art, nick, gouwa

On 7/29/21 12:23 AM, Artem Lapkin wrote:
> Remove watchdog_stop_on_reboot()
> 

This warrants a much longer explanation to even be considered.
Your explanation/reasoning needs to be here. Others won't have
the benefit of reading the summary e-mail, even more so since
you declined to number and sequence the series.

Personally' I don't find it acceptable, but I'll be happy to
listen to input from others. Such changes should be based on
real problems, not on personal opinions. If we accept this patch,
someone else might come in later reverting it with the personal
opinion that some reboots take longer than the watchdog timeout.

Guenter

> Signed-off-by: Artem Lapkin <art@khadas.com>
> ---
>   drivers/watchdog/meson_gxbb_wdt.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/watchdog/meson_gxbb_wdt.c b/drivers/watchdog/meson_gxbb_wdt.c
> index 3f3866878..cafc6cdc0 100644
> --- a/drivers/watchdog/meson_gxbb_wdt.c
> +++ b/drivers/watchdog/meson_gxbb_wdt.c
> @@ -198,7 +198,6 @@ static int meson_gxbb_wdt_probe(struct platform_device *pdev)
>   
>   	meson_gxbb_wdt_set_timeout(&data->wdt_dev, data->wdt_dev.timeout);
>   
> -	watchdog_stop_on_reboot(&data->wdt_dev);
>   	return devm_watchdog_register_device(dev, &data->wdt_dev);
>   }
>   
> 


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

* Re: [PATCH] watchdog: meson_gxbb_wdt: remove stop_on_reboot
  2021-07-29 14:23   ` Guenter Roeck
@ 2021-07-30  2:09     ` Art Nikpal
  0 siblings, 0 replies; 7+ messages in thread
From: Art Nikpal @ 2021-07-30  2:09 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Neil Armstrong, wim, Kevin Hilman, Jerome Brunet,
	Christian Hewitt, Martin Blumenstingl, linux-watchdog,
	linux-arm-kernel, open list:ARM/Amlogic Meson...,
	LKML, Artem Lapkin, Nick Xie, Gouwa Wang

Yes i totally agree with you , i will rewrite this patches again
properly and explain more detail about why need remove
watchdog_stop_on_reboot

i have check already other watchdog sources / half of them have
watchdog_stop_on_reboot another half dont have it , and i think both
have some reasons

> I'll be happy tolisten to input from others.

Same will be happy.

Our situation very simple - meson platform still have some hardware
drivers problems for some configuration which can freeze device on
shutdown/reboot stage and i hope better to have some reboot warranty

> some reboots take longer than the watchdog timeout.
I have check this situation to - our drivers shutdown stage its about
1 sec default watchdog timeout 30 sec i think its enough - cant see
any problem
anybody can use watchdog.stop_on_reboot=1 if need freeze identification.

Artem

On Thu, Jul 29, 2021 at 10:23 PM Guenter Roeck <linux@roeck-us.net> wrote:
>
> On 7/29/21 12:23 AM, Artem Lapkin wrote:
> > Remove watchdog_stop_on_reboot()
> >
>
> This warrants a much longer explanation to even be considered.
> Your explanation/reasoning needs to be here. Others won't have
> the benefit of reading the summary e-mail, even more so since
> you declined to number and sequence the series.
>
> Personally' I don't find it acceptable, but I'll be happy to
> listen to input from others. Such changes should be based on
> real problems, not on personal opinions. If we accept this patch,
> someone else might come in later reverting it with the personal
> opinion that some reboots take longer than the watchdog timeout.
>
> Guenter
>
> > Signed-off-by: Artem Lapkin <art@khadas.com>
> > ---
> >   drivers/watchdog/meson_gxbb_wdt.c | 1 -
> >   1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/watchdog/meson_gxbb_wdt.c b/drivers/watchdog/meson_gxbb_wdt.c
> > index 3f3866878..cafc6cdc0 100644
> > --- a/drivers/watchdog/meson_gxbb_wdt.c
> > +++ b/drivers/watchdog/meson_gxbb_wdt.c
> > @@ -198,7 +198,6 @@ static int meson_gxbb_wdt_probe(struct platform_device *pdev)
> >
> >       meson_gxbb_wdt_set_timeout(&data->wdt_dev, data->wdt_dev.timeout);
> >
> > -     watchdog_stop_on_reboot(&data->wdt_dev);
> >       return devm_watchdog_register_device(dev, &data->wdt_dev);
> >   }
> >
> >
>

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

end of thread, other threads:[~2021-07-30  2:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29  7:23 [PATCH 0/3 v3] watchdog: meson_gxbb_wdt: improve Artem Lapkin
2021-07-29  7:23 ` [PATCH] watchdog: meson_gxbb_wdt: add nowayout parameter Artem Lapkin
2021-07-29  7:23 ` [PATCH] watchdog: meson_gxbb_wdt: add timeout parameter Artem Lapkin
2021-07-29 14:14   ` Guenter Roeck
2021-07-29  7:23 ` [PATCH] watchdog: meson_gxbb_wdt: remove stop_on_reboot Artem Lapkin
2021-07-29 14:23   ` Guenter Roeck
2021-07-30  2:09     ` Art Nikpal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).