devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
To: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
Cc: Ezequiel Garcia
	<ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Jason Gunthorpe
	<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Wim Van Sebroeck <wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.org>,
	Thomas Petazzoni
	<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Gregory Clement
	<gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Lior Amsalem <alior-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
	Sebastian Hesselbarth
	<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
Subject: Re: [PATCH v6 05/19] watchdog: orion: Make sure the watchdog is initially stopped
Date: Fri, 7 Feb 2014 08:55:22 -0800	[thread overview]
Message-ID: <20140207165522.GA9158@roeck-us.net> (raw)
In-Reply-To: <20140207154453.GA8533-u4khhh1J0LxI1Ri9qeTfzeTW4wlIGRCZ@public.gmane.org>

On Fri, Feb 07, 2014 at 10:44:53AM -0500, Jason Cooper wrote:
> On Fri, Feb 07, 2014 at 12:17:28PM -0300, Ezequiel Garcia wrote:
> > On Fri, Feb 07, 2014 at 05:38:09AM -0800, Guenter Roeck wrote:
> > > On 02/07/2014 02:40 AM, Ezequiel Garcia wrote:
> > > > On Thu, Feb 06, 2014 at 06:02:56PM -0800, Guenter Roeck wrote:
> > > >> On 02/06/2014 09:20 AM, Ezequiel Garcia wrote:
> > > >>> Having the watchdog initially fully stopped is important to avoid
> > > >>> any spurious watchdog triggers, in case the registers are not in
> > > >>> its reset state.
> > > >>>
> > > >>> Reviewed-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
> > > >>> Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > > >>> Tested-by: Willy Tarreau <w@1wt.eu>
> > > >>> Signed-off-by: Ezequiel Garcia <ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> > > >>> ---
> > > >>>    drivers/watchdog/orion_wdt.c | 3 +++
> > > >>>    1 file changed, 3 insertions(+)
> > > >>>
> > > >>> diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
> > > >>> index 6746033..2dbeee9 100644
> > > >>> --- a/drivers/watchdog/orion_wdt.c
> > > >>> +++ b/drivers/watchdog/orion_wdt.c
> > > >>> @@ -142,6 +142,9 @@ static int orion_wdt_probe(struct platform_device *pdev)
> > > >>>    	orion_wdt.max_timeout = wdt_max_duration;
> > > >>>    	watchdog_init_timeout(&orion_wdt, heartbeat, &pdev->dev);
> > > >>>
> > > >>> +	/* Let's make sure the watchdog is fully stopped */
> > > >>> +	orion_wdt_stop(&orion_wdt);
> > > >>> +
> > > >>
> > > >> Actually we just had that in another driver, and I stumbled over it there.
> > > >>
> > > >> Problem with stopping the watchdog in probe unconditionally is that you can
> > > >> use it to defeat nowayout: unload the module, then load it again,
> > > >> and the watchdog is stopped even if nowayout is true.
> > > >>
> 
> How often would a user legitimately want to unload/load the watchdog
> module?
> 
Not sure what you are saying here. If you don't think the nowayout option
should be supported, drop it. Don't claim it is supported when it isn't.

> > > >
> > > > Hm... I see.
> > > >
> > > >> Is this really what you want ? Or, in other words, what is the problem
> > > >> you are trying to solve ?
> > > >>
> > > >
> > > > Well, this is related to the discussion about the bootloader not
> > > > reseting the watchdog properly, provoking spurious watchdog triggering.
> > > >
> > > > Jason Gunthorpe explained [1] that we needed a particular sequence:
> > > >
> > > >   1. Disable WDT
> > > >   2. Clear bridge
> > > >   3. Enable WDT
> > > >
> > > > We added the irq handling to satisfy (2), and the watchdog stop for (1).
> > > >
> > > > The watchdog stop was agreed specifically [2].
> > > >
> > > > Ideas?
> > > >
> > > 
> > > Other drivers assume that if the watchdog is running, it is supposed
> > > to be running. The more common approach in such cases is to ping the
> > > watchdog once to give userspace more time to get ready, but leave
> > > it enabled. So you could check if the watchdog is enabled, and if
> > > it was enabled re-enable it after initialization is complete
> > > (and maybe log a message stating that the watchdog is enabled).
> > > 
> > > If you don't want to do that, and if you are defeating nowayout
> > > on purpose to fix a problem with a broken bootloader,
> > > you should at least put in comment describing the problem you are
> > > trying to solve, and that you accept breaking nowayout with your fix.
> 
> Yes, this should be commented.
> 
> > I'm not fond of not having "nowayout" option on our driver, given I'm sure
> > it's a watchdog feature for a good reason.
> > 
> > On the other side, I can't see how can we distinguish a previously
> > and explicitly enabled watchdog, from a spurious enable by broken bootloader.
> 
> How about we just don't define module_exit() and leave a comment as
> such?  It's not unprecedented, a couple of the atm drivers are
> explicitly setup like this (uPD98402.c, zatm.c, eni.c).
> 
Or don't support tristate in the first place. There was some argument from
others earlier that a watchdog should never be optional. Or drop the nowayout
option from the driver.

There is one problem, though, if you don't support a pre-enabled watchdog:
If the system dies before the watchdog application starts running, it will
hang. This is the reason why the watchdog is enabled on purpose by some
boot loaders.

Guenter
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-02-07 16:55 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06 17:20 [PATCH v6 00/19] Armada 370/XP watchdog Ezequiel Garcia
     [not found] ` <1391707226-18258-1-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-02-06 17:20   ` [PATCH v6 01/19] clocksource: orion: Use atomic access for shared registers Ezequiel Garcia
     [not found]     ` <1391707226-18258-2-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-02-11  0:06       ` Daniel Lezcano
     [not found]         ` <52F96993.9090007-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-02-11  8:30           ` Ezequiel Garcia
2014-02-11  9:11             ` Daniel Lezcano
     [not found]               ` <52F9E947.5020004-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-02-11  9:47                 ` Ezequiel Garcia
2014-02-19 15:01                   ` Ezequiel Garcia
2014-02-06 17:20   ` [PATCH v6 02/19] watchdog: orion: Add clock error handling Ezequiel Garcia
2014-02-06 17:20   ` [PATCH v6 03/19] watchdog: orion: Use atomic access for shared registers Ezequiel Garcia
2014-02-06 17:20   ` [PATCH v6 04/19] watchdog: orion: Remove unused macros Ezequiel Garcia
2014-02-06 17:20   ` [PATCH v6 05/19] watchdog: orion: Make sure the watchdog is initially stopped Ezequiel Garcia
     [not found]     ` <1391707226-18258-6-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-02-07  2:02       ` Guenter Roeck
     [not found]         ` <52F43ED0.4050808-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2014-02-07 10:40           ` Ezequiel Garcia
2014-02-07 13:38             ` Guenter Roeck
     [not found]               ` <52F4E1C1.4010805-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2014-02-07 15:17                 ` Ezequiel Garcia
2014-02-07 15:44                   ` Jason Cooper
     [not found]                     ` <20140207154453.GA8533-u4khhh1J0LxI1Ri9qeTfzeTW4wlIGRCZ@public.gmane.org>
2014-02-07 16:55                       ` Guenter Roeck [this message]
2014-02-07 17:43             ` Jason Gunthorpe
     [not found]               ` <20140207174314.GB16263-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2014-02-10 12:22                 ` Ezequiel Garcia
2014-02-10 16:48                   ` linux-0h96xk9xTtrk1uMJSBkQmQ
     [not found]                     ` <20140210104850.48324szjwjihb7cw-S15kz1ZIOvSoVoj5zvVkGw@public.gmane.org>
2014-02-10 16:54                       ` Ezequiel Garcia
2014-02-10 16:57                         ` linux-0h96xk9xTtrk1uMJSBkQmQ
2014-02-06 17:20   ` [PATCH v6 06/19] watchdog: orion: Handle the interrupt so it's properly acked Ezequiel Garcia
2014-02-06 17:20   ` [PATCH v6 07/19] watchdog: orion: Make RSTOUT register a separate resource Ezequiel Garcia
2014-02-06 17:20   ` [PATCH v6 08/19] watchdog: orion: Remove unneeded BRIDGE_CAUSE clear Ezequiel Garcia
2014-02-06 17:20   ` [PATCH v6 09/19] watchdog: orion: Introduce an orion_watchdog device structure Ezequiel Garcia
2014-02-06 17:20   ` [PATCH v6 10/19] watchdog: orion: Introduce per-compatible of_device_id data Ezequiel Garcia
2014-02-06 17:20   ` [PATCH v6 11/19] watchdog: orion: Add per-compatible clock initialization Ezequiel Garcia
2014-02-06 17:20   ` [PATCH v6 12/19] watchdog: orion: Add per-compatible watchdog start implementation Ezequiel Garcia
2014-02-06 17:20   ` [PATCH v6 13/19] watchdog: orion: Add support for Armada 370 and Armada XP SoC Ezequiel Garcia
2014-02-06 17:20   ` [PATCH v6 14/19] ARM: mvebu: Enable Armada 370/XP watchdog in the devicetree Ezequiel Garcia
2014-02-06 17:20   ` [PATCH v6 15/19] ARM: kirkwood: Add RSTOUT 'reg' entry to devicetree Ezequiel Garcia
2014-02-06 17:20   ` [PATCH v6 16/19] ARM: dove: Enable Dove watchdog in the devicetree Ezequiel Garcia
2014-02-06 17:20   ` [PATCH v6 17/19] watchdog: orion: Enable the build on ARCH_MVEBU Ezequiel Garcia
     [not found]     ` <1391707226-18258-18-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-02-07  2:07       ` Guenter Roeck
2014-02-06 17:20   ` [PATCH v6 18/19] ARM: mvebu: Enable watchdog support in defconfig Ezequiel Garcia
     [not found]     ` <1391707226-18258-19-git-send-email-ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-02-06 17:51       ` Jason Cooper
     [not found]         ` <20140206175159.GI8533-u4khhh1J0LxI1Ri9qeTfzeTW4wlIGRCZ@public.gmane.org>
2014-02-06 19:10           ` Ezequiel Garcia
2014-02-06 19:12             ` Jason Cooper
2014-02-06 17:20   ` [PATCH v6 19/19] ARM: dove: Enable watchdog support in the defconfig Ezequiel Garcia

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=20140207165522.GA9158@roeck-us.net \
    --to=linux-0h96xk9xttrk1umjsbkqmq@public.gmane.org \
    --cc=alior-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
    --cc=andrew-g2DYL2Zd6BY@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
    --cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-watchdog-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=wim-IQzOog9fTRqzQB+pC5nmwQ@public.gmane.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).