From: sashiko-bot@kernel.org
To: "Kartik Rajput" <kkartik@nvidia.com>
Cc: linux-watchdog@vger.kernel.org
Subject: Re: [PATCH 1/4] clocksource/drivers/timer-tegra186: Fix support for multiple watchdog instances
Date: Thu, 07 May 2026 22:58:59 +0000 [thread overview]
Message-ID: <20260507225900.84210C2BCB2@smtp.kernel.org> (raw)
In-Reply-To: <20260507154557.2082697-2-kkartik@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The read-modify-write sequence on the shared TKEIE register lacks synchronization, causing a data race when multiple watchdogs are enabled concurrently.
--
commit b62fcb75a56d43aa9fdaf906df5a4e961258346d
Author: Kartik Rajput <kkartik@nvidia.com>
clocksource/drivers/timer-tegra186: Fix support for multiple watchdog instances
This commit fixes support for multiple watchdog instances on Tegra186 by
changing the interrupt enable register update to a read-modify-write sequence.
This preserves the interrupt enable bits for previously configured watchdogs.
> diff --git a/drivers/clocksource/timer-tegra186.c b/drivers/clocksource/timer-tegra186.c
> index 355558893e5f3..bfe16d2d5104e 100644
> --- a/drivers/clocksource/timer-tegra186.c
> +++ b/drivers/clocksource/timer-tegra186.c
> @@ -149,7 +149,8 @@ static void tegra186_wdt_enable(struct tegra186_wdt *wdt)
> u32 value;
>
> /* unmask hardware IRQ, this may have been lost across powergate */
> - value = TKEIE_WDT_MASK(wdt->index, 1);
> + value = readl(tegra->regs + TKEIE(wdt->tmr->hwirq));
> + value |= TKEIE_WDT_MASK(wdt->index, 1);
> + writel(value, tegra->regs + TKEIE(wdt->tmr->hwirq));
Does this read-modify-write sequence need synchronization?
All watchdogs share the same TKEIE register since wdt->tmr->hwirq is
hardcoded to 0. Operations across different watchdog devices are not
serialized by the watchdog core, which only uses a per-device mutex.
If a userspace watchdog is started concurrently while a kernel watchdog is
being enabled, the read-modify-write sequences can overlap. If this happens,
one watchdog's interrupt enable bit can be silently overwritten and cleared.
Without its interrupt, the kernel watchdog could fail to ping itself,
resulting in an unintended system POR reset.
Could this shared MMIO register update be protected with a driver-level
spinlock in struct tegra186_timer?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260507154557.2082697-1-kkartik@nvidia.com?part=1
next prev parent reply other threads:[~2026-05-07 22:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-07 15:45 [PATCH 0/4] Add support for Kernel WDT Kartik Rajput
2026-05-07 15:45 ` [PATCH 1/4] clocksource/drivers/timer-tegra186: Fix support for multiple watchdog instances Kartik Rajput
2026-05-07 22:58 ` sashiko-bot [this message]
2026-05-07 15:45 ` [PATCH 2/4] clocksource/drivers/timer-tegra186: Correct num_wdts for Tegra186 and Tegra234 Kartik Rajput
2026-05-07 15:45 ` [PATCH 3/4] clocksource/drivers/timer-tegra186: Register all accessible watchdog timers Kartik Rajput
2026-05-07 23:38 ` sashiko-bot
2026-05-07 15:45 ` [PATCH 4/4] clocksource/drivers/timer-tegra186: Reserve and service a kernel watchdog Kartik Rajput
2026-05-08 0:23 ` sashiko-bot
2026-05-12 13:56 ` [PATCH 0/4] Add support for Kernel WDT Jon Hunter
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=20260507225900.84210C2BCB2@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kkartik@nvidia.com \
--cc=linux-watchdog@vger.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