From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796327120; b=pBTaWk7aHDmrY/RHVnDf2FL2gjNDf92oXJ3kT1Cw+EOCdDmwvbjbSPcr6m8LF1ry06WJ uHaFqyuA9t6OYZ+3el+WD2B6XeWGW7qlHXmyp9/MRrcwj7GhD73njpDsKNHuGfe+rwX7g XVrRImpDU3gX7IhZLHmqqEL6WA9LJHxWY/w2VJdjlvqY0F9xdS+EYAuO2rqmyDMqGepku nBdzJkIk06bMrYrPEqgc4yU5G2COC3XY+wkyd1Scw3AYJLGemn13hojGitk1P8vkl7RYY QUkd7qGb3ZhfDtR3o7JKBm4vqki103kFz1ArEAUvMQXP7Wd1GQiPxxekpETqh8wVEQw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796327120; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=gvNe5vhFEIVmJZIbib9eJVn0WM9uKKOnLvmUeecLfTI=; b=pOKmMbUrh5BhV/YQ2ZmK8idrNf8FPUewdjWSBQy8q81aX/K1RCUdiw6nG0zss69XlQrN +3bUVRQjVbulZAEcQE+S0drsSdvlMqsEnqrxvJMu/liLmkQGu2aBJw0VgrIVDb0ofyo79 GfQNkZYGLvYujcrUx2UbVsKz8/jJufV/D02K99sSwG54HJxHJ/4VqphBm8LSdVFqTY/cP nObOI3lcVaOvvSD7lpKMaUkO5/dJxtoa2EQrQAhCLfT8hNVoRfAKhT4mp1QUDiOUj7UpW epFWwnJaiXxmaXTP7+u8IMOXz3U754nnDJec9ed7Eo+krS2w63fXplaI8itPVS+cvtQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=D1ocSm4N; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A5AB606A32C for ; Thu, 3 Dec 2026 19:45:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=D1ocSm4N Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E7301F000C2; Thu, 3 Dec 2026 19:45:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796327119; bh=gvNe5vhFEIVmJZIbib9eJVn0WM9uKKOnLvmUeecLfTI=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=D1ocSm4NTBxgTJ7KZ5kUyXTvkqMjEyr1qDGELTctSxSbiCl2Uw+xBtvft+MQJXwsW TXWVAIXmJ3Mu6v6EYJfoNFHpbG8wpR5vH8Vv4cgS0wFL4iAGIJcAZ54bB2q5c0tNU1 syNV9K3ZCEfjfdEtbtQ4XP6hKRpYV8MrkzE/ypQc41C5+DqDbdBQ1Ja8GFyo1MIe8x 8so93kx5l9QWZJ4FSF5QDATQYXhEmI0UdKVpCpPg6zi49e1FbQ4twKBObPS8jHFsEj H1svLuBCotgCqjuxHyoB3kMBYW2gwqHIuZUYJqJh65HExHbq89oQ9iSgneBsV5Wmjv 0E3j2JuPd1mLQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 5/6] watchdog: octeon-wdt: Serialise countdown and IRQ state with raw spinlock Reply-To: sashiko-reviews@lists.linux.dev To: "Lee Jones" , linux-watchdog@vger.kernel.org In-Reply-To: <20261203173039.1142495-6-lee@kernel.org> References: <20261203173039.1142495-1-lee@kernel.org> <20261203173039.1142495-6-lee@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 19:45:19 +0000 X-Mailing-List: linux-watchdog@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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]; > =20 > static cpumask_t irq_enabled_cpus; > +static DEFINE_RAW_SPINLOCK(octeon_wdt_lock); > =20 > #define WD_TIMO 60 /* Default heartbeat =3D 60 seconds */ > =20 > @@ -138,7 +140,10 @@ static irqreturn_t octeon_wdt_poke_irq(int cpl, void= *dev_id) > int cpu =3D raw_smp_processor_id(); > unsigned int core =3D cpu2core(cpu); > int node =3D cpu_to_node(cpu); > + unsigned long flags; > + bool should_panic =3D false; > =20 > + 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, voi= d *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 =3D 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. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203173039.1142= 495-1-lee@kernel.org?part=3D5