* [PATCH 0/6] watchdog: Fix High issues reported by Sashiko
@ 2026-12-03 17:30 Lee Jones
2026-12-03 17:30 ` [PATCH 1/6] watchdog: da9063: Stop ping worker on system suspend Lee Jones
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Lee Jones @ 2026-12-03 17:30 UTC (permalink / raw)
To: lee
Cc: linux-kernel, Jonathan Neuschäfer, Aaro Koskinen,
Aaron Plattner, Adam Thomson, Al Stone, Alan Cox, Andrew Jeffery,
Avi Fishman, Benjamin Fair, Cavium Inc, David Daney, Fu Wei,
Guenter Roeck, Lad Prabhakar, linux-watchdog, Mariusz Wojtasik,
Nancy Yuen, openbmc, Patrick Venture, Primoz Fiser, Serge Semin,
Support Opensource, Suravee Suthikulpanit, Tali Perry, Timur Tabi,
Tomer Maimon, Wim Van Sebroeck, Wolfram Sang
These issues were reported by Sashiko.
Cc: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Aaron Plattner <aplattner@nvidia.com>
Cc: Adam Thomson <DLG-Adam.Thomson.Opensource@dm.renesas.com>
Cc: Al Stone <al.stone@linaro.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Andrew Jeffery <andrew@codeconstruct.com.au>
Cc: Avi Fishman <avifishman70@gmail.com>
Cc: Benjamin Fair <benjaminfair@google.com>
Cc: Cavium Inc <support@cavium.com>
Cc: David Daney <ddaney@caviumnetworks.com>
Cc: Fu Wei <fu.wei@linaro.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cc: linux-watchdog@vger.kernel.org
Cc: Mariusz Wojtasik <mariusz.wojtasik@diasemi.com>
Cc: Nancy Yuen <yuenn@google.com>
Cc: openbmc@lists.ozlabs.org
Cc: Patrick Venture <venture@google.com>
Cc: Primoz Fiser <primoz.fiser@norik.com>
Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Cc: Support Opensource <support.opensource@diasemi.com>
Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Cc: Tali Perry <tali.perry1@gmail.com>
Cc: Timur Tabi <timur@codeaurora.org>
Cc: Tomer Maimon <tmaimon77@gmail.com>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>
Lee Jones (6):
watchdog: da9063: Stop ping worker on system suspend
watchdog: dw_wdt: Guard shared IRQ handler during system suspend and
resume
watchdog: npcm: Enable clock before checking running state in probe
watchdog: sbsa: Evaluate MediaTek WS0 workaround after IRQ fallback
watchdog: octeon-wdt: Serialise countdown and IRQ state with raw
spinlock
watchdog: rzv2h: Avoid 32-bit overflow in max_hw_heartbeat_ms
calculation
drivers/watchdog/da9063_wdt.c | 2 ++
drivers/watchdog/dw_wdt.c | 21 +++++++++++++--
drivers/watchdog/npcm_wdt.c | 17 +++++++++---
drivers/watchdog/octeon-wdt-main.c | 43 ++++++++++++++++++++++++++----
drivers/watchdog/rzv2h_wdt.c | 6 +++--
drivers/watchdog/sbsa_gwdt.c | 30 +++++++++++----------
6 files changed, 93 insertions(+), 26 deletions(-)
--
2.56.1.911.g883d8bcb20-goog
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/6] watchdog: da9063: Stop ping worker on system suspend
2026-12-03 17:30 [PATCH 0/6] watchdog: Fix High issues reported by Sashiko Lee Jones
@ 2026-12-03 17:30 ` Lee Jones
2026-12-03 18:31 ` sashiko-bot
2026-12-03 17:30 ` [PATCH 2/6] watchdog: dw_wdt: Guard shared IRQ handler during system suspend and resume Lee Jones
` (4 subsequent siblings)
5 siblings, 1 reply; 8+ messages in thread
From: Lee Jones @ 2026-12-03 17:30 UTC (permalink / raw)
To: lee, Support Opensource, Wim Van Sebroeck, Guenter Roeck,
Mariusz Wojtasik, Adam Thomson, Primoz Fiser, linux-watchdog
Cc: linux-kernel, stable
da9063_wdt_probe() sets min_hw_heartbeat_ms and may set WDOG_HW_RUNNING,
and da9063_wdt_suspend() stops the watchdog when dlg,use-sw-pm is set,
but watchdog_stop_ping_on_suspend() is never called. Because
system_state only switches to SYSTEM_SUSPEND after dpm_suspend() has
already suspended the I2C bus and returns to SYSTEM_RUNNING before
dpm_resume() restores it, the non-freezable watchdog kworker can issue
I2C transfers over a suspended bus.
Call watchdog_stop_ping_on_suspend() in da9063_wdt_probe() before
registering the watchdog device.
Fixes: a7ceca4398bc ("watchdog: da9063: optionally disable watchdog during suspend")
Closes: https://sashiko.dev/#/bug/linux-896288e5-bcfa-4a54-b0d6-ddb5d024eff1
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/watchdog/da9063_wdt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/watchdog/da9063_wdt.c b/drivers/watchdog/da9063_wdt.c
index ca901a755b3a..7ebf8d9e04ac 100644
--- a/drivers/watchdog/da9063_wdt.c
+++ b/drivers/watchdog/da9063_wdt.c
@@ -260,6 +260,8 @@ static int da9063_wdt_probe(struct platform_device *pdev)
set_bit(WDOG_HW_RUNNING, &wdd->status);
}
+ watchdog_stop_ping_on_suspend(wdd);
+
return devm_watchdog_register_device(dev, wdd);
}
--
2.56.1.911.g883d8bcb20-goog
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/6] watchdog: dw_wdt: Guard shared IRQ handler during system suspend and resume
2026-12-03 17:30 [PATCH 0/6] watchdog: Fix High issues reported by Sashiko Lee Jones
2026-12-03 17:30 ` [PATCH 1/6] watchdog: da9063: Stop ping worker on system suspend Lee Jones
@ 2026-12-03 17:30 ` Lee Jones
2026-12-03 17:30 ` [PATCH 3/6] watchdog: npcm: Enable clock before checking running state in probe Lee Jones
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2026-12-03 17:30 UTC (permalink / raw)
To: lee, Wim Van Sebroeck, Guenter Roeck, Serge Semin, linux-watchdog
Cc: linux-kernel, stable
dw_wdt_irq() is registered with IRQF_SHARED and unconditionally reads
WDOG_INTERRUPT_STATUS_REG_OFFSET. Because dw_wdt_suspend() asserts
reset and disables the clocks during normal dpm_suspend() before
suspend_device_irqs() runs (and resume_device_irqs() runs before
dw_wdt_resume() re-enables them), a shared interrupt firing in either
window causes an unclocked register read while the watchdog is in reset.
Track suspended state with acquire/release ordering and synchronise
with any in-flight IRQ handler via synchronize_irq() before asserting
reset and gating clocks in dw_wdt_suspend().
Fixes: 46a1946314bf ("watchdog: dw_wdt: Add pre-timeouts support")
Closes: https://sashiko.dev/#/bug/linux-f2a43bc3-4f5e-47b2-8d47-8fd4d6ed485f
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/watchdog/dw_wdt.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index b9a34857810b..3bf3f54b9356 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -89,6 +89,8 @@ struct dw_wdt {
struct dw_wdt_timeout timeouts[DW_WDT_NUM_TOPS];
struct watchdog_device wdd;
struct reset_control *rst;
+ int irq;
+ bool suspended;
/* Save/restore */
u32 control;
u32 timeout;
@@ -363,6 +365,10 @@ static irqreturn_t dw_wdt_irq(int irq, void *devid)
struct dw_wdt *dw_wdt = devid;
u32 val;
+ /* Pairs with smp_store_release() in dw_wdt_resume() and error path. */
+ if (smp_load_acquire(&dw_wdt->suspended))
+ return IRQ_NONE;
+
/*
* We don't clear the IRQ status. It's supposed to be done by the
* following ping operations.
@@ -384,9 +390,16 @@ static int dw_wdt_suspend(struct device *dev)
dw_wdt->control = readl(dw_wdt->regs + WDOG_CONTROL_REG_OFFSET);
dw_wdt->timeout = readl(dw_wdt->regs + WDOG_TIMEOUT_RANGE_REG_OFFSET);
+ WRITE_ONCE(dw_wdt->suspended, true);
+ if (dw_wdt->irq > 0)
+ synchronize_irq(dw_wdt->irq);
+
err = reset_control_assert(dw_wdt->rst);
- if (err)
+ if (err) {
+ /* Pairs with smp_load_acquire() in dw_wdt_irq(). */
+ smp_store_release(&dw_wdt->suspended, false);
return err;
+ }
clk_disable_unprepare(dw_wdt->pclk);
clk_disable_unprepare(dw_wdt->clk);
@@ -416,6 +429,9 @@ static int dw_wdt_resume(struct device *dev)
dw_wdt_ping(&dw_wdt->wdd);
+ /* Pairs with smp_load_acquire() in dw_wdt_irq(). */
+ smp_store_release(&dw_wdt->suspended, false);
+
return 0;
unprepare_pclk:
@@ -619,7 +635,8 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
*/
ret = platform_get_irq_optional(pdev, 0);
if (ret > 0) {
- ret = devm_request_irq(dev, ret, dw_wdt_irq,
+ dw_wdt->irq = ret;
+ ret = devm_request_irq(dev, dw_wdt->irq, dw_wdt_irq,
IRQF_SHARED | IRQF_TRIGGER_RISING,
pdev->name, dw_wdt);
if (ret)
--
2.56.1.911.g883d8bcb20-goog
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/6] watchdog: npcm: Enable clock before checking running state in probe
2026-12-03 17:30 [PATCH 0/6] watchdog: Fix High issues reported by Sashiko Lee Jones
2026-12-03 17:30 ` [PATCH 1/6] watchdog: da9063: Stop ping worker on system suspend Lee Jones
2026-12-03 17:30 ` [PATCH 2/6] watchdog: dw_wdt: Guard shared IRQ handler during system suspend and resume Lee Jones
@ 2026-12-03 17:30 ` Lee Jones
2026-12-03 17:30 ` [PATCH 4/6] watchdog: sbsa: Evaluate MediaTek WS0 workaround after IRQ fallback Lee Jones
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2026-12-03 17:30 UTC (permalink / raw)
To: lee, Andrew Jeffery, Avi Fishman, Tomer Maimon, Tali Perry,
Patrick Venture, Nancy Yuen, Benjamin Fair, Wim Van Sebroeck,
Guenter Roeck, Jonathan Neuschäfer, openbmc, linux-watchdog
Cc: linux-kernel, stable
npcm_wdt_probe() obtains the watchdog clock via
devm_clk_get_optional_prepared() and immediately calls
npcm_is_running(), reading the watchdog register before clk_enable() has
been invoked. On platforms with a gated peripheral clock, this causes
an unclocked MMIO access during probe.
Enable the clock before calling npcm_is_running(), start the watchdog
via __npcm_wdt_start() if it is already running (disabling the clock
otherwise), and disable the clock on subsequent probe error paths if it
was left enabled.
Fixes: af084fdccfaf ("watchdog: npcm: Enable clock if provided")
Closes: https://sashiko.dev/#/bug/linux-119dbba3-5231-4944-9d7e-e954378626c9
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/watchdog/npcm_wdt.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
index df7f66e77965..7a05673da4fc 100644
--- a/drivers/watchdog/npcm_wdt.c
+++ b/drivers/watchdog/npcm_wdt.c
@@ -448,24 +448,35 @@ static int npcm_wdt_probe(struct platform_device *pdev)
npcm_get_reset_status(wdt, dev, data, start);
+ ret = clk_enable(wdt->clk);
+ if (ret)
+ return ret;
+
if (npcm_is_running(&wdt->wdd)) {
/* Restart with the default or device-tree specified timeout */
- npcm_wdt_start(&wdt->wdd);
+ __npcm_wdt_start(&wdt->wdd);
set_bit(WDOG_HW_RUNNING, &wdt->wdd.status);
+ } else {
+ clk_disable(wdt->clk);
}
ret = devm_request_irq(dev, irq, npcm_wdt_interrupt, 0, "watchdog",
wdt);
if (ret)
- return ret;
+ goto err_disable_clk;
ret = devm_watchdog_register_device(dev, &wdt->wdd);
if (ret)
- return ret;
+ goto err_disable_clk;
dev_info(dev, "NPCM watchdog driver enabled\n");
return 0;
+
+err_disable_clk:
+ if (watchdog_hw_running(&wdt->wdd))
+ clk_disable(wdt->clk);
+ return ret;
}
#ifdef CONFIG_OF
--
2.56.1.911.g883d8bcb20-goog
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/6] watchdog: sbsa: Evaluate MediaTek WS0 workaround after IRQ fallback
2026-12-03 17:30 [PATCH 0/6] watchdog: Fix High issues reported by Sashiko Lee Jones
` (2 preceding siblings ...)
2026-12-03 17:30 ` [PATCH 3/6] watchdog: npcm: Enable clock before checking running state in probe Lee Jones
@ 2026-12-03 17:30 ` Lee Jones
2026-12-03 17:30 ` [PATCH 5/6] watchdog: octeon-wdt: Serialise countdown and IRQ state with raw spinlock Lee Jones
2026-12-03 17:30 ` [PATCH 6/6] watchdog: rzv2h: Avoid 32-bit overflow in max_hw_heartbeat_ms calculation Lee Jones
5 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2026-12-03 17:30 UTC (permalink / raw)
To: lee, Wim Van Sebroeck, Guenter Roeck, Fu Wei,
Suravee Suthikulpanit, Al Stone, Timur Tabi, Aaron Plattner,
linux-watchdog
Cc: linux-kernel, stable
sbsa_gwdt_probe() calls sbsa_gwdt_get_version() and applies the
MediaTek WS0 race workaround before attempting to request the WS0
interrupt. If platform_get_irq() or devm_request_irq() fails and the
driver falls back to single-stage mode (action = 0), neither
need_ws0_race_workaround nor wdd->min_timeout is updated, leaving
MediaTek rev 0 hardware without the workaround.
Move sbsa_gwdt_get_version(), max_hw_heartbeat_ms initialisation, and the
need_ws0_race_workaround check after the IRQ setup block.
Fixes: 48defdf6b083 ("watchdog: sbsa: Adjust keepalive timeout to avoid MediaTek WS0 race condition")
Closes: https://sashiko.dev/#/bug/linux-01e7e345-bbe4-47e2-a2be-00d65eb15869
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/watchdog/sbsa_gwdt.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
index 537c48b883b3..82ffeeadb871 100644
--- a/drivers/watchdog/sbsa_gwdt.c
+++ b/drivers/watchdog/sbsa_gwdt.c
@@ -340,20 +340,6 @@ static int sbsa_gwdt_probe(struct platform_device *pdev)
wdd->timeout = DEFAULT_TIMEOUT;
watchdog_set_drvdata(wdd, gwdt);
watchdog_set_nowayout(wdd, nowayout);
- sbsa_gwdt_get_version(wdd);
- if (gwdt->version == 0)
- wdd->max_hw_heartbeat_ms = U32_MAX / gwdt->clk * 1000;
- else
- wdd->max_hw_heartbeat_ms = GENMASK_ULL(47, 0) / gwdt->clk * 1000;
-
- if (gwdt->need_ws0_race_workaround) {
- /*
- * A timeout of 3 seconds means that WOR will be set to 1.5
- * seconds and the heartbeat will be scheduled every 2.5
- * seconds.
- */
- wdd->min_timeout = 3;
- }
status = readl(cf_base + SBSA_GWDT_WCS);
if (status & SBSA_GWDT_WCS_WS1) {
@@ -384,6 +370,22 @@ static int sbsa_gwdt_probe(struct platform_device *pdev)
if (!action)
dev_warn(dev, "falling back to single stage mode.\n");
}
+
+ sbsa_gwdt_get_version(wdd);
+ if (gwdt->version == 0)
+ wdd->max_hw_heartbeat_ms = U32_MAX / gwdt->clk * 1000;
+ else
+ wdd->max_hw_heartbeat_ms = GENMASK_ULL(47, 0) / gwdt->clk * 1000;
+
+ if (gwdt->need_ws0_race_workaround) {
+ /*
+ * A timeout of 3 seconds means that WOR will be set to 1.5
+ * seconds and the heartbeat will be scheduled every 2.5
+ * seconds.
+ */
+ wdd->min_timeout = 3;
+ }
+
/*
* In the single stage mode, The first signal (WS0) is ignored,
* the timeout is (WOR * 2), so the maximum timeout should be doubled.
--
2.56.1.911.g883d8bcb20-goog
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/6] watchdog: octeon-wdt: Serialise countdown and IRQ state with raw spinlock
2026-12-03 17:30 [PATCH 0/6] watchdog: Fix High issues reported by Sashiko Lee Jones
` (3 preceding siblings ...)
2026-12-03 17:30 ` [PATCH 4/6] watchdog: sbsa: Evaluate MediaTek WS0 workaround after IRQ fallback Lee Jones
@ 2026-12-03 17:30 ` Lee Jones
2026-12-03 17:30 ` [PATCH 6/6] watchdog: rzv2h: Avoid 32-bit overflow in max_hw_heartbeat_ms calculation Lee Jones
5 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2026-12-03 17:30 UTC (permalink / raw)
To: lee, Wim Van Sebroeck, Guenter Roeck, Aaro Koskinen, Alan Cox,
Cavium Inc, David Daney, linux-watchdog
Cc: linux-kernel, stable
octeon_wdt_poke_irq() runs in hardirq context (IRQF_NO_THREAD) and
updates per_cpu_countdown[], disables the watchdog IRQ, and clears
irq_enabled_cpus without locking. Concurrently, octeon_wdt_ping()
writes per_cpu_countdown[] and tests irq_enabled_cpus in process
context. This allows octeon_wdt_ping() to miss the cleared bit and
leave the watchdog IRQ permanently disabled, or lose a countdown reset.
Protect per_cpu_countdown[], irq_enabled_cpus, and do_countdown with a
raw_spinlock_t across the IRQ handler, ping, start, stop, and CPU
hotplug callbacks, deferring enable_irq() and panic() until after the
lock is released, and guard octeon_wdt_ping()'s online-CPU iteration
with cpus_read_lock().
Fixes: 4c076fb41ac9 ("WATCHDOG: Add watchdog driver for OCTEON SOCs")
Closes: https://sashiko.dev/#/bug/linux-1d98fa88-4055-42e9-b51b-69f0073793a8
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/watchdog/octeon-wdt-main.c | 43 ++++++++++++++++++++++++++----
1 file changed, 38 insertions(+), 5 deletions(-)
diff --git a/drivers/watchdog/octeon-wdt-main.c b/drivers/watchdog/octeon-wdt-main.c
index d29a63899847..718617437542 100644
--- a/drivers/watchdog/octeon-wdt-main.c
+++ b/drivers/watchdog/octeon-wdt-main.c
@@ -55,6 +55,7 @@
#include <linux/cpu.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
+#include <linux/spinlock.h>
#include <linux/stringify.h>
#include <asm/mipsregs.h>
@@ -85,6 +86,7 @@ static unsigned int countdown_reset;
static unsigned int per_cpu_countdown[NR_CPUS];
static cpumask_t irq_enabled_cpus;
+static DEFINE_RAW_SPINLOCK(octeon_wdt_lock);
#define WD_TIMO 60 /* Default heartbeat = 60 seconds */
@@ -138,7 +140,10 @@ static irqreturn_t octeon_wdt_poke_irq(int cpl, void *dev_id)
int cpu = raw_smp_processor_id();
unsigned int core = cpu2core(cpu);
int node = cpu_to_node(cpu);
+ unsigned long flags;
+ bool should_panic = false;
+ raw_spin_lock_irqsave(&octeon_wdt_lock, flags);
if (do_countdown) {
if (per_cpu_countdown[cpu] > 0) {
/* We're alive, poke the watchdog */
@@ -148,13 +153,17 @@ static irqreturn_t octeon_wdt_poke_irq(int cpl, void *dev_id)
/* Bad news, you are about to reboot. */
disable_irq_nosync(cpl);
cpumask_clear_cpu(cpu, &irq_enabled_cpus);
- if (panic_on_timeout)
- panic("Watchdog timeout");
+ should_panic = panic_on_timeout;
}
} else {
/* Not open, just ping away... */
cvmx_write_csr_node(node, CVMX_CIU_PP_POKEX(core), 1);
}
+ raw_spin_unlock_irqrestore(&octeon_wdt_lock, flags);
+
+ if (should_panic)
+ panic("Watchdog timeout");
+
return IRQ_HANDLED;
}
@@ -333,6 +342,7 @@ static int octeon_wdt_cpu_to_irq(int cpu)
static int octeon_wdt_cpu_pre_down(unsigned int cpu)
{
unsigned int core;
+ unsigned long flags;
int node;
union cvmx_ciu_wdogx ciu_wdog;
@@ -348,6 +358,10 @@ static int octeon_wdt_cpu_pre_down(unsigned int cpu)
cvmx_write_csr_node(node, CVMX_CIU_WDOGX(core), ciu_wdog.u64);
free_irq(octeon_wdt_cpu_to_irq(cpu), octeon_wdt_poke_irq);
+
+ raw_spin_lock_irqsave(&octeon_wdt_lock, flags);
+ cpumask_clear_cpu(cpu, &irq_enabled_cpus);
+ raw_spin_unlock_irqrestore(&octeon_wdt_lock, flags);
return 0;
}
@@ -355,6 +369,7 @@ static int octeon_wdt_cpu_online(unsigned int cpu)
{
unsigned int core;
unsigned int irq;
+ unsigned long flags;
union cvmx_ciu_wdogx ciu_wdog;
int node;
struct irq_domain *domain;
@@ -369,7 +384,10 @@ static int octeon_wdt_cpu_online(unsigned int cpu)
ciu_wdog.u64 = 0;
cvmx_write_csr_node(node, CVMX_CIU_WDOGX(core), ciu_wdog.u64);
+ raw_spin_lock_irqsave(&octeon_wdt_lock, flags);
per_cpu_countdown[cpu] = countdown_reset;
+ cpumask_set_cpu(cpu, &irq_enabled_cpus);
+ raw_spin_unlock_irqrestore(&octeon_wdt_lock, flags);
if (octeon_has_feature(OCTEON_FEATURE_CIU3)) {
/* Must get the domain for the watchdog block */
@@ -392,8 +410,6 @@ static int octeon_wdt_cpu_online(unsigned int cpu)
irq_set_affinity(irq, cpumask_of(cpu));
}
- cpumask_set_cpu(cpu, &irq_enabled_cpus);
-
/* Poke the watchdog to clear out its state */
cvmx_write_csr_node(node, CVMX_CIU_PP_POKEX(core), 1);
@@ -415,18 +431,27 @@ static int octeon_wdt_ping(struct watchdog_device __always_unused *wdog)
if (disable)
return 0;
+ cpus_read_lock();
for_each_online_cpu(cpu) {
+ unsigned long flags;
+ bool need_enable = false;
+
coreid = cpu2core(cpu);
node = cpu_to_node(cpu);
+ raw_spin_lock_irqsave(&octeon_wdt_lock, flags);
cvmx_write_csr_node(node, CVMX_CIU_PP_POKEX(coreid), 1);
per_cpu_countdown[cpu] = countdown_reset;
if ((countdown_reset || !do_countdown) &&
!cpumask_test_cpu(cpu, &irq_enabled_cpus)) {
/* We have to enable the irq */
- enable_irq(octeon_wdt_cpu_to_irq(cpu));
cpumask_set_cpu(cpu, &irq_enabled_cpus);
+ need_enable = true;
}
+ raw_spin_unlock_irqrestore(&octeon_wdt_lock, flags);
+ if (need_enable)
+ enable_irq(octeon_wdt_cpu_to_irq(cpu));
}
+ cpus_read_unlock();
return 0;
}
@@ -488,14 +513,22 @@ static int octeon_wdt_set_timeout(struct watchdog_device *wdog,
static int octeon_wdt_start(struct watchdog_device *wdog)
{
+ unsigned long flags;
+
octeon_wdt_ping(wdog);
+ raw_spin_lock_irqsave(&octeon_wdt_lock, flags);
do_countdown = 1;
+ raw_spin_unlock_irqrestore(&octeon_wdt_lock, flags);
return 0;
}
static int octeon_wdt_stop(struct watchdog_device *wdog)
{
+ unsigned long flags;
+
+ raw_spin_lock_irqsave(&octeon_wdt_lock, flags);
do_countdown = 0;
+ raw_spin_unlock_irqrestore(&octeon_wdt_lock, flags);
octeon_wdt_ping(wdog);
return 0;
}
--
2.56.1.911.g883d8bcb20-goog
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 6/6] watchdog: rzv2h: Avoid 32-bit overflow in max_hw_heartbeat_ms calculation
2026-12-03 17:30 [PATCH 0/6] watchdog: Fix High issues reported by Sashiko Lee Jones
` (4 preceding siblings ...)
2026-12-03 17:30 ` [PATCH 5/6] watchdog: octeon-wdt: Serialise countdown and IRQ state with raw spinlock Lee Jones
@ 2026-12-03 17:30 ` Lee Jones
5 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2026-12-03 17:30 UTC (permalink / raw)
To: lee, Wim Van Sebroeck, Guenter Roeck, Lad Prabhakar, Wolfram Sang,
linux-watchdog
Cc: linux-kernel
For RZ/T2H SoCs, MILLI * timeout_cycles * cks_div equals 33,554,432,000,
which overflows 32-bit unsigned long on 32-bit builds.
Perform the multiplication in 64-bit arithmetic and divide using
div64_ul().
Fixes: 2b2069763527 ("watchdog: rzv2h: Add support for RZ/T2H")
Closes: https://sashiko.dev/#/bug/linux-441577c6-bf0c-46ed-bc43-676afdcc85bf
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/watchdog/rzv2h_wdt.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/watchdog/rzv2h_wdt.c b/drivers/watchdog/rzv2h_wdt.c
index 67869468edd8..81bf6a36b139 100644
--- a/drivers/watchdog/rzv2h_wdt.c
+++ b/drivers/watchdog/rzv2h_wdt.c
@@ -8,6 +8,7 @@
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/kernel.h>
+#include <linux/math64.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
@@ -310,8 +311,9 @@ static int rzv2h_wdt_probe(struct platform_device *pdev)
if (!rate)
return dev_err_probe(dev, -EINVAL, "Invalid clock rate\n");
- priv->wdev.max_hw_heartbeat_ms = (MILLI * priv->of_data->timeout_cycles *
- priv->of_data->cks_div) / rate;
+ priv->wdev.max_hw_heartbeat_ms =
+ div64_ul((u64)MILLI * priv->of_data->timeout_cycles *
+ priv->of_data->cks_div, rate);
dev_dbg(dev, "max hw timeout of %dms\n", priv->wdev.max_hw_heartbeat_ms);
ret = devm_pm_runtime_enable(dev);
--
2.56.1.911.g883d8bcb20-goog
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/6] watchdog: da9063: Stop ping worker on system suspend
2026-12-03 17:30 ` [PATCH 1/6] watchdog: da9063: Stop ping worker on system suspend Lee Jones
@ 2026-12-03 18:31 ` sashiko-bot
0 siblings, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-12-03 18:31 UTC (permalink / raw)
To: Lee Jones, linux-watchdog
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] watchdog: da9063: watchdog_dev_resume() ping violates 256 ms
reset window
--
commit 49cf28fc9c5d60090a84633d01c89c66ae0ab80c
Author: Lee Jones <lee@kernel.org>
watchdog: da9063: Stop ping worker on system suspend
This commit calls watchdog_stop_ping_on_suspend() in da9063_wdt_probe()
before registering the watchdog device so the watchdog ping worker stops
during system suspend.
> diff --git a/drivers/watchdog/da9063_wdt.c b/drivers/watchdog/da9063_wdt.c
> index ca901a755b3a2..7ebf8d9e04ac1 100644
> --- a/drivers/watchdog/da9063_wdt.c
> +++ b/drivers/watchdog/da9063_wdt.c
> @@ -260,6 +260,8 @@ static int da9063_wdt_probe(struct platform_device *pdev)
> set_bit(WDOG_HW_RUNNING, &wdd->status);
> }
>
> + watchdog_stop_ping_on_suspend(wdd);
> +
> return devm_watchdog_register_device(dev, wdd);
> }
[Severity: High]
Can this trigger a DA9063 hardware reset on resume when dlg,use-sw-pm is
enabled?
Setting WDOG_NO_PING_ON_SUSPEND registers watchdog_pm_notifier(), so
PM_POST_SUSPEND now runs watchdog_dev_resume() -> __watchdog_ping()
shortly after dpm_resume_end() calls da9063_wdt_resume().
When the watchdog is active or running from boot, da9063_wdt_resume()
restarts the timer via da9063_wdt_start() without updating
wd_data->last_hw_keepalive, starting a fresh 256 ms reset-protection
window.
Because __watchdog_ping() checks min_hw_heartbeat_ms against the stale
pre-suspend last_hw_keepalive, it invokes da9063_wdt_ping() within 256 ms
of the restart and causes the PMIC to reset the system.
Calling watchdog_set_last_hw_keepalive(wdd, 0) after da9063_wdt_start()
in da9063_wdt_resume() would record the restart timestamp so
watchdog_dev_resume() defers the ping until the 256 ms window expires.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203173039.1142495-1-lee@kernel.org?part=1
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-12-03 18:31 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 17:30 [PATCH 0/6] watchdog: Fix High issues reported by Sashiko Lee Jones
2026-12-03 17:30 ` [PATCH 1/6] watchdog: da9063: Stop ping worker on system suspend Lee Jones
2026-12-03 18:31 ` sashiko-bot
2026-12-03 17:30 ` [PATCH 2/6] watchdog: dw_wdt: Guard shared IRQ handler during system suspend and resume Lee Jones
2026-12-03 17:30 ` [PATCH 3/6] watchdog: npcm: Enable clock before checking running state in probe Lee Jones
2026-12-03 17:30 ` [PATCH 4/6] watchdog: sbsa: Evaluate MediaTek WS0 workaround after IRQ fallback Lee Jones
2026-12-03 17:30 ` [PATCH 5/6] watchdog: octeon-wdt: Serialise countdown and IRQ state with raw spinlock Lee Jones
2026-12-03 17:30 ` [PATCH 6/6] watchdog: rzv2h: Avoid 32-bit overflow in max_hw_heartbeat_ms calculation Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox