From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Zxyan Zhu <zxyan0222@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
Jose Abreu <Jose.Abreu@synopsys.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
ClarkWilliams <clrkwllms@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Stanislav Fomichev <sdf@fomichev.me>,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-rt-devel@lists.linux.dev, bpf@vger.kernel.org
Subject: Re: [PATCH net] net: stmmac: remove STMMAC_DOWN
Date: Wed, 2 Dec 2026 10:04:43 +0100 [thread overview]
Message-ID: <37f2c70f-d37a-4022-a5d3-b2863db7c940@bootlin.com> (raw)
In-Reply-To: <20261201091256.3000677-1-zxyan0222@gmail.com>
Hi,
On 12/1/26 10:12, Zxyan Zhu wrote:
> STMMAC_DOWN was introduced by commit 34877a15f787 ("net: stmmac: Rework and fix
> TX Timeout code") to mark the window where stmmac_reset_subtask() runs
> dev_close()/dev_open(). However, the flag is only ever set and cleared
> inside stmmac_reset_subtask(), yet most of its call sites treat it as if
> it meant "interface is down". That mismatch is not just misleading, it
> is the source of an interrupt storm.
>
> On a PREEMPT_RT system, fault-injecting an uncorrectable dwxgmac2 safety
> error (src3 FSM RX parity) while traffic is running makes
> stmmac_global_err() schedule stmmac_reset_subtask(), which does
> dev_close()/dev_open(). While dev_close() blocks in synchronize_net()
> waiting for an RCU grace period, a pending level-triggered DMA interrupt
> makes the handlers bail out early:
>
> /* Check if adapter is up */
> if (test_bit(STMMAC_DOWN, &priv->state))
> return IRQ_HANDLED;
>
> without clearing any interrupt status. The level IRQ stays asserted, the
> interrupt counter storms from ~2.7k to ~14M in about 28 s (~500k irqs/s),
> starving the rcuc kthread so the RCU grace period never completes:
>
> rcu: INFO: rcu_preempt self-detected stall on CPU
> rcu: 0-....: (7499 ticks this GP) ... rcuc=7499 jiffies(starved)
>
> __wait_rcu_gp
> synchronize_rcu_normal
> synchronize_rcu_expedited
> synchronize_net
> dev_deactivate_many
> __dev_close_many
> netif_close_many
> netif_close
> dev_close
> stmmac_service_task
>
> The board then panics on panic_on_rcu_stall.
>
> The STMMAC_DOWN early-returns do not actually protect anything: the
> concurrent teardown is already serialized by free_irq(), which
> synchronizes with in-flight handlers before freeing the DMA descriptors,
> so the interrupt handlers can run normally during the reset window.
> Remove the flag entirely and let the handlers clear the interrupt status
> as they normally do. This matches the direction suggested by the stmmac
> maintainer: the flag only causes problems while the call sites already
> work without it.
>
> The remaining uses are covered by existing mechanisms instead of a
> dedicated flag: stmmac_service_event_schedule() is already guarded by
> STMMAC_SERVICE_SCHED; stmmac_xdp_xmit() and stmmac_xsk_wakeup() now test
> STMMAC_RESETING, which stmmac_reset_subtask() sets before dev_close() and
> clears after dev_open(), so the whole reset window (including the
> ndo_open() half, where netif_running() is already true before the DMA
> rings are rebuilt) is rejected; and stmmac_reset_subtask() is guarded by
> STMMAC_RESET_REQUESTED plus STMMAC_RESETING.
>
> With the fix, on a local board (dwxgmac2), injecting the same safety
> error while traffic is running completes the reset cleanly and the main
> IRQ counter no longer storms.
>
> Fixes: 34877a15f787 ("net: stmmac: Rework and fix TX Timeout code")
> Suggested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> Link: https://lore.kernel.org/netdev/20240327110142.159851-1-cathy.cai@unisoc.com/
> Signed-off-by: Zxyan Zhu <zxyan0222@gmail.com>
Thanks for working on this. The commit log is quite verbose and the
"why" is drowned in details, if you need to resend when sashiko/clashiko
look at this, feel free to reduce a bit the commit message or even
better, write it by hand :)
Anyway,
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Maxime
prev parent reply other threads:[~2026-12-02 9:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 9:12 [PATCH net] net: stmmac: remove STMMAC_DOWN Zxyan Zhu
2026-12-02 9:04 ` Maxime Chevallier [this message]
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=37f2c70f-d37a-4022-a5d3-b2863db7c940@bootlin.com \
--to=maxime.chevallier@bootlin.com \
--cc=Jose.Abreu@synopsys.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=bpf@vger.kernel.org \
--cc=clrkwllms@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rostedt@goodmis.org \
--cc=sdf@fomichev.me \
--cc=zxyan0222@gmail.com \
/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