From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a5-smtp.messagingengine.com (fhigh-a5-smtp.messagingengine.com [103.168.172.156]) (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 E1AFA35E94E; Wed, 2 Sep 2026 01:48:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.156 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788313729; cv=none; b=B0/sppUrsPbKrCHz/jGYrvblIUXWXQv4GE3eLhRyKZ4Hoe2WaDkKeCfFLZ2lpCwjwuS75vWvCepYucAnyNTC6zfew1xO3Sdx8Y0aVRMl9+hgdhYOO4rRggrznNBSUejPSTyljmsR1vr+MJqQB8x7VrtbK7zFV01qIE/9MayQq4c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788313729; c=relaxed/simple; bh=ZUc4hXdMovvUBU+bVv6Yj0xXP2zTmYbEUCvk1alUn+4=; h=From:To:cc:Subject:In-reply-to:References:MIME-Version: Content-Type:Date:Message-ID; b=Suqx41+oz0NsnBhqK6M0XAgMncZxSAjREgXhtIjzzXnwYvb5C+WkDFQC42K9gKfhdomPlLc72gNb4QM7+DzK5H5n691nCIc2gAEgzTyV/7zPgkI/8QG4IUr8ouxsG5+T/RBzzLCLkVDxeuhPKZYejcnGK4nvWRajlkONhfTsWDU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=jvosburgh.net; spf=pass smtp.mailfrom=jvosburgh.net; dkim=pass (2048-bit key) header.d=jvosburgh.net header.i=@jvosburgh.net header.b=nIffXOkk; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=cw1+p392; arc=none smtp.client-ip=103.168.172.156 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=jvosburgh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=jvosburgh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=jvosburgh.net header.i=@jvosburgh.net header.b="nIffXOkk"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="cw1+p392" Received: from phl-compute-08.internal (phl-compute-08.internal [10.202.2.48]) by mailfhigh.phl.internal (Postfix) with ESMTP id A84E61400101; Tue, 1 Sep 2026 21:48:41 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Tue, 01 Sep 2026 21:48:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jvosburgh.net; h=cc:cc:content-id:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm2; t=1788313721; x=1788400121; bh=s0Wp34BsCTE9gs9qeINPy /sDm+yywWKNSe4d08o5iQc=; b=nIffXOkkv0LGjh0ICsZlIEuSr42xQZrVSxIgt qPZeZWm7psTnv6+DM+lt8adamlZiGMbhY4mcV85vUwgliOFoIhwvWbs2dMDyPuEC yOHSu25t/uCFGkEgGBzw5IXZFfwuIn7cL+5MGEwWJUWMBEzAmmpi8PuQukVaSMyb udPNbngokGq53v/Su/Mu8dAeDNbfe9ncZXpi9+cHwCJ8C9J/TwzU8BtoSHFRV1a1 FrPuMcy04z1OGX0H7XL93H3PNibowPS+WT/NILLN8BqssivIhyZofH+E1OqSs3bd YOhaWKHdGLfvvF2vCBywn4tq4JnAYWWC+pYrYkHFedZcTjgiA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-id :content-transfer-encoding:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s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5hy kK8aIKHhhsErrV4lE/OwMXlgzDyUeuaOT8kTdmdmyviULqyHTtdB5L6tI9LA X-ME-Proxy: Feedback-ID: i53714940:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 1 Sep 2026 21:48:40 -0400 (EDT) Received: by famine.localdomain (Postfix, from userid 1000) id 58F2B9FC75; Tue, 1 Sep 2026 18:48:39 -0700 (PDT) Received: from famine (localhost [127.0.0.1]) by famine.localdomain (Postfix) with ESMTP id 5644D9FC41; Tue, 1 Sep 2026 18:48:39 -0700 (PDT) From: Jay Vosburgh To: Hangbin Liu cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Nikolay Aleksandrov , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Hangbin Liu Subject: Re: [PATCH net v6 0/2] bonding: fix TLB load-tracking overflow on high-speed NICs In-reply-to: <20260831-bond_overflow-v6-0-ffb0ed1f7268@kylinos.cn> References: <20260831-bond_overflow-v6-0-ffb0ed1f7268@kylinos.cn> Comments: In-reply-to Hangbin Liu message dated "Mon, 31 Aug 2026 09:50:58 +0800." X-Mailer: MH-E 8.6+git; nmh 1.8+dev; Emacs 29.3 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <591551.1788313719.1@famine> Content-Transfer-Encoding: quoted-printable Date: Tue, 01 Sep 2026 18:48:39 -0700 Message-ID: <591552.1788313719@famine> Hangbin Liu wrote: >The bonding TLB (Transmit Load Balancing) mode tracks per-slave and >per-client transmit byte counts in u32 fields. At sustained throughput >above ~3.2 Gbit/s over the 10-second rebalance interval these counters >wrap, causing compute_gap() to produce incorrect gap values and >mis-select transmit slaves. Such speeds are routine on modern NICs >under heavy traffic. > >This two-patch series fixes the overflow by widening the relevant >fields to u64. > >Patch 1 converts the unbalanced_load counter to per-cpu state as a >preparatory step. The counter sits in the transmit hot path, so >converting it to per-cpu before widening avoids introducing cross-CPU >synchronization overhead for a u64. Also use a prev_total_unbalanced >to store the previous total load to avoid reset per-cpu data. > >Patch 2 widens tx_bytes, load_history, load, and the per-cpu >unbalanced_load tx_bytes from u32 to u64. It adds u64_stats_sync >protection for the per-cpu counter to prevent tearing on 32-bit >architectures, and reworks compute_gap() to use s64 arithmetic with >READ_ONCE() on slave->speed. > >Signed-off-by: Hangbin Liu For the series, looks good to me. My only nit is that you don't state why you use READ_ONCE for the access of ->speed, and I didn't see it in the prior discussion (perhaps I missed it). Regardless, I presume it's because the access could race with a concurrent update in bond_update_speed_duplex. Acked-by: Jay Vosburgh -J >--- >Changes in v6: >- Do not return fixed value for unknown speed logic, we need load balance > even NIC speed is UNKNOWN (sashiko) >- Link to v5: https://lore.kernel.org/r/20260825-bond_overflow-v5-0-7a800= de133f1@kylinos.cn > >Changes in v5: >- use s64 as the return value for compute_gap, so we can compute the > difference when NICs are overload. (Nikolay Aleksandrov) >- Link to v4: https://lore.kernel.org/r/20260820-bond_overflow-v4-0-805ba= 0d3efb6@kylinos.cn > >Changes in v4: >- move per-cpu allocation to tlb_initialize/tlb_deinitialize (Nikolay Ale= ksandrov) >- use an extra prev_total_unbalanced to avoid reset per-cpu data (Nikolay= Aleksandrov) >- Link to v3: https://lore.kernel.org/r/20260818-bond_overflow-v3-0-e05d4= dbc2fd8@kylinos.cn > >Changes in v3: >- Add a preparatory patch to convert unbalanced_load to per-cpu first >- widens tlb counters to u64 and add helpers to prevent tearing on 32-bit >- Link to v2: https://lore.kernel.org/r/20260814-bond_overflow-v2-1-d3fe5= 88ad167@kylinos.cn > >Changes in v2: >- update comment description, including AI-detected info. >- fix tx_bytes/load type detected by sashiko >- cast SPEED_UNKNOWN to 0 before shift, detected by sashiko >- Link to v1: https://lore.kernel.org/r/20260810-bond_overflow-v1-1-c9ff2= 9d76770@kylinos.cn > >--- >Hangbin Liu (2): > bonding: convert unbalanced_load to per-cpu state > bonding: fix u32 overflow in compute_gap() > > drivers/net/bonding/bond_alb.c | 63 +++++++++++++++++++++++++++++++++++-= ------ > include/net/bond_alb.h | 14 +++++++--- > 2 files changed, 63 insertions(+), 14 deletions(-) >--- >base-commit: a8455260b2e9c024d1872ac1c094793d55a7e537 >change-id: 20260806-bond_overflow-ac6a6a78d6a0 > >Best regards, >-- = >Hangbin Liu > --- -Jay Vosburgh, jv@jvosburgh.net