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 v5 net-next 05/13] selftests: xsk: split xskxceiver main() into setup, run and cleanup
Date: Mon, 23 Nov 2026 18:46:34 +0000 [thread overview]
Message-ID: <179545959409.3135.16751084893051998673@kernel.org> (raw)
In-Reply-To: <20261119164636.1071385-6-maciej.fijalkowski@intel.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] cleanup_iface() in
tools/testing/selftests/net/lib/xsk/xskxceiver.c decides whether to…
--
selftests: xsk: split xskxceiver main() into setup, run and cleanup
This commit restructures xskxceiver main() into separate setup, run and
cleanup steps, in preparation for running one endpoint per process. It
adds bind_iface(), detect_mode_caps(), mode_supported() and
cleanup_iface(), and makes run_pkt_test() return its result. It also
calls ksft_print_header() right after the command line is parsed.
> diff --git a/tools/testing/selftests/net/lib/xsk/xskxceiver.c b/tools/testing/selftests/net/lib/xsk/xskxceiver.c
> index d82224a4fa4b0..97eece4c57f89 100644
> --- a/tools/testing/selftests/net/lib/xsk/xskxceiver.c
> +++ b/tools/testing/selftests/net/lib/xsk/xskxceiver.c
[ ... ]
> +static void cleanup_iface(struct ifobject *ifobj)
> +{
> + if (ifobj->xdp_prog)
> + xsk_detach_xdp_program(ifobj->ifindex,
> + mode_to_xdp_flags(ifobj->mode));
> + xsk_unload_xdp_programs(ifobj);
> }
[Severity: Low]
Can a DRV mode program stay attached to the netdev after xskxceiver exits?
cleanup_iface() only uses ifobj->xdp_prog and ifobj->mode to decide
whether to detach and which flags to pass. xsk_reattach_xdp() in
test_xsk.c attaches the program first and updates those fields only after
the DRV mode check passes:
tools/testing/selftests/net/lib/xsk/test_xsk.c:xsk_reattach_xdp() {
...
err = xsk_attach_xdp_program(xdp_prog, ifobj->ifindex, mode_to_xdp_flags(mode));
if (err) {
...
}
if (ifobj->mode != mode && (mode == TEST_MODE_DRV || mode == TEST_MODE_ZC))
if (!xsk_is_in_mode(ifobj->ifindex, XDP_FLAGS_DRV_MODE)) {
ksft_print_msg("ERROR: XDP prog not in DRV mode\n");
return -EINVAL;
}
ifobj->xdp_prog = xdp_prog;
ifobj->xskmap = xskmap;
ifobj->mode = mode;
...
}
If the attach succeeds but xsk_is_in_mode() returns false, for example
because bpf_xdp_query() fails, the program stays attached in native mode
and the bookkeeping is never updated.
On a first attach, ifobj->xdp_prog is still NULL, so cleanup_iface()
skips the detach. If the interface was in SKB mode before,
cleanup_iface() detaches with XDP_FLAGS_SKB_MODE, which leaves the
native program in place.
Because bpf_xdp_attach() is a netlink attach, the program outlives the
process. The commit message says cleanup_iface() "copes with partially
initialized objects" and takes flags "so that they match the attach".
This partial attach state doesn't seem to be covered by either.
The same code is still there at the end of the series. Each process then
runs a single test, so no later reattach in that process can correct the
fields.
Would it make sense to record the program and mode in ifobj right after
xsk_attach_xdp_program() succeeds, or to detach with the requested flags
on that error path?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119164636.1071385-1-maciej.fijalkowski%40intel.com
next prev parent reply other threads:[~2026-11-23 18:46 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 16:46 [PATCH v5 net-next 00/13] selftests: net: adjust xskxceiver to drv-net Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 01/13] selftests: xsk: factor endpoint work out of pthread wrappers Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 02/13] selftests: xsk: size the TX UMEM in HW_SW_MAX_RING_SIZE Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 03/13] selftests: xsk: drop the single-interface loopback mode Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 04/13] selftests: xsk: collect interface capabilities in struct xsk_caps Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 05/13] selftests: xsk: split xskxceiver main() into setup, run and cleanup Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko [this message]
2026-11-19 16:46 ` [PATCH v5 net-next 06/13] selftests: xsk: run one test case per xskxceiver invocation Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 07/13] selftests: xsk: run the RX and TX endpoints in separate processes Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 08/13] selftests: xsk: send UDP over IPv4 or IPv6 between the interface MACs Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-23 19:08 ` Björn Töpel
2026-11-19 16:46 ` [PATCH v5 net-next 09/13] selftests: xsk: prepare xskxceiver for endpoints on two hosts Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 10/13] selftests: xsk: list the endpoint roles of the test cases Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 11/13] selftests: drv-net: decouple local link setup from netdevsim Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 12/13] selftests: drv-net: run the AF_XDP tests over veth or a NIC Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 13/13] selftests: xsk: document generic and hardware endpoint runs Maciej Fijalkowski
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=179545959409.3135.16751084893051998673@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