Article View: linux.kernel.netdev
Article #24594Re: [PATCH net 2/3] xsk: Keep the shared info of zero-copy buffers in kernel memory
From: Björn Töpel
Date: Mon, 30 Nov 2026 12:04
Date: Mon, 30 Nov 2026 12:04
83 lines
11027 bytes
11027 bytes
netdev-bot+sashiko@kernel.org writes: > [Severity: Low] > This isn't a bug, but bpf_xdp_adjust_tail() in net/core/filter.c still has > this comment above its linear grow check: [...] > Should that comment be updated as well? Yes, will fix. > [Severity: Critical] > Can this overflow the skb_shared_info of the skb built by > xdp_build_skb_from_zc() in net/core/xdp.c? [...] > Should truesize be sized from (data_end - data_hard_start) + > SKB_DATA_ALIGN(sizeof(struct skb_shared_info)), or should the copy be > bounded some other way? You're right. It already happens for single-buffer pools, which give the device the whole chunk (Clément reported that case earlier [1]), and this patch extends it to multi-buffer pools and to tail growth. I'll add the apatch in front that sizes the skb head from the data, as you suggest, and gives a head that does not fit a page its own allocation. [1] https://lore.kernel.org/bpf/20260629072300.1664622-1-clecigne@google.com/ > [Severity: High] > A related question: can the LARGEST_ALIGN(len) copy in > xdp_build_skb_from_zc() now read past the end of the UMEM chunk? Ya. The same new patch copies the exact length, for the head and the fragments. The new patch fixes those. > [Severity: Low] > This isn't a bug, but struct xsk_buff_pool documents this section as > "Members only used in the control path first.". The data path members > start at the cacheline aligned fq. [...] > Would it fit better with the data path members? I'd keep it next to xskb_list, which tracks the same packet and is also used on the data path. > [Severity: Medium] > Does the shared info flag really stay for virtio_net in zero-copy > mode? [...] > Should xp_alloc() and xsk_buff_set_size() set XDP_FLAGS_SINFO_EXT > instead of only keeping it? xp_alloc_batch() would need the same > treatment, since virtio_net allocates through it. Alternatively, > should buf_to_xdp() clear only XDP_FLAGS_HAS_FRAGS? Good point. In the next version every buffer gets the flag when the pool is created, and set again. > [Severity: Medium] > Is there a window here where a head already has XDP_FLAGS_SINFO_EXT and > the new rxq, but rxq->ext_sinfo is still NULL? [...] > Would storing rxq->ext_sinfo before publishing rxq on the heads, with > release/acquire or WRITE_ONCE() ordering, close this window? Requiring a > quiesced datapath here would also work. Yup. As the flag is set at creation, xp_set_rxq_info() no longer touches the flags. I'll fence the stores rxq->ext_sinfo in the next version. Switching the queue under a running NAPI is older than this series. pw-bot: cr Björn
Technical Details
Message-ID:
<874icy1q5t.fsf@all.your.base.are.belong.to.us>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374150-linux-kernel-netdev=dewy.ruReferences:
<20261127142131.3527737-3-bjorn@kernel.org> <179587889144.3135.7516970201926139253@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374150-linux-kernel-netdev=dewy.ru From: bjorn@kernel.org (Björn Töpel) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 2/3] xsk: Keep the shared info of zero-copy buffers in kernel memory Date: Mon, 30 Nov 2026 13:04:30 +0100 Organization: Usenet Network Message-ID: <874icy1q5t.fsf@all.your.base.are.belong.to.us> References: <20261127142131.3527737-3-bjorn@kernel.org> <179587889144.3135.7516970201926139253@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="1419425"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:OCHDbMmvCJ0VqlzWi03JQdee5ew= sha256:RsTozEl/Xj0gHcKRE8s+aAhuevS1PriHIokBDdvjwYc= sha1:GFFgFkhbe5kVBIf8uFXcIWSqtm0= sha256:VIEO5F1b8LoBxBgXMoEKgZVbMZcCaoMTZktKccm6Mf8= 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 8F5D7125FDE; Mon, 30 Nov 2026 15:04:58 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 Cn3eGJg6F97P; Mon, 30 Nov 2026 15:04:51 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374150-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id C54A4125FD9; Mon, 30 Nov 2026 15:04:38 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 6D75E2D56E; Mon, 30 Nov 2026 12:04:35 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796040275; b=1rfoG148heeWRhKwZuua+MgqHaSILZj3iDOjbdL68ka0k0KOc2ntCWOOXftJCsNa3Tje DX76qG8D0vY1OcK3kOm+856pPmD2ktsZ7y75HwfKZXcrFW77UDDGkjh+bL5AhVxLOsFme itgvBcne0Tvv+oRvtVXZ/jd4LKo5rKWZ2tgeDaN2FAKPNXMmc1BqofDnFeDckKV/EcBlu XvNugQYPLIuWn0oWpkhlWaqbQDoXCVjusZZ2Z8rCyMiWoO9LWWShcytq3ZmZDHeU9IeeJ Ya4D3tQf9t9EZxEuLAsxnVIxUwBJ/4uEDr41NzY3iEcsLzjv9HSXbfqezxljknZIFcw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796040275; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject: In-Reply-To:References:Date:Message-ID:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=DzbqwW4JXJW3AAdWGxmBbmR4xHld/NFae+5WqSDMoF4=; b=2N3YL8v8JHrY36jbI2zbC50MOhcexNUJ9bFmhkMqoiQwpMR8SRlASktP4j0GuiDvLtFi uoI4OEh/pDIiIAOkzmy/oAph1Ar7i/XkDZG8r1YM01QpM1kqWRieLTuBnAHx99/FTBtQ9 e2Q+DFOQFQfG7j+E7SVnpdN4DzU/zvMkfih1CleA0y3Be0gxXEho9rbX6l4NQq/Tb8xNs UPTjF+pkDsPXFibS9dcsLt2rWietU0Gly81nsfOTB3kwwhMyYCG4wuH06+tr8gDSviegC gxHIBbhlvt/f4lU2pmF0GlLoJkwrQyu7/BBWy5tjl1OieQ5M5GHxMo4/AfCzxbj2UFA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=R91Gtvyp; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 41093606A327; Mon, 30 Nov 2026 12:04:35 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=R91Gtvyp X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796040274; b=skaqLZbs1tfpPt+amBFk86YuMw0Z6UMgLgAR2ZD0Xfly8Z2TDep4raGXcO1H4s4mmhCS aXkjS8q/sQ8JLcQWhuspfaIWQlpM5anlFNpYfA6SSerzDXEhCbdPZfVTF1/8nfxevLv9h c56DEWC7Cup7EttaolgHkMYYn26xJxFEIUmfS+EFwnGAMtxEkBt4nh7d0rmUacHAbmolZ h/+RIpnJqzUHo2GcFS5uhtbAo2b+0Tjr0hg2DMZ3zG5LgxuqHIfq+2Pdxy4S4MqJxPfJ+ 9gybd/ix5WdpRSYCiL4yRXDCgb8g2UgrIPlLn+2YYOQMqbEe7mEQZasfIJlCOaYLbPw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796040274; h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References: Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=DzbqwW4JXJW3AAdWGxmBbmR4xHld/NFae+5WqSDMoF4=; b=iIWUcw22W6eWmSLnlGEOBZvzLxWDAEC9biCp+pOsJcCfENv1JRyJXbZ8qRG0HOPnNvnv fcyMiI/+jkzMkkjnctQN0iY9lVOs4/+FQkK/4iMzzZd2tBX2B+BL4RzlVFVj2NjJ4eaSu oKZq+APg7pETFrJvf1axh4WHSta4RcBUECrpQL3tDvvSpV3kCc5bhd5AmBn8ZDCmhOA9j sppNnEsgxAeSZQX7oJ0cA/meHybTYKzcRDFsAm4jG3z8DMG8wr1drezLAYZJoSotVx2MJ 3/BXDeG6XSJlQCfxWMU/iByUUoGNQwkYTlwUk/kHReOWMhhkgHMOpmkjSra0dY3k6oQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=R91Gtvyp; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DA7E606A31C; Mon, 30 Nov 2026 12:04:34 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2913D1F0089C; Mon, 30 Nov 2026 12:04:33 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796040273; bh=DzbqwW4JXJW3AAdWGxmBbmR4xHld/NFae+5WqSDMoF4=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=R91Gtvypq+UpGo+AzsFgfRQSfMmfPpmHh+jCEuRkjdXN93YoBRYQKjHkpmvf2PBzL Ww+LJ1+BVn6nY1mlCunYFV0eps1KdFGGBIX9DhUIIAnQyZWNe+jw4aUeDehLcOQPQO OTtBV2HHecA+zPS391RpazlJg4rnx/m3WiKdf2Ut5zw30eIEdKiVXAE2Ne4OUaweUM GALUuRBjpdaDvspahz0U9eAnEb212U77sIoj413EDpNa39SlNLIJSaLD6PyQmZ68DA PrTq+wV5xpvjsH/yp2OLHiY+FxAJ7tVusa3MutcFMud7FC1T8eNwmOkusYEoUhWHLS Z+oRvIvk2aKuQ== X-Cc: magnus.karlsson@intel.com, maciej.fijalkowski@intel.com, aleksander.lobakin@intel.com, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, shuah@kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, horms@kernel.org, sdf@fomichev.me, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com, ihor.solodrai@linux.dev, anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com, larysa.zaremba@intel.com, tushar.vyavahare@intel.com, kerneljasonxing@gmail.com, bastien.curutchet@bootlin.com, colin.i.king@gmail.com, intel-wired-lan@lists.osuosl.org, linux-kselftest@vger.kernel.org X-In-Reply-To: <179587889144.3135.7516970201926139253@kernel.org> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list