Article View: linux.kernel.netdev
Article #25239Re: [PATCH net v2 1/4] libeth: xsk: Count each XDP_TX buffer on its own
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 12:39
Date: Tue, 01 Dec 2026 12:39
122 lines
12294 bytes
12294 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 ยท High: 1 ยท Medium: 0 ยท Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The patch does not repair the idpf in-flight XDP_TX count it
says it fixes.
--
libeth: xsk: Count each XDP_TX buffer on its own
This patch stops libeth from reading the XSk XDP_TX buffer count from
the frame's shared info at flush time. Each XSk XDP_TX SQE, head or
fragment, now counts as one completed buffer and carries its own byte
count. The head SQE also counts the packet.
> diff --git a/include/net/libeth/xdp.h b/include/net/libeth/xdp.h
> index 898723ab62e81..66a3c4ec9967e 100644
> --- a/include/net/libeth/xdp.h
> +++ b/include/net/libeth/xdp.h
> @@ -1794,12 +1794,19 @@ __libeth_xdp_complete_tx(struct libeth_sqe *sqe, struct libeth_cq_pp *cp,
> switch (type) {
> case LIBETH_SQE_XDP_TX:
> case LIBETH_SQE_XDP_XMIT:
> - case LIBETH_SQE_XSK_TX:
> cp->xdp_tx -= sqe->nr_frags;
>
> cp->xss->packets++;
> cp->xss->bytes += sqe->bytes;
> break;
> + case LIBETH_SQE_XSK_TX:
> + cp->xss->packets++;
> + fallthrough;
> + case LIBETH_SQE_XSK_TX_FRAG:
> + /* One buffer per SQE, see libeth_xsk_tx_fill_buf() */
> + cp->xdp_tx--;
[Severity: High]
Does the sign of this decrement match what idpf expects?
The count is now one per SQE. On the send side, though,
libeth_xdp_tx_xmit_bulk() adds to the same counter:
include/net/libeth/xdp.h:libeth_xdp_tx_xmit_bulk() {
...
if (sq.xdp_tx)
*sq.xdp_tx += n;
...
}
For XSk XDP_TX, idpf_xsk_tx_prep() points sq.xdp_tx at
xdpsq->xdp_tx.
On completion, idpf_xsksq_complete_slow() starts with a zeroed cp. After
k XSk XDP_TX buffers complete, cp.xdp_tx holds (u32)-k. The driver then
does this:
drivers/net/ethernet/intel/idpf/xsk.c:idpf_xsksq_complete_slow() {
...
xdpsq->next_to_clean = ntc;
xdpsq->xdp_tx -= cp.xdp_tx;
...
}
That adds k to xdpsq->xdp_tx instead of subtracting it. Doesn't the
in-flight counter then grow on both send and completion?
The kernel-doc for struct libeth_cq_pp describes xdp_tx as "number of
XDP-not-XSk frames processed", which is a positive count. In idpf/xdp.c,
idpf_xdpsq_complete() uses the same "xdpsq->xdp_tx -= cp.xdp_tx" pattern
with the existing "cp->xdp_tx -= sqe->nr_frags" line. The new XSk case
copies that sign.
idpf_xsksq_complete() uses this counter to choose its fast path:
if (likely(!xdpsq->xdp_tx)) {
tx_ntc += done_frames;
...
xsk_frames = done_frames;
goto finalize;
}
After the first XSk XDP_TX the counter never goes back to zero, so the
slow path is always taken. Each XDP_TX buffer adds 2 to the counter. After
about 2^31 buffers the u32 wraps, and it can read exactly zero while
XDP_TX SQEs are still on the ring.
In that case, would the fast path pass those XDP_TX buffers to
xsk_tx_completed() as xmit completions and never call xsk_buff_free() on
them? Userspace would then see completion ring entries that were never
reserved for xmit, and those UMEM buffers would leak from the pool. That
looks like the same outcome the commit message describes: "idpf may then
complete XDP_TX buffers as XSk xmit frames".
The later patch in this series, "xsk: Keep the shared info of zero-copy
buffers in kernel memory", leaves both cp->xdp_tx-- and
xdpsq->xdp_tx -= cp.xdp_tx unchanged. The mismatch is still present at
the end of the series.
Would it work to have libeth return a positive count (cp->xdp_tx++ and
cp->xdp_tx += sqe->nr_frags)? Changing the idpf consumers to += would
also work.
> + cp->xss->bytes += sqe->bytes;
> + break;
> default:
> break;
> }
[ ... ]
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130123737.125432-1-bjorn%40kernel.org
Technical Details
Message-ID:
<179612875384.3146.6108168327530476978@kernel.org>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-375026-linux-kernel-netdev=dewy.ruReferences:
<20261130123737.125432-2-bjorn@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-375026-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2 1/4] libeth: xsk: Count each XDP_TX buffer on its own Date: Tue, 01 Dec 2026 12:39:13 +0000 Organization: Usenet Network Message-ID: <179612875384.3146.6108168327530476978@kernel.org> References: <20261130123737.125432-2-bjorn@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1710448"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:rZLe+QbGG5lW5fBKamrrtcnMwao= sha256:GX3IWMoeKFTrlm76CWWPeOoiogA8vKlfSurthzIUJfY= sha1:OjOj8/wFwAFDDxOBrwYsGyJVzFg= sha256:3qecGpJfDWQm834ztKx64qdKWg3WIk2ZHFJAhkJXUEg= 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 4D9E2117354; Tue, 1 Dec 2026 15:39:42 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 T63Tex7NXFq7; Tue, 1 Dec 2026 15:39:39 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-375026-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 8F66211737D; Tue, 1 Dec 2026 15:39:30 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 6EF0325038; Tue, 1 Dec 2026 12:39:28 +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=1796128762; b=Nk8yFm5VuVqIc+2Lw6jWPBUT+BZCJyFlsPt4KdH4+gCXJSRTNIf5fN20+i8QO8pYD6bq Hl5B1rHVKfG4hG+SzBsEppXgr8iLIZrwQaK1KDKqQgL5oNOVHJodGW7kS0glInAa2EpRz FMFTzfOJrgmPI/2Rx1I5aU0YQS2JwB936jCZ7lXYEFlTlu0eNTdULd/MF7RoMtHjaoDpu QQ7jlDdQjRn0qC+OQTyAc30ZcIZe9PqFT8WQH8yc0PUARx4xLWuh4FysJ/AMJEqK1FvP7 NDcox3wtecMQBOrRZa0NxlwuAuKBUS9uFnanZyPv6XkTPD3t/xyB2alk9TGB1yDXXig== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796128762; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=K6zl8YKeskOlOtznJtW97ZpUSZeVZqxKltRE18zDrXc=; b=SDc9n7YGYNwJLCY747Ss2L5R+ul27M3scyb+oylrm4mgjMpNmu86eIRFGqahyG6WygQE Bti+XXJRvWuqLkvPu134rPYq6Spgao/lVovAQWAsG+IbdUw6WbSnI7lVWtleAPptxY+Qu 6p0sv3EWtBtHYBM8yEUNHa/5uaHWMNh+twQi/FCafITNVi+5wHiot7FIpdhp5Fkhev1ih ltUzfNRBHwZNN4NiF2XK8gRjmzeZljNdsoQ1wnHXu2YUhGTUwHfBVxDIGObg0gZsoCsng cViVu/5eJ4PZ28EtYTmGEM7cnfIjp90IQZxnK+dMJd1Q5B6SSqw9VJF4K5hJhEONBbQ== 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=XhJim6GY; 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 72A46606A6A8; Tue, 1 Dec 2026 12:39:22 +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=XhJim6GY 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=1796128756; b=nnqaIptSnaolQ2eLZ2cRgh1E4KdZelZoXS60bTYsfzuPbxiDhhcKxauKDc2j3Wxbigdv HyqY+5cxemZWvlDUtiaYxYd7VLqpirlj9BLI/svfzxNuP5fg50pQibOGNgS/cgJAFoQUY ZqA+Jnjv2smuHCGaAClvMe0bsfD3fhJaVuOZHA9fBCMgZQOybl8p3E5xDXygMOACQeAnX OrcVkRxZW/E0X6TaE/pdTH5jixuWShcsl2T2mWHIYz2yxfzBw6SH3tujkReF4cvqbjQch B4oTPkINEcOmJKSwaHYLRmDIPK0+dCyUIYbo4IGrVXYP1D5mCC1NwyzceisFdaKlasQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796128756; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=K6zl8YKeskOlOtznJtW97ZpUSZeVZqxKltRE18zDrXc=; b=LHhu9fHiHh84jaP9eJoH9Y4K5VfIQQY1Sn6o1VDNDa0TqMm4FPKgg9F48AO8mTyidmJm qJq42UOQfnFLY9wnUQXi2CaNk2k+44zd7PVfHH/Fj0bVw/Ua3IgGbnhOxeEWulswC5RlZ +/ZLoz4YhtGwkLzez4XYuzEQVcMggVonG+43r5M2w7rRXjqO4Erp3IjJWCwODC3K3s1v1 wKM+DKcWRgkd5YFJA5PxBtYMqfvvMSOfdFF+I5PBh9AX1HsdetaubHuS/V/itaHWJKNm6 5kOrcmaIIDA/ERo9KchO3yoYAvaXO5XGSOC+rtqTyAUE+3EN+NX6QBJNRCaENZ5R/xQ== 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=XhJim6GY; 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 92FF2606A31A; Tue, 1 Dec 2026 12:39:16 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AA0C1F0089B; Tue, 1 Dec 2026 12:39:14 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796128755; bh=K6zl8YKeskOlOtznJtW97ZpUSZeVZqxKltRE18zDrXc=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=XhJim6GYWCzByF3IsupA0ZfQZ8HJXrQSgxWVfYYELi5mCA+J5BXsQAm/Uu5lzR4GL 91OEbwdIPWnRkOX2wIhPWwXohGsBe+qIIxuggJsrB5rasCDgr3pKJ83CN5im3MsSfk D3il7lT28+qBAxqmS972drJjmKLRgqX2C+Om6F0d4IZvw6uzh4bEelfbggef2J1R/h duvqM4kOJJJpOVCsh+l72D7U9fJ2I883syYnlcI3saFduujNnICjgFuXgvVWAcRLIx M1jR1a3rYhKfPoHpQJSZEXPM9uzysgg7V9qqrqTZuV5e7JuSZOi02klKc9YdjyVUt5 8DAVBLpMV07hg== 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, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, 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, intel-wired-lan@lists.osuosl.org, clecigne@google.com X-In-Reply-To: <20261130123737.125432-2-bjorn@kernel.org> X-sashiko-severity: High 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