linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: luanshi <zhangliguang@linux.alibaba.com>,
	Wim Van Sebroeck <wim@linux-watchdog.org>
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watchdog: sbsa_gwdt: disable watchdog when system panic was trigged by signal WS0
Date: Mon, 2 Mar 2020 06:19:44 -0800	[thread overview]
Message-ID: <9018b040-d958-4745-e2b9-a9a6c75dd4e5@roeck-us.net> (raw)
In-Reply-To: <1583138781-40936-1-git-send-email-zhangliguang@linux.alibaba.com>

On 3/2/20 12:46 AM, luanshi wrote:
> When ARM SBSA Generic Watchdog worked in the two stages mode by setting
> module parameter action to 1, when the timeout is reached, the first
> signal (WS0) will trigger panic. Before panic, the value of register
> SBSA_GWDT_WCS was 0x0, after panic and system startup, the value of
> register SBSA_GWDT_WCS was 0x7, status bits SBSA_GWDT_WCS_EN
> SBSA_GWDT_WCS_WS0 and SBSA_GWDT_WCS_WS1 were set, this will increase the
> refcnt of module sbsa_gwdt by function watchdog_cdev_register because
> flag WDOG_HW_RUNNING was set, so we cannot unload the module again. To be
> consistent with reboot, watchdog should be disabled when system panic was
> trigged by signal(WS0).
> 
> Signed-off-by: Liguang Zhang <zhangliguang@linux.alibaba.com>
> ---
>  drivers/watchdog/sbsa_gwdt.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
> index f0f1e3b..6bee5bb 100644
> --- a/drivers/watchdog/sbsa_gwdt.c
> +++ b/drivers/watchdog/sbsa_gwdt.c
> @@ -194,6 +194,12 @@ static int sbsa_gwdt_stop(struct watchdog_device *wdd)
>  
>  static irqreturn_t sbsa_gwdt_interrupt(int irq, void *dev_id)
>  {
> +	struct sbsa_gwdt *gwdt = (struct sbsa_gwdt *)dev_id;
> +	struct watchdog_device *wdd = &gwdt->wdd;
> +
> +	if (wdd->ops->stop)
> +		wdd->ops->stop(wdd);
> +
>  	panic(WATCHDOG_NAME " timeout");
>  
>  	return IRQ_HANDLED;
> 

This prevents the 2nd stage (the actual system reset) from working if the panic
call gets stuck and doesn't result in a reboot. I don't think it is a good idea
to do that. It effectively disables the second stage.

Ultimately, this is a bios problem; the bios/rommon should have stopped
the watchdog when rebooting. If you don't want the watchdog to run on startup,
you have to add a module parameter to disable the watchdog if it is running
at probe time.

Guenter

      reply	other threads:[~2020-03-02 14:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-02  8:46 [PATCH] watchdog: sbsa_gwdt: disable watchdog when system panic was trigged by signal WS0 luanshi
2020-03-02 14:19 ` 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=9018b040-d958-4745-e2b9-a9a6c75dd4e5@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=wim@linux-watchdog.org \
    --cc=zhangliguang@linux.alibaba.com \
    /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).