From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796040353; b=tHJjCOerg0D5PF8q4MGGZvXhQlVjeAWshG1KNgrgA35CIp6zB90ueVlqIyMIK4diy4Nz qNmc5tmMwq/OJ7HxMmZvawJzYJxTswG20NOZ6Al2e2S8Nh4ptRFKMyTeW91eTu6UC66qx y978lUg9rD0nFYWQqQ6RNGek0ok8GrgknSj/z7kM9iJD6INaY1i2cBKqS0qft3PrpVlUx wqyfWJncZ6dPLivG/rYb+oWEJkMZNDkniKRVA8xnR6Q/iVFXBm80x8S7Xl6UY6OXij/zo N29kCxizu+X8Ls3/XwyI8XmUiFo+hQhIBzt4OAg9YaSuRmbcZWHHgVpEyMKjcBhBC2w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796040353; h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References: Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=Vmpj+dgt3SgVJ3+YtA1/zdKW3wNLlkWR2+/6TT50Lig=; b=mbSVxP35OXr6x101lV5bBWp8FqirrPa3EamA519tcRco23o1kKzEtveW/9bTj8X3LofL Cyg5Hs0paadPr+PrsDzgXbmq5gwfT2INBCjmHvWua0N7ZuEQAjYFaMXlIgN0tobB/JZ7F ZIcjb3qcDeZORb1P948Z2ia+HfuKPMXES2aderPE+CCHKFlQPqWAM0kOaa+LylIbWAs6p OBfEMMmSj19GAyYFB1eajcj4qF2Tls97KDuU2SKsRvQWPOmr70CccB4fLlksvVlpDMXPx MybwRK0pb7GrD2TgburONCwQtnBwtAWNYbDA8HH6/WGPlB0mCtxkdTfGfAs9KTNiJbA== 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=hnegZSG5; arc=none smtp.remote-ip=100.103.45.18 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 DFA56606A327; Mon, 30 Nov 2026 12:05:52 +0000 (UTC) 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=hnegZSG5 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7C2D1F00934; Mon, 30 Nov 2026 12:05:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796040352; bh=Vmpj+dgt3SgVJ3+YtA1/zdKW3wNLlkWR2+/6TT50Lig=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=hnegZSG5Tv5y8BMQ3Sv6j9Cx2x2v8QUXqQ6qMggaX6QVA9f4t/3ujnjznKi1PZzKq f+PCOc/Fv6n0FLhI8O59qPlfsplRaih78xu4eg+z8JanwGMDEjF6jVQdsZ5jUtFVdU u70Xx3C6+KInd2Ls0PmAMUGXmPws+jL4J3jJL/ZJztx1qWUF3BkzmPnwhiTPhlDbC+ 9wqaz1Lz9bBPzhqDFCoeZF7Ryx64iDhJPNXbDzWilLUymMOHwxWsZbZ5C22ZvVjrhC ymM9hPEDrftiOUgXSlsiHGpLXbisYpnP7/G64QvNw1Qc+wKfO7Mkb1A/rgVgRBrAV/ CH6nr+JESgHMw== From: =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= To: Maciej Fijalkowski Cc: Magnus Karlsson , Alexander Lobakin , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Willem de Bruijn , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , Shuah Khan , netdev@vger.kernel.org, bpf@vger.kernel.org, Simon Horman , Stanislav Fomichev , Martin KaFai Lau , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Ihor Solodrai , Tony Nguyen , Przemek Kitszel , Larysa Zaremba , Tushar Vyavahare , Jason Xing , Bastien Curutchet , Colin Ian King , intel-wired-lan@lists.osuosl.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH net 2/3] xsk: Keep the shared info of zero-copy buffers in kernel memory In-Reply-To: References: <20261127142131.3527737-1-bjorn@kernel.org> <20261127142131.3527737-3-bjorn@kernel.org> Date: Mon, 30 Nov 2026 13:05:49 +0100 Message-ID: <87y0aazfqa.fsf@all.your.base.are.belong.to.us> 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: quoted-printable Maciej Fijalkowski writes: > On Fri, Nov 27, 2026 at 03:21:28PM +0100, Bj=C3=B6rn T=C3=B6pel wrote: >> A packet that a driver receives in zero-copy mode over several buffers >> keeps its shared info, the fragment list and its count, in the >> tailroom of the UMEM chunk of its head. Userspace may write the UMEM >> at any time, also while the kernel walks the fragments, and a >> rewritten list or count makes the kernel read and write out of bounds. >>=20 >> Keep the shared info in the buffer pool, which outlives its buffers >> and the queues that point to it, and let the device write up to the >> end of the chunk. One shared info per pool is enough, as a pool builds >> one multi-buffer packet at a time. libeth read it later, at an XDP_TX >> bulk flush, which the previous patch fixes. >>=20 >> Multi-buffer pools now give the device the whole chunk, as >> single-buffer pools already do, and allow a larger UMEM headroom. >> bpf_xdp_adjust_tail() can grow a packet up to the end of its chunk. >> Copy mode does not change. >>=20 >> Found by an AI code review agent, in its review of another series. >>=20 >> Suggested-by: Maciej Fijalkowski >> Fixes: 24ea50127ecf ("xsk: support mbuf on ZC RX") >> Signed-off-by: Bj=C3=B6rn T=C3=B6pel > > I applied this change on top of my changes implementing xsk.py in drv-net > selftests and gave this a run, plus a patch 3/3 was adjusted to fit the > new python runner but intent stayed the same. > > Test used Intel's e810 (ice) back-to-back connection, 84 cases passed 0 > failed. > > Tested-by: Maciej Fijalkowski > Reviewed-by: Maciej Fijalkowski Thanks a lot! Sashiko found a few real issues, so v2 changes this patch... Bj=C3=B6rn