mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: bot+bpf-ci@kernel.org
To: arighi@nvidia.com,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,eddyz87@gmail.com,memxor@gmail.com
Cc: martin.lau@linux.dev,song@kernel.org,yonghong.song@linux.dev,jolsa@kernel.org,emil@etsalapatis.com,ihor.solodrai@linux.dev,john.fastabend@gmail.com,joshdon@google.com,vineethrp@google.com,balbirs@nvidia.com,skolothumtho@nvidia.com,himadrics@protonmail.com,royfru44@gmail.com,bpf@vger.kernel.org,linux-kernel@vger.kernel.org,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev
Subject: Re: [PATCH 5/5] selftests/bpf: Test two-way arena access with two guests
Date: Sat, 10 Oct 2026 23:40:49 +0000 (UTC)	[thread overview]
Message-ID: <a1b29fc1533b362c07bdb93b2180a8ba199c1a9d09c3c26019ad63b3c9bdc3fd@mail.kernel.org> (raw)
In-Reply-To: <20261010224902.1232178-6-arighi@nvidia.com>

[-- Attachment #1: Type: text/plain, Size: 4284 bytes --]

> selftests/bpf: Test two-way arena access with two guests

TL;DR:
- Unconditional -lzstd in the new Makefile link rules may break the whole
  selftests/bpf build where libzstd is missing
- arena_kvm.py doesn't use ksft.py reporting (minor; results still counted)

> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index a22be7efd1fa..29fffa7857c1 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile

[ ... ]

> @@ -94,6 +100,25 @@ BPFTOOLDIR := $(TOOLSDIR)/bpf/bpftool
>  HOST_BPFOBJ := $(HOST_BUILD_DIR)/libbpf/libbpf.a
>  BPF_TARGET_ENDIAN:=$(if $(IS_LITTLE_ENDIAN),--target=bpfel,--target=bpfeb)
>  
> +# These helpers are installed beside arena_kvm.py, including for OUTPUT=.

[ ... ]

> +$(OUTPUT)/arena_kvm_guest-init: arena_kvm_guest.c arena_kvm_shared.h \
> +		$(BPFOBJ) | $(OUTPUT)
> +	$(call msg,BINARY,,$@)
> +	$(Q)$(CC) $(CFLAGS) $(LDFLAGS) $< $(BPFOBJ) $(LDLIBS) -lzstd -o $@
> +
> +$(OUTPUT)/arena_kvm_host-runner: arena_kvm_host.c arena_kvm_shared.h \
> +		$(BPFOBJ) | $(OUTPUT)
> +	$(call msg,BINARY,,$@)
> +	$(Q)$(CC) $(CFLAGS) $(LDFLAGS) $< $(BPFOBJ) $(LDLIBS) -lzstd -o $@
> +
>  NON_CHECK_FEAT_TARGETS := clean docs-clean emit_tests
>  CHECK_FEAT := $(filter-out $(NON_CHECK_FEAT_TARGETS),$(or $(MAKECMDGOALS), "none"))
>  ifneq ($(CHECK_FEAT),)

Is it intended to pass -lzstd unconditionally in these two link rules?

Neither arena_kvm_guest.c nor arena_kvm_host.c includes a zstd header or
calls into zstd, and no other userspace link line in selftests/bpf uses
-lzstd.  test_progs, for example, links with plain $(LDLIBS), which is
$(LIBELF_LIBS) -lz -lrt -lpthread.

Elsewhere in tools/, libzstd is optional.  bpftool only adds it when the
feature-libelf-zstd probe passes, and libelf builds without zstd are a
supported configuration.

Both binaries are in TEST_GEN_FILES without a CLANG_CPUV4 or feature guard,
and these link rules do not use $(call skip_on_fail,...).  On a host or
sysroot that has libelf and zlib development files but no linkable libzstd,
wouldn't 'make -C tools/testing/selftests/bpf' now fail with "cannot find
-lzstd", even with BPF_STRICT_BUILD=0?  That would block all of
selftests/bpf, not just this test.

Would dropping -lzstd be enough, since a dynamic libelf pulls in its own
dependencies?  If it is needed for a static libelf, it could be made
conditional the same way bpftool does it.

> diff --git a/tools/testing/selftests/bpf/arena_kvm.py b/tools/testing/selftests/bpf/arena_kvm.py
> new file mode 100755
> index 000000000000..552bfcfb80ac
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/arena_kvm.py
> @@ -0,0 +1,448 @@

[ ... ]

> +KSFT_SKIP = 4

[ ... ]

> +        print(f"OK: two guests exchanged BPF values through arena slices {offsets}")

[ ... ]

> +def skip(reason):
> +    print(f"SKIP: {reason}")
> +    return KSFT_SKIP

[ ... ]

> +if __name__ == "__main__":

[ ... ]

> +        stop_children()
> +    sys.exit(status)

A subsystem guideline flags this as potentially concerning: a test that
prints its own ad hoc result text and exits directly, instead of going
through the kselftest reporting helpers.

arena_kvm.py defines its own KSFT_SKIP, prints hand-written "SKIP: ..." and
"OK: ..." lines, and then calls sys.exit(status) directly.
tools/testing/selftests/kselftest/ksft.py provides KSFT_SKIP,
test_result_pass(), test_result_skip(), test_result_fail(), exit_pass() and
exit_fail(), and none of them are used here, so the output is not KTAP.

Should this script report through ksft.py instead?

For context, when the kselftest runner executes a TEST_PROGS entry, it
prefixes the script's output with '# ' and turns the exit code into the TAP
result line (exit 4 becomes '# SKIP'), so the one result this script
produces is still counted correctly.  The other TEST_PROGS scripts in this
directory (test_kmod.sh, test_xsk.sh, test_xdp_features.sh) also print their
own results.  The guideline text is written about C test binaries and does
not name the Python helper.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/38093513563

  reply	other threads:[~2026-10-10 23:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-10 22:45 [PATCH bpf-next 0/5] bpf: Expose pinned arenas as sized bpffs files Andrea Righi
2026-10-10 22:45 ` [PATCH 1/5] bpf: Add an arena flag to retain allocated pages Andrea Righi
2026-10-10 22:45 ` [PATCH 2/5] bpf: Expose pinned arenas as sized bpffs files Andrea Righi
2026-10-10 23:40   ` bot+bpf-ci
2026-10-10 22:45 ` [PATCH 3/5] docs/bpf: Document pinned arena file mappings Andrea Righi
2026-10-10 23:19   ` bot+bpf-ci
2026-10-10 22:45 ` [PATCH 4/5] selftests/bpf: Test " Andrea Righi
2026-10-10 23:40   ` bot+bpf-ci
2026-10-10 22:46 ` [PATCH 5/5] selftests/bpf: Test two-way arena access with two guests Andrea Righi
2026-10-10 23:40   ` bot+bpf-ci [this message]
2026-10-15 17:50 ` [PATCH bpf-next 0/5] bpf: Expose pinned arenas as sized bpffs files Josh Don
2026-10-19  8:17   ` Andrea Righi
2026-10-16 19:03 ` Alexei Starovoitov
2026-10-16 19:52   ` Andrii Nakryiko
2026-10-18  0:52     ` Alexei Starovoitov
2026-10-19  8:49       ` Andrea Righi
2026-10-19 16:19       ` Andrii Nakryiko
2026-10-19 16:58         ` Alexei Starovoitov
2026-10-19  8:44   ` Andrea Righi
2026-10-19 19:32     ` Alexei Starovoitov

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=a1b29fc1533b362c07bdb93b2180a8ba199c1a9d09c3c26019ad63b3c9bdc3fd@mail.kernel.org \
    --to=bot+bpf-ci@kernel.org \
    --cc=andrii@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=ast@kernel.org \
    --cc=balbirs@nvidia.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=himadrics@protonmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=joshdon@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mason@kernel.org \
    --cc=memxor@gmail.com \
    --cc=royfru44@gmail.com \
    --cc=skolothumtho@nvidia.com \
    --cc=song@kernel.org \
    --cc=vineethrp@google.com \
    --cc=yonghong.song@linux.dev \
    /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

all inboxes | Powered by JetHome®