From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.180 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796568293; b=r4HQ9I3OZSZ5+Mbt26p4siSjQIzfldPWj1CFOpaItMiZ+/AdX2hPw0haf4asTAtCxOLQ JDCIiREL6jE456lDc1wWKgfdf0NsH2BCa67IbES4iV9QyvlRBGAog9rR8Kbg5DaxkUUoQ +D2nTijEoBKfvxzH7uH2C76FqsrUbTTw6C/ruhkoXq6IBVBTROnMeL/BWuDxq07r1aO3J gKO878cfS5SC5PbLbZJZoYdhQDESOI7kKHcxRlqWQENdAkYRsEwC/beWqzrj1w/bHuzCE ptbfBmbID3wwM3YZsUdotkHimq+vtS3uBzxUXOpMBbolS8T6MsnNkpM2rFDfhv+S2rQ== 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=04eTROByEdzWhvTx5Mo98a3Hig9MZmqf9UL48Ocmbbzo95B0Bn4cUVGWyhmjiUef5UM0 x4QN61OpQfPgx4dcJWpHGeFZp7OzY1tnP4baNvz+M0SZXp61gudKBwBlPOClG2WVl88Gu /RmXYHDwHYGfeYunVph92pxrZl8ElRxYN6ORucIJu1ZvHwzowjOz2L8pgRMZ3KVWkHolS zqkclX2FuEk5CWt646UoGNaaXJB3bxpTA8e0i0Mo2fNJlPsIwme4WJXOynJF1zPCpmR72 0W2wCw8qorKAdBPVmFmxa+esYiMf15z0C66Nf/AqNV+0e5geaon7xAFsn9DwCCY+Iyw== 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.180 Received: from mail-dy1-f180.google.com (mail-dy1-f180.google.com [74.125.82.180]) (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 F1FB6606A321 for ; Sun, 6 Dec 2026 14:44:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F1FB6606A321 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-f180.google.com with SMTP id 5a478bee46e88-3282db206d3so2072384eec.0 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=Gx45eLFNAFtAM0KjOJ17i7Hf8b1ab/JC+55F4Fraj5NrNNCXh2hsao3kxjnSIj/Mpx f8t0pnQNxsNlXappDm3cjiCrI7n8zLXLUbRiH2fQsK2uQJCol3mTLAcsqs2hVhS+yl5m /ppcBMD3637kumDW7c3spea2gcQaDPVizZ7S9Imc5NkJPNK6WJGKeqj69TMtxvakKc29 iVJmZwpXTNA9OnG63xrKOK4f9dXTe0WLW0dobX5FfWMe/mscBrlPapQxneX5utk0mI3s 29dL/Y2fnDUoSzZfDBoRcJU3P1KT8WCOM28ZsPGTu1AHFIxioYKntw8qhiAO5+HsorXe 6jWQ== X-Forwarded-Encrypted: i=1; AL+hErFt614s5XV8ZI8k3ph2m9vST7g8YlZNOF7+3VQ2pkx5BAtCid9d5++bNBVDyxB8f8n6AktqxSR8UPo+rx0=@vger.kernel.org X-Gm-Message-State: AB4q+uEhYkEfzw8B2hFzgqVBQsAXcrvFDj5hkNzkZ39tJrOxEtKBgGxc dXtuxWKA5vwJTxE2B9mxI/nQ3qoLzoYcbSvgxdERIQ7nAwp6cBDvwI/r X-Gm-Gg: AZFdTZdGqgrefDoBgBK5Z92SGtPB7yxsLKtgYdAkYX8uXpk3FdWO49Oz5AiFmkogn8J FAnt/y5YEsvEry5Y16yo9+tjxiXUGAQ9e12wOMhHUUuZuYhWqDm8NLwhLb/F4w2bwXGLZ3vPySw YzoRvrSEtJqCfLFDtjkQbImIp8KtUQwxUHPoauxSQjjXSfn4+8oN46LrZB6iQglsibxe37tiM9H 8RxDF7U+wzRDC4Ddh9rANkjzyX+Pv0J1SeJyzD7XyETxvjDyVQgX/KunvF//ojzlpme91FK/Bzv MG/G2UQThFXMvjzHLqcccoBrN33e5Lr8tfextz0tc0M6SuP+rUq7VPMIND7iiO8JCD/9tO9fPCq SSz03yt5DdkqhgGxznxhdtIqFI3UaChbCBsB5spGrVMD2Rs5K1EZB4wCQGDrDG/1KTVS7V9FTLp sRSdfWCc25lo6b7WatwOvSqTDb9Y/OswJyiDSVTgFFlR8CZWiiqHTHCfDDcXH1tv6TGTqzAXgIu 4E0LFhsRkOhdg2VjD42Hfx4s57dOCdx4mYXzSBA8UFnpJzVy+YpF9ojrb/rLUcjZ5/kZxfE9fQN 8Q5QGRnMrSmCWMCJdzaRSmC5dSGRKi94etWx2xa8FPB3ShqmxVq8VeEH+H2+fBQqV9gQbKPbuC0 1+sW2sb2B1HOC5+rjqmcoDce/td+mLGaYYxtihzkcqYBCmMSJVVCoDwZua4e8hZ4uxEwBsUVQK/ VPRZMHcJoAh11aGpbbeUaCQVLgILetautBew== 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: linux-kernel@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