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=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== 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== 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 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 ; Sat, 28 Nov 2026 15:08:42 +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=oc3j3eXL Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00D0C1F000C1; Sat, 28 Nov 2026 15:08:41 +0000 (UTC) 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== Subject: Re: [PATCH v6 net-next 15/15] selftests: drv-net: run the AF_XDP tests over veth or a NIC 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 Date: Sat, 28 Nov 2026 15:08:41 +0000 Message-ID: <179587852155.3135.3559984892712770438@kernel.org> In-Reply-To: <20261127150527.1122049-16-maciej.fijalkowski@intel.com> References: <20261127150527.1122049-16-maciej.fijalkowski@intel.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 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