Skip to contentSkip to conversation

watchdog: imx_sc_wdt: Fix reboot on crash

PATCH In review Fabio Estevam 3 participants 3 messages Apr 12, 2020 – Apr 13, 2020

Subsystems (3)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/1 watchdog: imx_sc_wdt: Fix reboot on crash

Currently when running the samples/watchdog/watchdog-simple.c application and forcing a kernel crash by doing:

# ./watchdog-simple &
# echo c > /proc/sysrq-trigger

The system does not reboot as expected.

Fix it by calling imx_sc_wdt_set_timeout() to configure the i.MX8QXP watchdog with a proper timeout.

Fixes 986857acbc9a ("watchdog: imx_sc: Add i.MX system controller watchdog support")
---
 drivers/watchdog/imx_sc_wdt.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/watchdog/imx_sc_wdt.c +5 -0
index 60a32469f7de..e9ee22a7cb45 100644
@@ -175,6 +175,11 @@ static int imx_sc_wdt_probe(struct platform_device *pdev)
 	wdog->timeout = DEFAULT_TIMEOUT;
 
 	watchdog_init_timeout(wdog, 0, dev);
+
+	ret = imx_sc_wdt_set_timeout(wdog, wdog->timeout);
+	if (ret)
+		return ret;
+
 	watchdog_stop_on_reboot(wdog);
 	watchdog_stop_on_unregister(wdog);
 
Signature · 1 line
2.17.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Fabio Estevam

Currently when running the samples/watchdog/watchdog-simple.c application and forcing a kernel crash by doing:

# ./watchdog-simple &
# echo c > /proc/sysrq-trigger

The system does not reboot as expected.

Quoted 7 lines

Fix it by calling imx_sc_wdt_set_timeout() to configure the i.MX8QXP watchdog with a proper timeout.

Fixes 986857acbc9a ("watchdog: imx_sc: Add i.MX system controller watchdog support")
Quoted 21 lines
---
 drivers/watchdog/imx_sc_wdt.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/watchdog/imx_sc_wdt.c +5 -0
index 60a32469f7de..e9ee22a7cb45 100644
@@ -175,6 +175,11 @@ static int imx_sc_wdt_probe(struct platform_device *pdev)
 	wdog->timeout = DEFAULT_TIMEOUT;
 
 	watchdog_init_timeout(wdog, 0, dev);
+
+	ret = imx_sc_wdt_set_timeout(wdog, wdog->timeout);
+	if (ret)
+		return ret;
+
 	watchdog_stop_on_reboot(wdog);
 	watchdog_stop_on_unregister(wdog);
 
Tested-by Breno Lima
#2 lore raw

Hi Fabio,

Em dom., 12 de abr. de 2020 às 20:17, Guenter Roeck <[email protected]> escreveu:

Quoted 13 lines · Fabio Estevam
Quoted 11 lines

Currently when running the samples/watchdog/watchdog-simple.c application and forcing a kernel crash by doing:

# ./watchdog-simple &
# echo c > /proc/sysrq-trigger

The system does not reboot as expected.

Fix it by calling imx_sc_wdt_set_timeout() to configure the i.MX8QXP watchdog with a proper timeout.

Quoted 6 lines
Quoted 4 lines
Fixes 986857acbc9a ("watchdog: imx_sc: Add i.MX system controller watchdog support")

Thanks for the fix.