🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23916

Re: [PATCH v6 net-next 15/15] selftests: drv-net: run the AF_XDP tests over veth or a NIC

#23916
From: netdev-bot+sashiko
Date: Sat, 28 Nov 2026 15:08
190 lines
15900 bytes
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 2

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).

- [Medium] drivers/net/xsk.py adds the entry (None,
  "XDP_ADJUST_TAIL_SHRINK_MULTI_BUFF"): "trimmed frags leak" to…
- [Medium] tools/testing/selftests/net/lib/Makefile builds xskxceiver
  only when `bpftool version` succeeds (HAS_BPFTOOL -> COND_GEN_FILES).
- [Low] The patch fixes a real bug in hugepages_present()
  (tools/testing/selftests/net/lib/xsk/test_xsk.c).
- [Low] In the NIC run, _setup_nic() turns ntuple-filters on for both
  hosts via set_ethtool_feat(..., {"ntuple-filters": True}).

--

selftests: drv-net: run the AF_XDP tests over veth or a NIC

This adds drivers/net/xsk.py, which runs each AF_XDP case as a pair of
xskxceiver endpoints. It runs them either over a veth pair, with the peer
in a namespace, or over NETIF, with an SKB-mode peer on the remote host.
NetDrvEpEnv gains a sw_drv argument so it can create a veth pair instead
of netdevsim, and the mmap() flags in hugepages_present() are fixed.

> diff --git a/tools/testing/selftests/drivers/net/xsk.py b/tools/testing/selftests/drivers/net/xsk.py
> new file mode 100755
> index 0000000000000..ebde81fa5140b
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/net/xsk.py
> @@ -0,0 +1,453 @@

[ ... ]

> +    # bpf_xdp_adjust_tail() frees a frag that it trims off as the memory type
> +    # of the XDP RX queue, which veth and generic XDP leave at
> +    # MEM_TYPE_PAGE_SHARED for frames they copy into page_pool pages, so
> +    # page_frag_free() frees a page that its pool still owns. The endpoints
> +    # pass regardless, so running the case would only harm the kernel.
> +    (None, "XDP_ADJUST_TAIL_SHRINK_MULTI_BUFF"): "trimmed frags leak",

[Severity: Medium]
The commit message describes VETH_XFAIL as "Cases that veth cannot pass
are expected failures". This comment says something else: the case
passes, but running it corrupts kernel memory. Should that kernel bug be
reported and fixed, rather than only recorded in a Python comment?

The path in the comment looks real in the current tree. The XDP RX
queues are registered as shared pages, while veth copies frames into its
page_pool:

veth_enable_xdp_range()
    xdp_rxq_info_reg_mem_model(&rq->xdp_rxq, MEM_TYPE_PAGE_SHARED, NULL)

veth_convert_skb_to_xdp_buff()
    skb_pp_cow_data(rq->page_pool, ...)   /* rxq mem stays PAGE_SHARED */

Generic XDP does the same through netif_skb_check_for_xdp() ->
skb_cow_data_for_xdp(system_page_pool), with the default PAGE_SHARED rxq.

When a frag is trimmed away completely:

bpf_xdp_frags_shrink_tail()
    bpf_xdp_shrink_data()
        __xdp_return(netmem, xdp->rxq->mem.type, false, zc_frag)
            case MEM_TYPE_PAGE_SHARED:
                page_frag_free(__netmem_address(netmem))

That drops a plain page reference on a page the page_pool still owns.

The commit message doesn't mention this, and there is no Fixes: or Link:
tag, so the net/xdp and filter.c maintainers are unlikely to see it.
Could it go into the changelog, or be sent as a separate report or fix?

The xfail reason "trimmed frags leak" also seems to say the opposite of
the comment above it: the page is freed too early, not leaked. Would a
reason like "trimmed frags freed under their page_pool" be more accurate?

The baseline test_xsk.h already listed this case among its flaky tests,
so little coverage may be lost. The bug itself still goes unreported.

[ ... ]

> +    # Restore the table last, once ntuple-filters are off again, as turning
> +    # them on or off can reset the NIC.
> +    defer(_restore_rss, cfg, indir)
> +    for ifname, host in ((cfg.ifname, None), (cfg.remote_ifname, cfg.remote)):
> +        feat = ethtool(f"-k {ifname}", json=True, host=host)[0]
> +        set_ethtool_feat(ifname, feat, {"ntuple-filters": True}, host=host)
> +    try:
> +        ethtool(f"-X {cfg.ifname} equal {queue}")
> +    except CmdExitFailure as e:
> +        raise KsftSkipEx(f"{cfg.ifname} cannot take queue {queue} "
> +                         "out of RSS") from e
> +    _steer(cfg, queue, udp_port, ctrl_port)

[Severity: Low]
Can aRFS steer a flow without a rule onto the queue that was taken out
of RSS here?

On aRFS-capable zero-copy drivers (mlx5, ice, bnxt or sfc, for example),
turning on NETIF_F_NTUPLE also enables ndo_rx_flow_steer. If RFS is
configured (rps_sock_flow_entries and rps_flow_cnt above 0), aRFS
installs per-flow filters. The indirection table set by ethtool -X equal
does not override them.

_steer() adds explicit rules only for the UDP test flow and the TCP
control port. Other flows get no rule. One example is the ssh session
that cmd(..., host=cfg.remote) uses while the endpoints run, when it
goes over NETIF.

Suppose such a flow lands on the queue bound by a tx-role endpoint,
which the commit message says "drops what it receives". Could the remote
command then stall until timeout(1) ends the case, so that it fails
spuriously?

The code already handles i40e ATR for the control connection, but it
doesn't seem to account for aRFS.

[ ... ]

> +def main():
> +    """Run the cases over veth without NETIF, else on NETIF."""
> +    with NetDrvEpEnv(__file__, sw_drv="veth") as cfg:
> +        cfg.bin_local = cfg.net_lib_dir / "xskxceiver"
> +        cases = _get_cases(cfg)

[Severity: Medium]
What happens here if xskxceiver was not built?

tools/testing/selftests/net/lib/Makefile builds it only when bpftool
works:

HAS_BPFTOOL := $(shell $(BPFTOOL) version >/dev/null 2>&1 && echo y)
ifeq ($(HAS_BPFTOOL),y)
COND_GEN_FILES += xskxceiver
else
$(warning excluding xskxceiver, bpftool not installed or not working)
endif

However, drivers/net/Makefile adds xsk.py to TEST_PROGS unconditionally.

_get_cases() then runs cmd([str(cfg.bin_local), "-l"]). cmd() passes a
list argv to subprocess.Popen(), so a missing binary raises
FileNotFoundError rather than CmdExitFailure. This happens before
ksft_run(), so nothing turns it into a skip, and the script exits with
a traceback.

Would it work to raise KsftSkipEx here when cfg.bin_local does not
exist? The test would then report a skip instead of a failure on builds
without a working bpftool.

> diff --git a/tools/testing/selftests/net/lib/xsk/test_xsk.c b/tools/testing/selftests/net/lib/xsk/test_xsk.c
> index a0ad1df00212d..2aadb95c61faf 100644
> --- a/tools/testing/selftests/net/lib/xsk/test_xsk.c
> +++ b/tools/testing/selftests/net/lib/xsk/test_xsk.c
> @@ -2546,7 +2546,8 @@ static bool hugepages_present(void)
>  	void *bufs;
>  
>  	bufs = mmap(NULL, mmap_sz, PROT_READ | PROT_WRITE,
> -		    MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB, -1, MAP_HUGE_2MB);
> +		    MAP_PRIVATE | MAP_ANONYMOUS | MAP_HUGETLB | MAP_HUGE_2MB,
> +		    -1, 0);
>  	if (bufs == MAP_FAILED)
>  		return false;

[Severity: Low]
This isn't a bug, but this fix to hugepages_present() is folded into a
large new-test commit with no Fixes: tag.

Before the change, the probe used the default huge page pool, not the
2 MiB pool that the UMEM mapping requests with MAP_HUGETLB |
MAP_HUGE_2MB. On hosts whose default huge page size is 1 GiB or
512 MiB, the misaligned offset also made the probe fail with EINVAL.

Other patches in this series carry Fixes: tags for similar selftest
fixes, such as "selftests: xsk: fix the stack overrun in
is_adjust_tail_supported()". Could this one be split out, or at least
tagged so that stable tooling picks it up?

Fixes: 041b68f688a3 ("selftests/xsx: test for huge pages only once")

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127150527.1122049-1-maciej.fijalkowski%40intel.com
Technical Details
Message-ID: <179587852155.3135.3559984892712770438@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-373183-linux-kernel-netdev=dewy.ru
References: <20261127150527.1122049-16-maciej.fijalkowski@intel.com>

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-373183-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v6 net-next 15/15] selftests: drv-net: run the AF_XDP
 tests over veth or a NIC
Date: Sat, 28 Nov 2026 15:08:41 +0000
Organization: Usenet Network
Message-ID: <179587852155.3135.3559984892712770438@kernel.org>
References: <20261127150527.1122049-16-maciej.fijalkowski@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="972887"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:q96TYYPTllIMkE4YBIPrzOr0w9A= sha256:pYj5RQzOwV6GLn1Uberhpy8TQw7Vwsml4Sbv6ueV6o8=
	sha1:klZFMcvY5VdMGpp7mS7TkKhDFXo= sha256:/5zKeh+QmrGbowNZ3fa4YxVSiItzw8SRaLnHroDe3K0=
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 36150125F76; Sat, 28 Nov 2026 18:09:06 +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 BE-mZW4hz41X;
	Sat, 28 Nov 2026 18:09:02 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373183-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 DC414125F81; Sat, 28 Nov 2026 18:08:53 +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 DFF6728505; Sat, 28 Nov 2026 15:08:43 +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=1795878523;
	b=R5LLNeHz7GjjwjgKcmqVptb4ZyZyEIL5Zy4G708oJ4pbdfkEAVYpX2tpojrvQ+k5zclR
	 GXl9W9GCn3SwqyZFfaF2bELAsXtzd8y6XOpa+39Kb3u4GKk0hpl0d92ITbnjCxSiNylHD
	 +1ocaLsnYHe5Plmk9E4foZFUkB0lNbaYgb/EPiT2cevEprNBRec01pSfxALVTqZ+pKOGk
	 7bOgrSUywk2/eOR8b84p6tQAR84XRRU7ak61x6L8dGBfd6NlPMhzHLf9e9Tfh6+BHxcd1
	 aoTzzTlF/luGtBumILiAsVyjHj1u1xhxXlYm7epx2knT7rEAGIF7EASBbHpc9VCVzhw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795878523;
	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=OucGOqgKOvrQtV2qIDDB8C3nqvDRcUpljcX5N5xZxGQ=;
	b=voRPcjwwShg1E9WSaCCMcMVi7zhZfhKIONf3yWVHl+pjbmb3l5gmyR2oskDAQp6CrbAe
	 QVUVNeNNBGHYlP4KYfYCWp5I0GMQ+iOp5o3LMe/hJA5AeA63b4us1/usUUia3iZFkAZic
	 V8FWhcK/qmRd1JsIp4d10dkg116GDNMeU042tUGWnRhJt2J23Q+7mebzeMxLb7tTLaMjF
	 6vb+C/ldVEf/IBl0l/a4TUD0T6+SpHv5o7bYfANz0nd0tkwusOrfgVsaRxim7BWNXPq+N
	 dOJPQiJghydgPCHK1TazK+ke52nlCKpWzDE5VFAixRkJ3WJdU9uUP2ek3/hK6ZSNrgQ==
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=oc3j3eXL;
	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 B8AC4606A321;
	Sat, 28 Nov 2026 15:08:43 +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=oc3j3eXL
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=1795878522;
	b=UAnZXIjfr8/x6QI4+G6P21R8Wseb5q5wq2Q/WFQohcsSf+3TeGSqBkS/nV7fwFjorkQu
	 CrhzT/of+urbyoaLIGrYgbbNjrSeZqwTf5pvZr5ZxwBkw5CUWD/0/LMeZoj25clS8YaTJ
	 KkbgPJThRxJlWVTLqYA/vlZoNwV7/IloTjBDPv3sMhxmS38PAuu0/1ujdaIjhsuM5Zpm+
	 BU0Q4jn/gvImfjeRldfUmguMxfiODqrsc/e68wy89Fm4L8kxujQpDptvvVOIV4Z5bUxzU
	 ZQ/Bx+kEa0LdW1njESomROgY98r9+7wBz/HvvXLJedBPCXTfSL1bp9kOxn2Orrz2Neg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795878522;
	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=OucGOqgKOvrQtV2qIDDB8C3nqvDRcUpljcX5N5xZxGQ=;
	b=d1P+YMrncthHlwylBSoiVWPJDLljs8Qm9TnnW6+HXS/BBj3h6gd9bU+rITG4koU7NB+K
	 +ZG5ygvUr6AnqGwp4WhTxtHpmu5LbwhWjCjYc4TijMIBnTemFWTl8SSGnZvXXZvcX4Vm/
	 Bgq1ZZRenQQN4rApb4Wy1kYs98nAhJU6JQjrjk+KD8J2dhufWUIxCeOfDlxlL6pGYQCk0
	 p39Em35rmsp0g1F1KV5H4Y2x7bzOnhZ9ZjpG3gjPcfsacyFCa/9Xm1rCJ0wO3k9b/Agoh
	 8oT65P8tt4EfvQLvjy0C5Y0L2JUx1gfP6jkGukprUnfxTWCFdJcy6uT6898HCllAYpQ==
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=oc3j3eXL;
	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 D8007606A326
	for <netdev@vger.kernel.org>; Sat, 28 Nov 2026 15:08:42 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00D0C1F000C1;
	Sat, 28 Nov 2026 15:08:41 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795878522;
	bh=OucGOqgKOvrQtV2qIDDB8C3nqvDRcUpljcX5N5xZxGQ=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=oc3j3eXLkWJrKp/G2XQf0rsUL+MixjgcFTtI2ruFUEy0qzFcB++zEr4AvKzvLPzW3
	 cK//c9OFdeKheGAEfIRkiKpmUNtvlGNRj9KZaTCT8+cLwPvV6V3V7e1nFwTFq3/02G
	 ibpo22ORQ0Oajye9d4CA0AvQRgnM3zgKT0Zq/FvdYpvAw/rn271zt3XDOXAckxIPGC
	 db+6lOaqi16+IC4pKwucIn3PXvofemzrhyBU0O2DKuDi2OYhwmE3+35gtz6nfXgx/d
	 WNjVylIYunztMeqPZudhuNWhBI4Fs2FWV7FeJAaR7glc/Ao906b1d9u45yrmvC81Pp
	 jpP5PavB4RM4Q==
X-Cc: netdev@vger.kernel.org, magnus.karlsson@intel.com, stfomichev@gmail.com,
 kuba@kernel.org, pabeni@redhat.com, tushar.vyavahare@intel.com,
 kerneljasonxing@gmail.com, bjorn@kernel.org
X-In-Reply-To: <20261127150527.1122049-16-maciej.fijalkowski@intel.com>
X-sashiko-severity: Medium
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