From: Guenter Roeck <linux@roeck-us.net>
To: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watchdog: gpio_wdt: set WDOG_HW_RUNNING in gpio_wdt_stop
Date: Thu, 9 Nov 2017 08:09:09 -0800 [thread overview]
Message-ID: <20171109160909.GD19959@roeck-us.net> (raw)
In-Reply-To: <1510234795-25881-1-git-send-email-rasmus.villemoes@prevas.dk>
On Thu, Nov 09, 2017 at 02:39:55PM +0100, Rasmus Villemoes wrote:
> The first patch above (https://patchwork.kernel.org/patch/9970181/)
> makes the oops go away, but it just papers over the problem. The real
> problem is that the watchdog core clears WDOG_HW_RUNNING in
> watchdog_stop, and the gpio driver fails to set it in its stop
> function when it doesn't actually stop it. This means that the core
> doesn't know that it now has responsibility for petting the device, in
> turn causing the device to reset the system (I hadn't noticed this
> because the board I'm working on has that reset logic disabled).
>
> How about this (other drivers may of course have the same problem, I
> haven't checked). One might say that ->stop should return an error
> when the device can't be stopped, but OTOH this brings parity between
> a device without a ->stop method and a GPIO wd that has always-running
> set. IOW, I think ->stop should only return an error when an actual
> attempt to stop the hardware failed.
>
Agreed.
> From: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
>
> The watchdog framework clears WDOG_HW_RUNNING before calling
> ->stop. If the driver is unable to stop the device, it is supposed to
> set that bit again so that the watchdog core takes care of sending
> heart-beats while the device is not open from user-space. Update the
> gpio_wdt driver to honour that contract (and get rid of the redundant
> clearing of WDOG_HW_RUNNING).
>
> Fixes: 3c10bbde10 ("watchdog: core: Clear WDOG_HW_RUNNING before calling the stop function")
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> ---
> drivers/watchdog/gpio_wdt.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c
> index cb66c2f..7a6279d 100644
> --- a/drivers/watchdog/gpio_wdt.c
> +++ b/drivers/watchdog/gpio_wdt.c
> @@ -80,7 +80,8 @@ static int gpio_wdt_stop(struct watchdog_device *wdd)
>
> if (!priv->always_running) {
> gpio_wdt_disable(priv);
> - clear_bit(WDOG_HW_RUNNING, &wdd->status);
> + } else {
> + set_bit(WDOG_HW_RUNNING, &wdd->status);
> }
{ } are now unnecessary. otherwise
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
>
> return 0;
> --
> 2.7.4
>
prev parent reply other threads:[~2017-11-09 16:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-08 13:26 oops with 4.14-rc8 when opening and closing /dev/watchdog0 Rasmus Villemoes
2017-11-08 18:15 ` Guenter Roeck
2017-11-09 13:39 ` [PATCH] watchdog: gpio_wdt: set WDOG_HW_RUNNING in gpio_wdt_stop Rasmus Villemoes
2017-11-09 16:09 ` Guenter Roeck [this message]
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=20171109160909.GD19959@roeck-us.net \
--to=linux@roeck-us.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=rasmus.villemoes@prevas.dk \
/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