From: sashiko-bot@kernel.org
To: "Ziyang Men" <ziyang.meme@gmail.com>
Cc: linux-input@vger.kernel.org, sched-ext@lists.linux.dev,
hannes@cmpxchg.org, tj@kernel.org, bpf@vger.kernel.org,
mkoutny@suse.com, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v3 1/4] selftests: add shared lib.bpf.mk to build BPF progs and skeletons
Date: Fri, 14 Aug 2026 08:01:15 +0000 [thread overview]
Message-ID: <20260814080116.62AE71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260814075054.507089-2-ziyang.meme@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] BPF objects will not automatically rebuild when libbpf headers are modified, breaking incremental compilation.
- [Low] Missing Clang system include definitions for LoongArch and MIPS architectures.
--
--- Patch [1]: [PATCH v3 1/4] selftests: add shared lib.bpf.mk to build BPF progs and skeletons ---
commit 73f22930c4ae7eac2caa52ed8b921af4c943e0a7
Author: Ziyang Men <ziyang.meme@gmail.com>
selftests: add shared lib.bpf.mk to build BPF progs and skeletons
This commit adds a shared tools/testing/selftests/lib.bpf.mk file to provide
a common build toolchain for BPF programs and skeletons across different
selftest directories. It aims to reduce duplication of the libbpf, bpftool,
vmlinux.h, and skeleton generation Makefiles currently present in bpf,
sched_ext, and hid selftests.
> diff --git a/tools/testing/selftests/lib.bpf.mk b/tools/testing/selftests/lib.bpf.mk
> new file mode 100644
> index 0000000000000..433a26a36960b
> --- /dev/null
> +++ b/tools/testing/selftests/lib.bpf.mk
[ ... ]
> +# ---- compiler flags -------------------------------------------------------
> +# Find the normal system headers that Clang omits with --target=bpf. Put them
> +# last with -idirafter so they cannot replace project headers.
> +define get_sys_includes
> +$(shell $(1) $(2) -v -E - </dev/null 2>&1 \
> + | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \
> +$(shell $(1) $(2) -dM -E - </dev/null | grep '__riscv_xlen ' | awk '{printf("-D__riscv_xlen=%d -D__BITS_PER_LONG=%d", $$3, $$3)}')
> +endef
[Severity: Low]
Will BPF programs fail to compile on LoongArch and MIPS architectures?
The original selftests/bpf/Makefile extracts necessary host definitions
like __loongarch_grlen and MIPS macros.
This new macro appears to drop those extractions, which might cause Clang's
--target=bpf to fail to parse system headers on those architectures.
[ ... ]
> +# Make one rule for each source. A global vpath would also match the test's
> +# normal C rules when BPF_PROG_EXT is .c.
> +define bpf_obj_rule
> +$(BPF_OBJ_DIR)/$(patsubst %$(BPF_PROG_EXT),%,$(notdir $(1))).bpf.o: $(1) \
> + $(BPF_EXTRA_HDRS) $(INCLUDE_DIR)/vmlinux.h \
> + | $(BPF_OBJ_DIR) $(BPFOBJ)
[Severity: Medium]
Will this break incremental compilation when libbpf headers are modified?
Since $(BPFOBJ) is specified only as an order-only prerequisite and there is
no explicit Make rule for the installed headers, Make evaluates their
timestamps before $(BPFOBJ) updates them.
Does this cause BPF objects to be incorrectly skipped during the first make
invocation after modifying a libbpf header?
> + $$(call BPF_BUILD_RULE,$$<,$$@)
> +endef
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260814075054.507089-1-ziyang.meme@gmail.com?part=1
next prev parent reply other threads:[~2026-08-14 8:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 7:50 [PATCH v3 0/4] selftests: shared lib.bpf.mk for building BPF progs and skeletons Ziyang Men
2026-08-14 7:50 ` [PATCH v3 1/4] selftests: add shared lib.bpf.mk to build " Ziyang Men
2026-08-14 8:01 ` sashiko-bot [this message]
2026-08-14 7:50 ` [PATCH v3 2/4] selftests/cgroup: add memcg_stat_cross_cpu correctness test for flush Ziyang Men
2026-08-14 8:09 ` sashiko-bot
2026-08-14 7:50 ` [PATCH v3 3/4] selftests/hid: build the BPF program via the shared lib.bpf.mk Ziyang Men
2026-08-14 7:50 ` [PATCH v3 4/4] selftests/sched_ext: build BPF schedulers " Ziyang Men
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=20260814080116.62AE71F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=linux-input@vger.kernel.org \
--cc=mkoutny@suse.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
--cc=ziyang.meme@gmail.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