From: sashiko-bot@kernel.org
To: "Lee Jones" <lee@kernel.org>, linux-watchdog@vger.kernel.org
Subject: Re: [PATCH 5/6] watchdog: octeon-wdt: Serialise countdown and IRQ state with raw spinlock
Date: Thu, 03 Dec 2026 19:45:19 +0000 [thread overview]
Message-ID: <sashiko-outbox-248548@kernel.org> (raw)
In-Reply-To: <20261203173039.1142495-6-lee@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] watchdog: octeon-wdt: global raw spinlock serializes
octeon_wdt_poke_irq()
--
commit c797d96678c4de1cdb3cdde1add8e9de6e19ad20
Author: Lee Jones <lee@kernel.org>
watchdog: octeon-wdt: Serialise countdown and IRQ state with raw spinlock
This commit adds a global raw spinlock to serialise access to
per_cpu_countdown[], irq_enabled_cpus, and do_countdown across the
watchdog IRQ handler, ping, start, stop, and CPU hotplug callbacks, and
guards the online-CPU loop in octeon_wdt_ping() with cpus_read_lock().
> diff --git a/drivers/watchdog/octeon-wdt-main.c b/drivers/watchdog/octeon-wdt-main.c
> index d29a638998475..7186174375421 100644
> --- a/drivers/watchdog/octeon-wdt-main.c
> +++ b/drivers/watchdog/octeon-wdt-main.c
[ ... ]
> @@ -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;
> }
[Severity: Medium]
Can the single global octeon_wdt_lock introduce periodic hardirq latency
spikes across all online CPUs?
octeon_wdt_poke_irq() is registered with IRQF_NO_THREAD and acquires
octeon_wdt_lock unconditionally, even before /dev/watchdog is opened, while
holding it across the uncached cvmx_write_csr_node() write and the MIPS
mmiowb() in queued_spin_release().
Because all per-CPU watchdogs share io_clock and timeout_cnt and are armed
or poked back-to-back, their interrupts are phase-locked to fire together
every 1-5 seconds. On high-core-count OCTEON systems (32-core CN68XX or
multi-node CN78XX), this forms an O(N) hardirq lock convoy across all CPUs.
Since per_cpu_countdown[] and the IRQ-enabled state are per-CPU and
octeon_wdt_ping() already locks per CPU iteration, a per-CPU raw_spinlock_t
with per-CPU state would avoid global hardirq serialisation and false
sharing.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261203173039.1142495-1-lee@kernel.org?part=5
next prev parent reply other threads:[~2026-12-03 19:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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 19:00 ` sashiko-bot
2026-12-03 17:30 ` [PATCH 3/6] watchdog: npcm: Enable clock before checking running state in probe Lee Jones
2026-12-04 1:02 ` Guenter Roeck
2026-12-03 17:30 ` [PATCH 4/6] watchdog: sbsa: Evaluate MediaTek WS0 workaround after IRQ fallback Lee Jones
2026-12-04 1:03 ` Guenter Roeck
2026-12-03 17:30 ` [PATCH 5/6] watchdog: octeon-wdt: Serialise countdown and IRQ state with raw spinlock Lee Jones
2026-12-03 19:45 ` sashiko-bot [this message]
2026-12-03 17:30 ` [PATCH 6/6] watchdog: rzv2h: Avoid 32-bit overflow in max_hw_heartbeat_ms calculation Lee Jones
2026-12-04 1:04 ` Guenter Roeck
2026-12-04 1:08 ` [PATCH 0/6] watchdog: Fix High issues reported by Sashiko 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=sashiko-outbox-248548@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=lee@kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=sashiko-reviews@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.