From: netdev-bot+sashiko@kernel.org
To: linusw@kernel.org
Cc: ulli.kroll@googlemail.com, andrew+netdev@lunn.ch,
davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
mirq-linux@rere.qmqm.pl, mhun512@gmail.com, edumazet@kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next v7 15/18] net: ethernet: cortina: Scope RX statistics updates
Date: Wed, 11 Nov 2026 23:10:51 +0000 [thread overview]
Message-ID: <179443865110.2199510.1541652335335896780@kernel.org> (raw)
In-Reply-To: <20261110-gemini-ethernet-fixes-3-v7-15-9c32a1a46aec@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] net: cortina: softirq-unsafe tx_stats_syncp update in
gmac_clean_txq()
--
> diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c
> --- a/drivers/net/ethernet/cortina/gemini.c
> +++ b/drivers/net/ethernet/cortina/gemini.c
> @@ -2870,6 +2879,9 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
> }
>
> port = netdev_priv(netdev);
> + u64_stats_init(&port->tx_stats_syncp);
> + u64_stats_init(&port->rx_stats_syncp);
> + u64_stats_init(&port->ir_stats_syncp);
> SET_NETDEV_DEV(netdev, dev);
> port->netdev = netdev;
> port->id = id;
>
[Severity: Medium]
Initializing tx_stats_syncp here is correct. On 32-bit lockdep
kernels, though, it also exposes an existing tx_stats_syncp writer
that runs from the wrong context.
gmac_clean_txq() bumps port->tx_frag_stats[nfrags] under a plain
u64_stats_update_begin(&port->tx_stats_syncp). When called from
gmac_start_xmit(), this runs with BH disabled, so lockdep records the
seqcount as used in softirq.
gmac_stop() also reaches it, via gmac_cleanup_txqs() and
gmac_clean_txq(), but from process context with BH and preemption
enabled. The last frames queued before the interface goes down are
normally still in the ring at that point. If one of them was a
multi-fragment frame (nfrags > 0), the tx_stats_syncp update runs
preemptible and with softirqs enabled.
On 32-bit non-RT, that hits the lockdep_assert_preemption_disabled()
check in __u64_stats_update_begin(). With the lockdep map now
initialized, it should also produce an inconsistent
IN-SOFTIRQ-W -> SOFTIRQ-ON-W report for tx_stats_syncp.
There is a real hazard behind the splat too. While the sequence count
is odd, nothing stops a softirq on the same CPU from reading TX stats
through gmac_get_stats64(). That reader would spin forever in
u64_stats_fetch_begin().
The other counters in these paths are already protected:
- The rx_stats_syncp update in gmac_stop() uses
u64_stats_update_begin_irqsave().
- The ir_stats_syncp update in gmac_clean_txq() is done under
geth->irq_lock.
Should the tx_stats_syncp update get the same treatment? Or would you
rather disable BH around gmac_cleanup_txqs() in gmac_stop()? Either
way, I think the fix belongs in this patch or just before it, since
the u64_stats_init() added here is what lets lockdep start tracking
this seqcount.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261110-gemini-ethernet-fixes-3-v7-0-9c32a1a46aec%40kernel.org
next prev parent reply other threads:[~2026-11-11 23:10 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-10 22:13 [PATCH net-next v7 00/18] net: ethernet: cortina: Fix Gemini RX/TX buffer management Linus Walleij
2026-11-10 22:13 ` [PATCH net-next v7 01/18] net: ethernet: cortina: Keep shared free queue parent-owned Linus Walleij
2026-11-10 22:13 ` [PATCH net-next v7 02/18] net: ethernet: cortina: Keep ports bound for shared IRQ Linus Walleij
2026-11-11 23:10 ` netdev-bot+sashiko
2026-11-10 22:13 ` [PATCH net-next v7 03/18] net: ethernet: cortina: Drain free queue IRQ before resize Linus Walleij
2026-11-10 22:13 ` [PATCH net-next v7 04/18] net: ethernet: cortina: Normalize free queue pointers on rebuild Linus Walleij
2026-11-11 23:10 ` netdev-bot+sashiko
2026-11-10 22:13 ` [PATCH net-next v7 05/18] net: ethernet: cortina: Correct free queue DMA mappings Linus Walleij
2026-11-11 23:10 ` netdev-bot+sashiko
2026-11-10 22:13 ` [PATCH net-next v7 06/18] net: ethernet: cortina: Index free queue fragments with XArray Linus Walleij
2026-11-10 22:13 ` [PATCH net-next v7 07/18] net: ethernet: cortina: Preserve in-flight free queue pages Linus Walleij
2026-11-11 23:10 ` netdev-bot+sashiko
2026-11-10 22:13 ` [PATCH net-next v7 08/18] net: ethernet: cortina: Rotate free queue page allocation Linus Walleij
2026-11-10 22:13 ` [PATCH net-next v7 09/18] net: ethernet: cortina: Recycle claimed free queue pages Linus Walleij
2026-11-10 22:13 ` [PATCH net-next v7 10/18] net: ethernet: cortina: Validate RX fragment lengths Linus Walleij
2026-11-10 22:13 ` [PATCH net-next v7 11/18] net: ethernet: cortina: Account RX buffer size in truesize Linus Walleij
2026-11-10 22:13 ` [PATCH net-next v7 12/18] net: ethernet: cortina: Release partial RX frames on stop Linus Walleij
2026-11-10 22:13 ` [PATCH net-next v7 13/18] net: ethernet: cortina: Scale Gemini RX queues to system memory Linus Walleij
2026-11-10 22:13 ` [PATCH net-next v7 14/18] net: ethernet: cortina: Serialize TX completion statistics Linus Walleij
2026-11-10 22:13 ` [PATCH net-next v7 15/18] net: ethernet: cortina: Scope RX statistics updates Linus Walleij
2026-11-11 23:10 ` netdev-bot+sashiko [this message]
2026-11-10 22:13 ` [PATCH net-next v7 16/18] net: ethernet: cortina: Drain RX coalescing timer on stop Linus Walleij
2026-11-11 23:10 ` netdev-bot+sashiko
2026-11-10 22:13 ` [PATCH net-next v7 17/18] net: ethernet: cortina: Reject TX rings smaller than retained pointers Linus Walleij
2026-11-10 22:13 ` [PATCH net-next v7 18/18] net: ethernet: cortina: Fix ethtool statistics reads Linus Walleij
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=179443865110.2199510.1541652335335896780@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linusw@kernel.org \
--cc=mhun512@gmail.com \
--cc=mirq-linux@rere.qmqm.pl \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ulli.kroll@googlemail.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