All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: <netdev-bot+sashiko@kernel.org>
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: Mon, 30 Nov 2026 20:32:10 +0100	[thread overview]
Message-ID: <aw3POmK/adhq9Eh0@boxer> (raw)
In-Reply-To: <179587852155.3135.3559984892712770438@kernel.org>

On Sat, Nov 28, 2026 at 03:08:41PM +0000, netdev-bot+sashiko@kernel.org wrote:
> 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?

syzbot has reported it, and Slawomir's series [0] fixes it, generic XDP
in patch 1 and veth in patch 4. The entry goes once that is in net-next.

And the case does not pass. Its endpoints do, but a debug kernel reports
"BUG: Bad page state ... page_pool leak".

> 
> 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?

"leak" is the kernel's own word for it, from that report, and [0] is
"xdp: fix page_pool leaks".

[0] https://lore.kernel.org/netdev/20261127100132.1977890-1-sst@poczta.fm/

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

No, ksft.py catches KsftSkipEx only inside ksft_run(), so that ends in a
traceback too. And I'd rather a build without xskxceiver failed: make
already warns about it, and a skip would hide it in CI. iou-zcrx.py does
the same with iou-zcrx, which hw/Makefile builds only with liburing.

      reply	other threads:[~2026-11-30 19:32 UTC|newest]

Thread overview: 21+ 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
2026-11-30 19:32     ` Maciej Fijalkowski [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=aw3POmK/adhq9Eh0@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=bjorn@kernel.org \
    --cc=kerneljasonxing@gmail.com \
    --cc=kuba@kernel.org \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev-bot+sashiko@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.