🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #3495

Re: [PATCH net-next v5 6/8] net: bcmgenet: pad transmit frames out of the packet ready window

#3495
From: Nicolai Buchwitz
Date: Thu, 15 Oct 2026 08:48
57 lines
7852 bytes
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.

> [...]
Technical Details
Message-ID: <889b45fa87ee8eff3903c1b9e9b96316@tipi-net.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346617-linux-kernel-netdev=dewy.ru
References: <20261013-nb-genet-mtu-nn-v2-v5-6-076b6fc240be@tipi-net.de> <179198777582.434549.9712346725032064776@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346617-linux-kernel-netdev=dewy.ru
From: nb@tipi-net.de (Nicolai Buchwitz)
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <889b45fa87ee8eff3903c1b9e9b96316@tipi-net.de>
References: <20261013-nb-genet-mtu-nn-v2-v5-6-076b6fc240be@tipi-net.de>
 <179198777582.434549.9712346725032064776@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII;
 format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2488698"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Oq6ItjA7K5BdBBpFIhkRbUEJOzY= sha256:9Tf1k1KlXbUa2YOGU6zX/imkfIbATcvXHoYRb67/D3Q=
	sha1:gF7pTPN10ZXE0lyeNXZqOYRw094= sha256:3Kjv7xi2QOWJ2zUmTkUIHBDaIpgZtBA8KW6xeuCOki8=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 4309A110284; Thu, 15 Oct 2026 11:53:33 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.749
X-Spam-Status: No, score=-0.749 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=tipi-net.de
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id QoIZTJZulsS2;
	Thu, 15 Oct 2026 11:53:26 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-346617-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=tipi-net.de
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 15D9D10F7E9; Thu, 15 Oct 2026 11:53:16 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sea.lore.kernel.org (Postfix) with ESMTP id 6B0332929A; Thu, 15 Oct 2026 08:49:11 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id C09EE4CB8BA;
	Thu, 15 Oct 2026 08:49:07 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b="ieejP6NV"
X-Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CFBC4CDA3F;
	Thu, 15 Oct 2026 08:49:01 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.13.80.246
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1792054147; cv=none; b=TXkzqU97jnHlMlFxYVMtFhRv+TauXYoPqsvpqbUS9Q8HIQpyopupcV2i5RoMCDq+2FW5fa3IR/5hov/tmvZejAeNWp6/ljtHT2f+azFaDVhqI1GpaNj1nm89RCSQTPAjXahqhmR3lxQ5sNNZ7lSqwDmNkBVEsyNJqXBCU52FtAg=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1792054147; c=relaxed/simple;
	bh=Hiqd/zvvKBmiQKIQH5rMJyLgZE4DjkUbPRiNbDZoKBE=;
	h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References:
	 Message-ID:Content-Type; b=i+YN22sePqMgyUNW4GecJhoQnY+k1SuSSlj20N8/B5aMq41i9DM9TfAlmHFIu3s45FmvUqPCITlszX04/l0KunYFP5aQFpGVqY4k4kc8+YD+gZpnEVz56VbQvbGAKdVHGSh6e0Qx+9G4LNy3G5BIiAvJ1ZXX4JBujOmp9j4anKI=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de; spf=pass smtp.mailfrom=tipi-net.de; dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.b=ieejP6NV; arc=none smtp.client-ip=194.13.80.246
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de
X-Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 43239A0919;
	Thu, 15 Oct 2026 10:48:56 +0200 (CEST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim;
	t=1792054138; h=from:subject:date:message-id:to:cc:mime-version:content-type:
	 content-transfer-encoding:in-reply-to:references;
	bh=U03P+gee1kqHVbwU1qUibsCZEopODaXsBUYp9T2uy9k=;
	b=ieejP6NVk6AbGAbWq0+x/TNkMvAjaehMgUEpdevm3Ke56m8Yuj8t1h5Sm0TudEwZ2uzqt0
	BRVPgzf0R1Kpe+FGIIMlshE8sp8SumymjVCIHNMbqqXMSL/PSEOJ66Qnrj5joAA/7IFdYi
	iRgiDf4H4h0GQ2wdr5FanscxG8Noyv/iD1amZXIyG1Qt8xPqkq0fXH7uI8ok8+cRW9VUC/
	EI5UvL1+TTUtqj/GruT/LNEWleDGUuLaG11wbT1iBxQIjp9PNXyd4W4isyDXZXuvAZJAtC
	PBfV9r4yoq62xhGci+NmEYThrmhzNkVJl/3VTjigvPyPkPPxKRCTHfhCY8po3Q==
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-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
X-In-Reply-To: <179198777582.434549.9712346725032064776@kernel.org>
X-Sender: nb@tipi-net.de
X-Last-TLS-Session-Version: TLSv1.3