mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: zhaofeng2@cmss.chinamobile.com
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tomer Maimon <tmaimon77@gmail.com>, Joel Stanley <joel@jms.id.au>,
	j.neuschaefer@gmx.net, Triet Hoang <triet.hoang.dev@gmail.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2] watchdog: npcm: fix sleeping clock call in restart handler
Date: Sat, 14 Nov 2026 09:14:46 -0800	[thread overview]
Message-ID: <05036d3e-2d80-4b8b-a99c-cbb896eb3051@roeck-us.net> (raw)
In-Reply-To: <20261111083236.248-1-zhaofeng2@cmss.chinamobile.com>

On Wed, Nov 11, 2026 at 04:32:36PM +0800, zhaofeng2@cmss.chinamobile.com wrote:
> From: Zhao Feng <zhaofeng2@cmss.chinamobile.com>
> 
> The watchdog .restart callback runs in atomic context: it is invoked
> from the restart handler chain via atomic_notifier_call_chain(), under
> an RCU read-side critical section, on every reboot or restart.  Since
> commit af084fdccfaf ("watchdog: npcm: Enable clock if provided"),
> npcm_wdt_restart() calls clk_prepare_enable(), and clk_prepare()
> takes a mutex unconditionally, so kernels built with
> CONFIG_DEBUG_ATOMIC_SLEEP=y report
> 
>   BUG: sleeping function called from invalid context
> 
> on every reboot.  Worse, a panic-time restart can block on
> prepare_lock and never issue the reset at all.
> 
> Get the clock with devm_clk_get_optional_prepared() at probe time and
> keep it prepared for the lifetime of the driver, so the restart
> handler only needs clk_enable(), which is safe in atomic context.
> With the clock permanently prepared, npcm_wdt_start() and
> npcm_wdt_stop() are simplified to clk_enable()/clk_disable() as well.
> 
> Fixes: af084fdccfaf ("watchdog: npcm: Enable clock if provided")
> Cc: stable@vger.kernel.org
> Signed-off-by: Zhao Feng <zhaofeng2@cmss.chinamobile.com>

Applied.

Thanks,
Guenter

      reply	other threads:[~2026-11-14 17:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11  6:41 [PATCH] " zhaofeng2
2026-11-11  8:32 ` [PATCH v2] " zhaofeng2
2026-11-14 17:14   ` 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=05036d3e-2d80-4b8b-a99c-cbb896eb3051@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=j.neuschaefer@gmx.net \
    --cc=joel@jms.id.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tmaimon77@gmail.com \
    --cc=triet.hoang.dev@gmail.com \
    --cc=wim@linux-watchdog.org \
    --cc=zhaofeng2@cmss.chinamobile.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

all inboxes | Powered by JetHome®