From: sashiko-bot@kernel.org
To: "Rustam Adilov" <adilov@disroot.org>
Cc: linux-watchdog@vger.kernel.org, conor+dt@kernel.org,
devicetree@vger.kernel.org, robh@kernel.org, krzk+dt@kernel.org
Subject: Re: [PATCH 1/3] watchdog: realtek-otto: Change to use regmap API
Date: Sat, 09 May 2026 17:16:01 +0000 [thread overview]
Message-ID: <20260509171602.6B74FC2BCB2@smtp.kernel.org> (raw)
In-Reply-To: <20260509163101.722793-2-adilov@disroot.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Deadlock risk in the atomic restart handler due to regmap's internal spinlock.
--
commit a520c8e2203154ba331a6ae28f00daec074e62ee
Author: Rustam Adilov <adilov@disroot.org>
watchdog: realtek-otto: Change to use regmap API
This commit converts the realtek-otto watchdog driver to use the regmap API
instead of direct mmio accesses. It replaces direct read/modify/write
sequences with regmap functions and selects REGMAP_MMIO.
> diff --git a/drivers/watchdog/realtek_otto_wdt.c b/drivers/watchdog/realtek_otto_wdt.c
> index 2c30ddd574c59..e5e9cb480f4f9 100644
> --- a/drivers/watchdog/realtek_otto_wdt.c
> +++ b/drivers/watchdog/realtek_otto_wdt.c
[ ... ]
> @@ -199,7 +189,7 @@ static int otto_wdt_restart(struct watchdog_device *wdev, unsigned long reboot_m
>
> /* Configure for shortest timeout and wait for reset to occur */
> v = FIELD_PREP(OTTO_WDT_CTRL_RST_MODE, reset_mode) | OTTO_WDT_CTRL_ENABLE;
> - iowrite32(v, ctrl->base + OTTO_WDT_REG_CTRL);
> + regmap_write(ctrl->regmap, OTTO_WDT_REG_CTRL, v);
Could this regmap_write() cause a deadlock during system restart?
The restart handler is often called during system shutdown or kernel panic
in an atomic context with local interrupts disabled. Since
devm_regmap_init_mmio() configures the regmap to use a spinlock by default,
if a panic occurs while another cpu holds the regmap lock (e.g., during
a ping or timeout update) and that cpu is halted by smp_send_stop(), this
regmap_write() could spin endlessly and prevent the system from rebooting.
Additionally, on preempt-rt kernels, the regmap spinlock becomes a sleepable
rt_mutex, which could cause a sleeping in atomic context bug when acquired
with interrupts disabled.
> mdelay(3 * otto_wdt_tick_ms(ctrl, 0));
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260509163101.722793-1-adilov@disroot.org?part=1
next prev parent reply other threads:[~2026-05-09 17:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-09 16:30 [PATCH 0/3] watchdog: realtek-otto: Make use of regmap API and add RTL9607C support Rustam Adilov
2026-05-09 16:30 ` [PATCH 1/3] watchdog: realtek-otto: Change to use regmap API Rustam Adilov
2026-05-09 17:16 ` sashiko-bot [this message]
2026-05-09 16:31 ` [PATCH 2/3] dt-bindings: watchdog: realtek,otto-wdt: add compatible for RTL9607C Rustam Adilov
2026-05-09 18:13 ` Conor Dooley
2026-05-10 8:19 ` Rustam Adilov
2026-05-10 19:23 ` Sander Vanheule
2026-05-09 16:31 ` [PATCH 3/3] watchdog: realtek-otto: add RTL9607C support Rustam Adilov
2026-05-09 17:27 ` sashiko-bot
2026-05-10 18:12 ` Sander Vanheule
2026-05-10 15:13 ` [PATCH 0/3] watchdog: realtek-otto: Make use of regmap API and " Guenter Roeck
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=20260509171602.6B74FC2BCB2@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=adilov@disroot.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko@lists.linux.dev \
/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