linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Guenter Roeck <linux@roeck-us.net>
Cc: devicetree@vger.kernel.org, linux-watchdog@vger.kernel.org,
	Rob Herring <robh+dt@kernel.org>,
	kernel@pengutronix.de, Wim Van Sebroeck <wim@linux-watchdog.org>,
	Frank Rowand <frowand.list@gmail.com>
Subject: Re: [RFC] Using a watchdog as system reset
Date: Wed, 7 Oct 2020 09:12:22 +0200	[thread overview]
Message-ID: <20201007071222.pnftcuezlricotq3@pengutronix.de> (raw)
In-Reply-To: <c989af68-fa7b-e6cb-9306-a5f2e196fb20@roeck-us.net>

[-- Attachment #1: Type: text/plain, Size: 3923 bytes --]

Hello Guenter,

On Tue, Oct 06, 2020 at 02:04:10PM -0700, Guenter Roeck wrote:
> On 10/6/20 11:41 AM, Uwe Kleine-König wrote:
> > Hello Guenter,
> > 
> > On Tue, Oct 06, 2020 at 07:29:11AM -0700, Guenter Roeck wrote:
> >> On 10/6/20 4:56 AM, Guenter Roeck wrote:
> >>> On 10/6/20 3:29 AM, Uwe Kleine-König wrote:
> >>>> Hello,
> >>>>
> >>>> I have an i.MX25 system here with an external watchdog (using the
> >>>> gpio_wdt driver). So the internal watchdog (imx2_wdt) is unused.
> >>>>
> >>>> The problem with the unused imx2_wdt is that this usually provides the
> >>>> restart handler and now a reboot ends with
> >>>>
> >>>> 	reboot: Restarting system
> >>>> 	Reboot failed -- System halted
> >>>>
> >>>> until eventually the watchdog bites and resets the machine.
> >>>>
> >>>> I imagine that this is a common enough issue to warrant a generic
> >>>> solution. My suggestion is to formalize and implement something like:
> >>>>
> >>>> 	watchdog {
> >>>> 		compatible = "linux,wdt-gpio";
> >>>> 		...
> >>>> 		provide-system-reset;
> >>>> 	}
> >>>>
> >>>> with the sematic of: "This is the dedicated mechanism to reset this
> >>>> machine."
> >>>>
> >>>
> >>> Some systems have more than one means to reset it, which is why
> >>> restart handlers have a priority. This in turn suggests that we should
> >>> maybe have a means to set that priority dynamically for the imx2_wdt driver
> >>> (or for watchdog drivers in general) instead of having it fixed at 128.
> >>> That would also solve your problem, assuming there is a different
> >>> (currently lower priority) means to reset the hardware in your system.
> >>>
> >>> Alternatively, can't you just blacklist the imx2-wdt driver ?
> >>
> >> After having another couple hours of sleep and a coffee, I wonder if
> >> this is already done, and the reboot just fails _because_ the imx2_wdt
> >> is _not_ loaded. Is that the case ?
> > 
> > Right, I disabled the imx2_wdt driver.
> >  
> >> If so, it looks like you want the reset functionality of the imx_wdt driver
> >> but not its watchdog functionality.
> > 
> > My thought was to use the gpio-watchdog as reset source, but using the
> > imx-watchdog only for reset but not watchdog is an obvious alternative I
> > didn't think about.
>
> It isn't really something I would have thought to ever be relevant: If
> a watchdog can be used to reset the system, and that method to reset
> the system is known to work and supposed to be used, why not use it as
> system watchdog ? So that use case is quite odd, especially since the
> watchdog on that system can apparently be used to trigger an external
> pin.

The motivation to use the external watchdog is that access to the MRAM
only works if the external watchdog is active. And (if I'm well
informed) this external watchdog was introduced because of some
regulation stuff where it must be guaranteed that there is a watchdog.
With an external watchdog this is much easier to do than with an SoC
internal one.

And then because using two watchdogs is ugly disabling the internal one
was straight forward even though it works just fine (apart from enabling
access to the MRAM).

> If we assume that there was a reason for not using the SoC watchdog,
> we must also assume that using it to reset the system does not really
> work (otherwise, what would be the point of having a separate gpio
> based watchdog in that system ?).
> 
> With that in mind, your other option kind of makes sense. The only
> question would be how to express this in devicetree. I am certainly
> open to accepting a patch introducing such a property/functionality
> into the watchdog core.

OK, will try to come up with a patch.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-10-07  7:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-06 10:29 [RFC] Using a watchdog as system reset Uwe Kleine-König
2020-10-06 11:56 ` Guenter Roeck
2020-10-06 14:29   ` Guenter Roeck
2020-10-06 18:41     ` Uwe Kleine-König
2020-10-06 21:04       ` Guenter Roeck
2020-10-07  7:12         ` Uwe Kleine-König [this message]
2020-10-07  7:25           ` Ahmad Fatoum
2020-10-07  7:32             ` Ahmad Fatoum
2020-10-07 10:18             ` dt-binding to define default watchdog and machine reset (Was: Re: [RFC] Using a watchdog as system reset) Uwe Kleine-König
2020-10-07 11:04               ` Guenter Roeck
2020-10-07 11:35                 ` Ahmad Fatoum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201007071222.pnftcuezlricotq3@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh+dt@kernel.org \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).