All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolai Buchwitz <nb@tipi-net.de>
To: netdev-bot+sashiko@kernel.org
Cc: opendmb@gmail.com, florian.fainelli@broadcom.com,
	bcm-kernel-feedback-list@broadcom.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, dave.stevenson@raspberrypi.com,
	justin.chen@broadcom.com, pierremarinleclercq88@gmail.com,
	f.fainelli@gmail.com
Subject: Re: [PATCH net-next v5 6/8] net: bcmgenet: pad transmit frames out of the packet ready window
Date: Thu, 15 Oct 2026 10:48:56 +0200	[thread overview]
Message-ID: <889b45fa87ee8eff3903c1b9e9b96316@tipi-net.de> (raw)
In-Reply-To: <179198777582.434549.9712346725032064776@kernel.org>

On 14.10.2026 16:22, netdev-bot+sashiko@kernel.org wrote:

> [...]

> [Severity: Medium]
> This is a pre-existing issue and was not introduced by this patch. The 
> new
> dropped increments here run under ring->lock, but bcmgenet_timeout()
> updates the same syncp after the lock has been dropped:
> 
> drivers/net/ethernet/broadcom/genet/bcmgenet.c:bcmgenet_timeout() {
>     ...
> 	bcmgenet_tx_reclaim(dev, ring, true);
> 
> 	/* Re-enable the TX interrupt for this ring */
> 	bcmgenet_intrl2_1_writel(priv, 1 << txqueue, INTRL2_CPU_MASK_CLEAR);
> 
> 	txq_trans_cond_update(txq);
> 
> 	BCMGENET_STATS64_INC((&ring->stats64), errors);
>     ...
> }
> 
> bcmgenet_tx_reclaim() takes ring->lock and releases it before 
> returning,
> and the TX interrupt has just been unmasked. TX NAPI writes the same 
> syncp
> under ring->lock:
> 
> bcmgenet_tx_poll()
>     spin_lock(&ring->lock);
>     __bcmgenet_tx_reclaim()
>         u64_stats_update_begin(&stats->syncp);
>         u64_stats_add(&stats->packets, pkts_compl);
>         u64_stats_add(&stats->bytes, bytes_compl);
>         u64_stats_update_end(&stats->syncp);
> 
> dev_watchdog() freezes the tx queues, but it doesn't stop TX NAPI.
> 
> On 32-bit SMP kernels, such as on BCM2711 or arm32 BCM7xxx, can these 
> two
> writers overlap on ring->stats64.syncp? Readers in 
> bcmgenet_get_stats64()
> and ethtool -S could then see torn counters. A lost sequence increment
> would also leave the seqcount odd, and readers would spin.
> 
> Would moving the errors increment in bcmgenet_timeout() under 
> ring->lock
> avoid this?

Yes. It is pre-existing though, bcmgenet_timeout() increments errors 
after
bcmgenet_tx_reclaim() has dropped ring->lock and the Tx interrupt is
unmasked again by then. I can fix it in net.

> [...]

  reply	other threads:[~2026-10-15  8:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 14:20 [PATCH net-next v5 0/8] net: bcmgenet: support larger MTUs Nicolai Buchwitz
2026-10-13 14:20 ` [PATCH net-next v5 1/8] net: bcmgenet: ring the doorbell when the last frame of a batch is dropped Nicolai Buchwitz
2026-10-13 14:20 ` [PATCH net-next v5 2/8] net: bcmgenet: let the caller decide whether to start the PHY Nicolai Buchwitz
2026-10-13 14:20 ` [PATCH net-next v5 3/8] net: bcmgenet: allow a continuation descriptor without the alignment pad Nicolai Buchwitz
2026-10-13 14:20 ` [PATCH net-next v5 4/8] net: bcmgenet: rename ENET_MAX_MTU_SIZE to ENET_MAX_FRAME_LEN Nicolai Buchwitz
2026-10-13 14:20 ` [PATCH net-next v5 5/8] net: bcmgenet: derive the receive buffer length from the MTU Nicolai Buchwitz
2026-10-13 14:20 ` [PATCH net-next v5 6/8] net: bcmgenet: pad transmit frames out of the packet ready window Nicolai Buchwitz
2026-10-14 14:22   ` netdev-bot+sashiko
2026-10-15  8:48     ` Nicolai Buchwitz [this message]
2026-10-13 14:20 ` [PATCH net-next v5 7/8] net: bcmgenet: allow the MTU to be changed Nicolai Buchwitz
2026-10-14 14:22   ` netdev-bot+sashiko
2026-10-15  8:55     ` Nicolai Buchwitz
2026-10-13 14:20 ` [PATCH net-next v5 8/8] net: bcmgenet: reassemble jumbo frames from status block fragments Nicolai Buchwitz
2026-10-14 14:22   ` netdev-bot+sashiko
2026-10-15  8:56     ` Nicolai Buchwitz

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=889b45fa87ee8eff3903c1b9e9b96316@tipi-net.de \
    --to=nb@tipi-net.de \
    --cc=andrew+netdev@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=justin.chen@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=opendmb@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=pierremarinleclercq88@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 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.