Skip to contentSkip to conversation

watchdog: meson_gxbb_wdt: improve

PATCH Superseded Artem Lapkin 2 participants 7 messages Jul 29, 2021 – Jul 30, 2021

Subsystems (2)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover watchdog: meson_gxbb_wdt: improve

Improve meson_gxbb_wdt driver

Source: https://lore.kernel.org/linux-watchdog/[email protected]/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(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 watchdog: meson_gxbb_wdt: add nowayout parameter

Add nowayout module parameter

---
 drivers/watchdog/meson_gxbb_wdt.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/watchdog/meson_gxbb_wdt.c +6 -0
index 5a9ca10fb..5aebc3a09 100644
@@ -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 */
Signature · 1 line
2.25.1
#2 lore raw

PATCH 1/1 watchdog: meson_gxbb_wdt: add timeout parameter

In reply to Artem Lapkin

Add timeout module parameter

---
 drivers/watchdog/meson_gxbb_wdt.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/watchdog/meson_gxbb_wdt.c +6 -0
index 5aebc3a09..3f3866878 100644
@@ -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);
 
Signature · 1 line
2.25.1
maintainer
#3 lore raw

Re: [PATCH] watchdog: meson_gxbb_wdt: add timeout parameter

Quoted 12 lines · Artem Lapkin

Add timeout module parameter

---
  drivers/watchdog/meson_gxbb_wdt.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/watchdog/meson_gxbb_wdt.c +0 -0
index 5aebc3a09..3f3866878 100644

drivers/watchdog/meson_gxbb_wdt.c module_param(nowayout, bool, 0); · line 37

Quoted 4 lines
drivers/watchdog/meson_gxbb_wdt.c +1 -0
@@ -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

Quoted 9 lines
drivers/watchdog/meson_gxbb_wdt.c +4 -0
+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;

drivers/watchdog/meson_gxbb_wdt.c static int meson_gxbb_wdt_probe(struct platform_device *pdev) · line 191

Quoted 7 lines
drivers/watchdog/meson_gxbb_wdt.c +1 -0
@@ -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);
 

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#4 lore raw

PATCH 1/1 watchdog: meson_gxbb_wdt: remove stop_on_reboot

In reply to Artem Lapkin

Remove watchdog_stop_on_reboot()

---
 drivers/watchdog/meson_gxbb_wdt.c | 1 -
 1 file changed, 1 deletion(-)
drivers/watchdog/meson_gxbb_wdt.c +0 -1
index 3f3866878..cafc6cdc0 100644
@@ -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);
 }
 
Signature · 1 line
2.25.1
maintainer
#5 lore raw

Re: [PATCH] watchdog: meson_gxbb_wdt: remove stop_on_reboot

Quoted 2 lines · Artem Lapkin

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

Quoted 18 lines
---
  drivers/watchdog/meson_gxbb_wdt.c | 1 -
  1 file changed, 1 deletion(-)
drivers/watchdog/meson_gxbb_wdt.c +0 -1
index 3f3866878..cafc6cdc0 100644
@@ -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);
  }
 
author
#6 lore raw

Re: [PATCH] watchdog: meson_gxbb_wdt: remove stop_on_reboot

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

Quoted 1 line

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

Quoted 1 line

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

Quoted 37 lines · Guenter Roeck
Quoted 2 lines · Artem Lapkin

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

Quoted 18 lines
---
  drivers/watchdog/meson_gxbb_wdt.c | 1 -
  1 file changed, 1 deletion(-)
drivers/watchdog/meson_gxbb_wdt.c +0 -1
index 3f3866878..cafc6cdc0 100644
@@ -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);
  }