BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ricardo B. Marlière" <rbm@suse.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH v2 07/10] selftests/bpf: Tolerate benchmark build failures
Date: Thu, 13 Aug 2026 23:50:50 +0000	[thread overview]
Message-ID: <20260813235051.53DD81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260403-selftests-bpf_misconfig-v2-7-f06700380a9d@suse.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Masking benchmark compilation failures breaks `make install` unconditionally due to the missing `bench` executable, as partial linking of `bench` is impossible.
--

--- Patch [7]: [PATCH v2 07/10] selftests/bpf: Tolerate benchmark build failures ---
commit d38880b3d361e7ca90a0ac6bc884115d3f936eda
Author: Ricardo B. Marlière <rbm@suse.com>

selftests/bpf: Tolerate benchmark build failures
    
This commit makes benchmark object and binary compilation non-fatal during
the selftests/bpf build. It emits SKIP-BENCH or SKIP-LINK and removes
failed outputs to prevent stale object reuse.

> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index ca64a7678dfe1..6c4f854594862 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
[ ... ]
> @@ -918,7 +919,8 @@ $(OUTPUT)/bench: $(OUTPUT)/bench.o \
>  		 $(OUTPUT)/usdt_2.o \
>  		 #
>  	$(call msg,BINARY,,$@)
> -	$(Q)$(CC) $(CFLAGS) $(LDFLAGS) $(filter %.a %.o,$^) $(LDLIBS) -o $@
> +	$(Q)$(CC) $(CFLAGS) $(LDFLAGS) $(filter %.a %.o,$(wildcard $^)) $(LDLIBS) -o $@ || \
> +		($(RM) $@; printf '  %-12s %s\n' 'SKIP-LINK' '$(notdir $@) (some benchmarks may have been skipped)' 1>&2)

[Severity: Medium]
Could this cause the installation pipeline to fail unconditionally when a
benchmark object fails to build?

When a benchmark compilation fails, the linker step fails and deletes the
target executable. Because the bench binary is listed in
TEST_GEN_PROGS_EXTENDED, the rsync step in tools/testing/selftests/lib.mk
during make install will fail when it attempts to copy the missing file:

tools/testing/selftests/lib.mk:
INSTALL_SINGLE_RULE:
    ...
    $(if $(INSTALL_LIST),rsync -a --copy-unsafe-links $(INSTALL_LIST) $(INSTALL_PATH)/)

Also, is it possible to partially link the bench binary when some objects
are missing? Looking at tools/testing/selftests/bpf/bench.c, it hardcodes
explicit references to all benchmark structures:

tools/testing/selftests/bpf/bench.c:
static const struct bench *benchs[] = {
	&bench_count_global,
	&bench_count_local,
	&bench_rename_base,
    ...
};

This guarantees an "undefined reference" linker failure if any object is
skipped, meaning the bench binary will always fail to link and get deleted on
a partial build. Should missing benchmarks be excluded from the benchs array,
or should the installation step be updated to handle the missing executable?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260403-selftests-bpf_misconfig-v2-0-f06700380a9d@suse.com?part=7

  reply	other threads:[~2026-08-13 23:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-03 14:58 [PATCH v2 00/10] selftests/bpf: Tolerate partial builds across kernel configs Ricardo B. Marlière
2026-04-03 14:58 ` [PATCH v2 01/10] selftests/bpf: Fall back to distro build directory for test_kmods Ricardo B. Marlière
2026-04-03 14:58 ` [PATCH v2 02/10] selftests/bpf: Tolerate BPF and skeleton generation failures Ricardo B. Marlière
2026-04-03 14:58 ` [PATCH v2 03/10] selftests/bpf: Avoid rebuilds when running emit_tests Ricardo B. Marlière
2026-04-03 14:58 ` [PATCH v2 04/10] selftests/bpf: Make skeleton headers order-only prerequisites of .test.d Ricardo B. Marlière
2026-04-03 14:58 ` [PATCH v2 05/10] selftests/bpf: Tolerate test file compilation failures Ricardo B. Marlière
2026-04-03 15:31   ` bot+bpf-ci
2026-04-03 14:58 ` [PATCH v2 06/10] selftests/bpf: Allow test_progs to link with a partial object set Ricardo B. Marlière
2026-04-03 15:31   ` bot+bpf-ci
2026-04-03 14:59 ` [PATCH v2 07/10] selftests/bpf: Tolerate benchmark build failures Ricardo B. Marlière
2026-08-13 23:50   ` sashiko-bot [this message]
2026-04-03 14:59 ` [PATCH v2 08/10] selftests/bpf: Provide weak definitions for cross-test functions Ricardo B. Marlière
2026-04-03 14:59 ` [PATCH v2 09/10] selftests/bpf: Skip tests whose objects were not built Ricardo B. Marlière
2026-04-03 14:59 ` [PATCH v2 10/10] selftests/bpf: Tolerate missing files during install Ricardo B. Marlière

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=20260813235051.53DD81F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=rbm@suse.com \
    --cc=sashiko-reviews@lists.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