From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.181 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796568293; b=F29mE+GA3DmqmJrz7kzVrvam6j5oZkAqTVwT+Wv0h5KrPB8WCPyDy4Czb65eYlFX9d6q Py0bRKxjepnqMh0nmjjgpXBhs0V1QLtkapS+nONnMzIGZp4aVhlDluy8A7+oBJ1s+YAgU P2vxm5RY6zQyQdaCuXNJB+GcvVqTMVKFbD+olh7TFIudvvQ9Po3uK71k93G2/5Bz4e2gk axwtRdor1Hp4zfG9LbN/R82+kwdLNsCfAtPj/e5nuMuH9xZHf8QtY3KivyapK9BcfJAHN yB4vRZKAT3iMICcwQD5qjhkanGBRKZITviWx3CCtdE0YAfOnxvlng3LS5+sQGUy5jbA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796568293; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:Subject:Date:Message-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To:Cc:X-Mailer; bh=NI03b0f9QhE4pE5igXokD5F0fiDH4efLxafFs53zpi0=; b=HO8XcoolYdJjTfZ75tybg10vtIi7tumaSyrO6VHxIj9Sin/hbcbLisJqKHzPzzEfLZWF 9mesShpFIiiHVHFCXIcEMsr9Rb07PIAJYoPWMHyEuIrP9OjeDAo54GXW1yuggA+q2hb37 j8KRlQ5NiYPrbwMTbRbnq6lb4JBHH1ijOzZTdteA4rhLD8Wtuw/3pz4ZYVywOOQQotox5 MNhM2pZbRM1oB74eugiycDB2E3UsdxtvohfLMvZXQfiBhqfO6gjlbbKf/Gp5lRjJLfarM i+wTJe+OgH28gNEADX7lQ7uzklgS1qEzmaOlIu53niSJP1zAxo9nOSww0Xb0xdYQIIw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=yn4vOEvA; arc=none smtp.remote-ip=74.125.82.181 Received: from mail-dy1-f181.google.com (mail-dy1-f181.google.com [74.125.82.181]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF4A3606A31F for ; Sun, 6 Dec 2026 14:44:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EF4A3606A31F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=yn4vOEvA Received: by mail-dy1-f181.google.com with SMTP id 5a478bee46e88-33fb4680717so1834468eec.1 for ; Sun, 06 Dec 2026 06:44:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796568292; x=1797173092; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:content-type:mime-version :message-id:date:subject:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=NI03b0f9QhE4pE5igXokD5F0fiDH4efLxafFs53zpi0=; b=yn4vOEvAyFZWB9OScCkzKKMPvDdoI/WwqnQ5O2gQ6A/X02uf8oRYdu/R3cPAXm4ykb LXmmQDlkCTMSuZwpz0Oz+0URUtEfOcLqBo8Eky8lIfOHMFl6VJOgtO05PGLRvLTJ1n/V XIBKJLMF+/kCmWlIxfsDPn8LPwbo6ygxDfwXXOYr1//BADDmloMDFgo6VKteFkE7s9NE st9IFhqCnbi58ZYLYdAvZ/YSPFSvPr23kx8tsyZ1uVS/GZZ3v2qdgoi3TbpTG1AfZYAi TwnY17zdCf6f/dwhqebNYrP5FLhGAvwi4NqGuaULk5QYCGjR4Xu2oqmlUovRkiAMOVDe +lnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796568292; x=1797173092; h=cc:to:content-transfer-encoding:content-type:mime-version :message-id:date:subject:from:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=NI03b0f9QhE4pE5igXokD5F0fiDH4efLxafFs53zpi0=; b=2U1rYxqYOQHBpBAwmc0A9evGuvhQe6QZBvviG6V0p4xdnM192hetc4OzCx2raydDXl 9S0WcbN7emgBArdfViUQxpBdv5SL2q2Nf9cpHfy5FoBOp/GeLd7pb02B53feQdN1fnek 0N4ZGR3/DCb4xcpLuoC5xySU808g6xbornukXeWHO9yQpkAuZMcoR1EBWgWyH3pL0iHL wnyUSDca5nNQNNdcBfnE6OrjyGGdcrzCKCv9hMD7lQ3ZD+xAfaRbxCW7QD7UsVgKONKo Um4KPDCOsn++xj5Phoe+5v86YJNzDLAW0XF2pT+kin5mQCCtFX4kY6m/B2p7VR9FEC4a zg0w== X-Forwarded-Encrypted: i=1; AL+hErHPVFceZXWCca+tfL/d/valXx31SYnPROkWBdmF2lm6/nixh3baFw4aIBJM0OoEEEDADF1vvnQ=@vger.kernel.org X-Gm-Message-State: AB4q+uGgjCvFcva+guK5f5sZBKuGKRG54DbiNIrBcjrrmaFvxbL3eJwH CyEthHZA5+VyZJwQ3SUo5+whJNGP1laLyf91yOm4iBKkquFQ2AjaiAJv X-Gm-Gg: AZFdTZcl/6CUvTiSL0PaQF9rmxs65tqwmSb7srpQwHI0G6bfQkkpUHY+s3uY6yLwoTc W60JcpqhR9/W117eEUC0KlzazvveamLc3jf1V2WhdyckWiBEkkesO2S2aeaSZ9FBI77Us+bgjoV TJ3jGGH9I98wqEIFD57cVhoqNIY5z02i3pEhRjaHodpcbY0Kz94SCHac39u6lOMVUWxZFaSxDAq QOCo4JqGuvpkG2ARn1Zllxx3YN2iTJubFyyfkfABXvuy+huuO3/6bmsg2bIG2W5BdF6k3i7xEn8 b1657g/GT54VqqvuCLamOUYWR6gn2c50iYFXtTZo/ORNP8nDT66ungoAz4/on1zy5slFNaymAEd WIc7VdUR47YQBeQyeTzrw0vk4RJC9gkMIGuuwiJ07tbv4fvICgPD7vrxOx8N1Ck5Bh1Rwx30BqC r60KiIskvXvzW8sUQDWQehSWoxhn4HFzG23o9LPpRV9bVUAsYEGdwdrkcsrSsJXwwOT5uLyTUQU ZARB6CfTlpPs72m3ZN0GSi/uKKmK7KMiymByTJu1MleWSwnX/jsvzUKLVpUOMBALuhUhukWq3gh beDv5jWwP9Esj5pB5f4ZnbrrlHRkkQdJLflJlmijUT9BOFzZoq8paRk46ICibP4fcnlVtndTYMp +eu6qEEWlk2S3OeUwBKRbUUn+ltemJ6W5sbTIFyrqdhQzXhrV+OFCdQ8AghoFUlWO26jcWgZLUD 2oQ6UW5hYfrXdsvPlcRcMWbnTohxqYnC8Gyw== X-Received: by 2002:a05:693c:83ce:20b0:385:ce95:2e14 with SMTP id 5a478bee46e88-3875216af6amr8087647eec.30.1796568291986; Sun, 06 Dec 2026 06:44:51 -0800 (PST) Received: from SeungJong-Mac-mini.local ([210.117.237.143]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-387521e1c55sm28623252eec.16.2026.12.06.06.44.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Dec 2026 06:44:51 -0800 (PST) From: SeungJong Ha Subject: [PATCH RFC net-next 0/5] net: make tx_queue_len changes all-or-nothing Date: Sun, 06 Dec 2026 23:44:41 +0900 Message-Id: <20261206-tc1-txqlen-commit-v1-0-ec9f34dce973@gmail.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIANl0FWsC/yWMQQrCMBBFr1Jm7UAytUXcCh7AbXGh6URHbFqTU QKldzfV5fv892ZIHIUT7KsZIn8kyRgK2E0F7n4JN0bpCwMZai2ZBtVZ1Px6ckA3DoMobsntvKl 73zYExZsie8m/Zgen42HdAisGzgrn/yG9rw92upZhWb7NOfcQhgAAAA== X-Change-ID: 20261205-tc1-txqlen-commit-42c8f03df652 To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Simon Horman , Jamal Hadi Salim , Jiri Pirko , Andrew Lunn , Willem de Bruijn , Jason Wang Cc: "Michael S. Tsirkin" , John Fastabend , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, SeungJong Ha X-Mailer: b4 0.15.2 This follows the discussion of v1 [1], a different fix that sent NETDEV_CHANGE_TX_QUEUE_LEN again after a failed change. I proposed preallocating instead [2]. The only listener that can fail is the driver of the device itself (tun, macvtap or ipvtap), and its resize already changes all rings or none. So only the qdiscs need a separate allocation step: prepare qdiscs -> resize device rings -> set tx_queue_len -> swap qdisc rings -> notify Patches 1-3 do not depend on patches 4-5. Questions: - Is rtnl_link_ops the right place for the callback? A ndo does not work because macvtap and ipvtap use the net_device_ops of macvlan and ipvlan. - Patch 5 ignores the return value of the notifier, so an out-of-tree listener can no longer veto the change. No in-tree one does after patch 4. The only in-tree listener left is rtnetlink, for RTM_NEWLINK. I kept the event like the ones of other link attributes, but it could become a direct rtmsg_ifinfo() call. Should it be removed? - The three new Qdisc_ops are not documented, like the other ones. Their contract: all three run once per tx queue, so more than once for a root qdisc shared by them, and commit and abort must do nothing when nothing is pending. Should it be written down next to them? All new qdisc rings are allocated before any old one is freed, so a change needs more memory at once. I found this with a prototype static analysis tool I am developing. It flags error paths that return after a change was already made visible to other code. The analysis, the reproducer and the fix were written with Claude Code (Claude Opus 5.5). I reviewed every line of the patches and the commit messages, and re-ran the reproducer myself. Tested in a QEMU VM on net-next d5cf954cebe4 with KASAN, lockdep and kmemleak. failslab failed each allocation of the resize in turn. Before, 37 of 64 runs left some qdiscs at the new length; after, none. tun, macvtap and ipvtap no longer announce a refused length in RTM_NEWLINK. All rings follow on growing and shrinking. tc-testing pfifo_fast.json and fifo.json give the same results before and after. Not tested on hardware. [1] https://lore.kernel.org/netdev/20261125-tc1-txqlen-renotify-v1-1-6c8e9c4d0503@gmail.com/ [2] https://lore.kernel.org/netdev/CAGAB666kgzt9SF+QgAQ3ZnwhP3624P64Z89e5+uUrW0Pkkkdzg@mail.gmail.com/ Signed-off-by: SeungJong Ha --- SeungJong Ha (5): ptr_ring: drop the unused gfp argument of __ptr_ring_swap_queue() ptr_ring: split ptr_ring_resize_multiple_bh() into alloc and swap net_sched: change tx_queue_len on all tx queues or on none net: resize tun and tap rings from rtnl_link_ops net: change tx_queue_len only after all allocations succeeded drivers/net/ipvlan/ipvtap.c | 13 ++++-- drivers/net/macvtap.c | 13 ++++-- drivers/net/tap.c | 7 ++- drivers/net/tun.c | 73 +++++++++++++++--------------- include/linux/if_tap.h | 4 +- include/linux/ptr_ring.h | 86 +++++++++++++++++++++++++---------- include/linux/skb_array.h | 14 +++--- include/net/rtnetlink.h | 5 +++ include/net/sch_generic.h | 10 ++++- net/core/dev.c | 24 ++++++---- net/sched/sch_generic.c | 106 ++++++++++++++++++++++++++++++++++---------- 11 files changed, 235 insertions(+), 120 deletions(-) --- base-commit: d5cf954cebe4f175dfd834e1dc471a3aa203ec7d change-id: 20261205-tc1-txqlen-commit-42c8f03df652 Best regards, -- SeungJong Ha