From: netdev-bot+sashiko@kernel.org
To: maciej.fijalkowski@intel.com
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
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 [thread overview]
Message-ID: <179587852155.3135.3559984892712770438@kernel.org> (raw)
In-Reply-To: <20261127150527.1122049-16-maciej.fijalkowski@intel.com>
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
prev parent reply other threads:[~2026-11-28 15:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 15:05 [PATCH v6 net-next 00/15] selftests: net: adjust xskxceiver to drv-net Maciej Fijalkowski
2026-11-27 15:05 ` [PATCH v6 net-next 01/15] selftests: xsk: fix the stack overrun in is_adjust_tail_supported() Maciej Fijalkowski
2026-11-27 15:05 ` [PATCH v6 net-next 02/15] selftests: xsk: factor endpoint work out of pthread wrappers Maciej Fijalkowski
2026-11-27 15:05 ` [PATCH v6 net-next 03/15] selftests: xsk: size the TX UMEM in HW_SW_MAX_RING_SIZE Maciej Fijalkowski
2026-11-27 15:05 ` [PATCH v6 net-next 04/15] selftests: xsk: drop the single-interface loopback mode Maciej Fijalkowski
2026-11-27 15:05 ` [PATCH v6 net-next 05/15] selftests: xsk: collect interface capabilities in struct xsk_caps Maciej Fijalkowski
2026-11-27 15:05 ` [PATCH v6 net-next 06/15] selftests: xsk: split xskxceiver main() into setup, run and cleanup Maciej Fijalkowski
2026-11-28 15:08 ` netdev-bot+sashiko
2026-11-27 15:05 ` [PATCH v6 net-next 07/15] selftests: xsk: run one test case per xskxceiver invocation Maciej Fijalkowski
2026-11-27 15:05 ` [PATCH v6 net-next 08/15] selftests: xsk: run the RX and TX endpoints in separate processes Maciej Fijalkowski
2026-11-27 15:05 ` [PATCH v6 net-next 09/15] selftests: xsk: send UDP over IPv4 or IPv6 between the interface MACs Maciej Fijalkowski
2026-11-28 15:08 ` netdev-bot+sashiko
2026-11-27 15:05 ` [PATCH v6 net-next 10/15] selftests: xsk: prepare xskxceiver for endpoints on two hosts Maciej Fijalkowski
2026-11-28 15:08 ` netdev-bot+sashiko
2026-11-27 15:05 ` [PATCH v6 net-next 11/15] selftests: xsk: wait up to --timeout for the RX stats and a busy bind Maciej Fijalkowski
2026-11-27 15:05 ` [PATCH v6 net-next 12/15] selftests: xsk: list the endpoint roles of the test cases Maciej Fijalkowski
2026-11-27 15:05 ` [PATCH v6 net-next 13/15] selftests: drv-net: rename nsim_test to sw_test Maciej Fijalkowski
2026-11-27 15:05 ` [PATCH v6 net-next 14/15] selftests: drv-net: decouple local link setup from netdevsim Maciej Fijalkowski
2026-11-27 15:05 ` [PATCH v6 net-next 15/15] selftests: drv-net: run the AF_XDP tests over veth or a NIC Maciej Fijalkowski
2026-11-28 15:08 ` netdev-bot+sashiko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179587852155.3135.3559984892712770438@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=bjorn@kernel.org \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stfomichev@gmail.com \
--cc=tushar.vyavahare@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox