All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v2 1/1] selftests/bpf: run the xsk veth tests in a network namespace of their own
Date: Thu, 22 Oct 2026 18:14:48 +0200	[thread overview]
Message-ID: <179268568845.4068023.14180818659434809034.b4-review@b4> (raw)
In-Reply-To: <20261022024816.2435565-2-eva.kurchatova@virtuozzo.com>

Hi Eva,

> +		trap "ip netns del ${XSK_NETNS}" EXIT

The parent still has "trap ctrl_c INT" from the top of the script. On
Ctrl-C it runs cleanup_exit ${VETH0} ${VETH1} in the host namespace,
for its own random ve#### names that it never created. If the host
happens to have an interface with that name, it gets deleted.

Fix: in the parent, before the re-exec, replace the INT trap with
"exit 1". The EXIT trap then deletes the namespace, and the pair goes
with it.

> +		# The pair stays up for a run by hand
> +		[[ $debug -eq 1 ]] && trap - EXIT && \
> +			echo "The pair is up in network namespace ${XSK_NETNS}," \
> +				"use ip netns exec ${XSK_NETNS}"

With -d the child prints "-i VETH0 -i VETH1" for the hand run, but not
-f. A hand run of xskxceiver inside the namespace cannot read the
sysctl and falls back to 17 frags, so on a kernel built with
CONFIG_MAX_SKB_FRAGS=45 too_many_frags fails.

Fix: add the value to the child's debug line:

	echo "-i" ${VETH0} "-i" ${VETH1} ${FRAGS:+"-f" ${FRAGS}}

Mainline
--------

Mainline has the same two problems, so please file a bug for sending
the fixes there and put the lore link to the mainline series into it.

The test in mainline is different: since v6.19-rc1 (d1aec26fce257
"selftests/bpf: test_xsk: Integrate test_xsk.c to test_progs
framework") most xsk tests run from test_progs, the rest stays in
test_xsk.sh. So the patches will not be a port of this one, but
please fix it now, while the details are fresh:

- test_xsk.sh creates the veth pair in the caller's namespace.
  Fix: run the veth part in a namespace of its own, as here.

- test_ns_xsk_skb and test_ns_xsk_drv (prog_tests/xsk.c) already run
  in a namespace that test_progs creates for every ns_ test. But they
  read /proc/sys/net/core/max_skb_frags from inside it, the file is
  not there, and they silently use 17.
  Fix: take the limit from vmlinux BTF, the element count of
  struct skb_shared_info.frags (btf__load_vmlinux_btf(),
  btf__find_by_name_kind(), btf_array()->nelems). It works in any
  namespace, so test_xsk.sh needs no -f option in mainline, and it is
  the limit AF_XDP really checks (see the last item below).

Suggested order: the BTF patch first, then the test_xsk.sh namespace
patch on top of it.

Not part of this series
-----------------------

I will take this series once the comments above are addressed; the
issues below are not caused by it and should not hold it. They are in
the same test though, so please file two more tasks, one for vz and
one for mainline, and fix them in both places:

- test_exit() in xsk_prereqs.sh always exits 1, so every "skip all
  tests" (no veth, no ip, no netns) is a failure for the kselftest
  runner.
  Fix: "exit $1". The callers pass $ksft_fail or $ksft_skip.
  vz and mainline.

- test_xsk.sh exits 0 when tests failed: it ends with
  "if [ $failures -eq 0 ]" without an else.
  Fix: backport 2a912258c90e8 ("selftests/bpf: Upon failures, exit
  with code 1 in test_xsk.sh", v6.18-rc1).
  vz only, mainline already has it.

- The test takes the frag limit from the max_skb_frags sysctl, but
  AF_XDP copy mode checks the compile-time MAX_SKB_FRAGS
  (xsk_build_skb() in net/xdp/xsk.c). The sysctl caps TCP and MPTCP
  only. Once an admin lowers it, too_many_frags checks the wrong
  limit.
  Fix in vz: take the limit from vmlinux BTF as described above and
  drop the -f option this series adds.
  In mainline the BTF patch above already covers it.

Please link all new bugs to VSTOR-150731.

Thanks,
Konstantin

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

      parent reply	other threads:[~2026-10-22 16:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22  2:47 [Devel] [PATCH hci-8.1 v2 0/1] " Eva Kurchatova
2026-10-22  2:47 ` [Devel] [PATCH hci-8.1 v2 1/1] " Eva Kurchatova
2026-10-22  2:53   ` no-reply
2026-10-22  3:06     ` Eva Kurchatova (Virtuozzo)
2026-10-22 16:14   ` Konstantin Khorenko [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=179268568845.4068023.14180818659434809034.b4-review@b4 \
    --to=khorenko@virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=eva.kurchatova@virtuozzo.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.