linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] watchdog: imx_sc_wdt: Fix reboot on crash
@ 2020-04-12 23:01 Fabio Estevam
  2020-04-13  0:17 ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2020-04-12 23:01 UTC (permalink / raw)
  To: linux; +Cc: wim, linux-imx, linux-watchdog, brenomatheus, Fabio Estevam, stable

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.

Cc: <stable@vger.kernel.org>
Fixes: 986857acbc9a ("watchdog: imx_sc: Add i.MX system controller watchdog support")
Reported-by: Breno Lima <breno.lima@nxp.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
 drivers/watchdog/imx_sc_wdt.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/watchdog/imx_sc_wdt.c b/drivers/watchdog/imx_sc_wdt.c
index 60a32469f7de..e9ee22a7cb45 100644
--- a/drivers/watchdog/imx_sc_wdt.c
+++ b/drivers/watchdog/imx_sc_wdt.c
@@ -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);
 
-- 
2.17.1


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

* Re: [PATCH] watchdog: imx_sc_wdt: Fix reboot on crash
  2020-04-12 23:01 [PATCH] watchdog: imx_sc_wdt: Fix reboot on crash Fabio Estevam
@ 2020-04-13  0:17 ` Guenter Roeck
  2020-04-13 13:19   ` Breno Matheus Lima
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2020-04-13  0:17 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: wim, linux-imx, linux-watchdog, brenomatheus, stable

On 4/12/20 4:01 PM, Fabio Estevam wrote:
> 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.
> 
> Cc: <stable@vger.kernel.org>
> Fixes: 986857acbc9a ("watchdog: imx_sc: Add i.MX system controller watchdog support")
> Reported-by: Breno Lima <breno.lima@nxp.com>
> Signed-off-by: Fabio Estevam <festevam@gmail.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/imx_sc_wdt.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/watchdog/imx_sc_wdt.c b/drivers/watchdog/imx_sc_wdt.c
> index 60a32469f7de..e9ee22a7cb45 100644
> --- a/drivers/watchdog/imx_sc_wdt.c
> +++ b/drivers/watchdog/imx_sc_wdt.c
> @@ -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);
>  
> 


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

* Re: [PATCH] watchdog: imx_sc_wdt: Fix reboot on crash
  2020-04-13  0:17 ` Guenter Roeck
@ 2020-04-13 13:19   ` Breno Matheus Lima
  0 siblings, 0 replies; 3+ messages in thread
From: Breno Matheus Lima @ 2020-04-13 13:19 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Fabio Estevam, wim, linux-imx, linux-watchdog, stable

Hi Fabio,

Em dom., 12 de abr. de 2020 às 20:17, Guenter Roeck
<linux@roeck-us.net> escreveu:
>
> On 4/12/20 4:01 PM, Fabio Estevam wrote:
> > 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.
> >
> > Cc: <stable@vger.kernel.org>
> > Fixes: 986857acbc9a ("watchdog: imx_sc: Add i.MX system controller watchdog support")
> > Reported-by: Breno Lima <breno.lima@nxp.com>
> > Signed-off-by: Fabio Estevam <festevam@gmail.com>
>
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>

Thanks for the fix.

Tested-by: Breno Lima <breno.lima@nxp.com>

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

end of thread, other threads:[~2020-04-13 13:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-12 23:01 [PATCH] watchdog: imx_sc_wdt: Fix reboot on crash Fabio Estevam
2020-04-13  0:17 ` Guenter Roeck
2020-04-13 13:19   ` Breno Matheus Lima

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).