Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH v2 0/4] selftests: shared lib.bpf.mk for building BPF progs and skeletons
@ 2026-07-21 17:48 Ziyang Men
  2026-07-21 17:48 ` [PATCH v2 1/4] selftests: add shared lib.bpf.mk to build " Ziyang Men
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Ziyang Men @ 2026-07-21 17:48 UTC (permalink / raw)
  To: Shuah Khan, Tejun Heo, Johannes Weiner, Michal Koutný,
	Jiri Kosina, Benjamin Tissoires, David Vernet, Eduard Zingerman
  Cc: Andrea Righi, Changwoo Min, Michal Hocko, Roman Gushchin,
	Shakeel Butt, Muchun Song, Andrew Morton, JP Kobryn,
	Mykola Lysenko, Nathan Chancellor, linux-kselftest, cgroups,
	linux-input, sched-ext, linux-mm, kernel-team, bpf, llvm,
	linux-kernel, Ziyang Men

This series re-factors the bpf-related toolchain for selftests, which
currently duplicated across selftests/{bpf,sched_ext,hid}/. Unify them
into a single includable fragment, tools/testing/selftests/lib.bpf.mk,
and wires up three consumers. We believe this will simplify the work for
configuraing selftests with the bpf, for both the existing and future ones.

Patch 1 adds lib.bpf.mk: it builds the in-tree libbpf.a and a host
bpftool, generates vmlinux.h from the kernel's BTF, compiles *.bpf.c into
BPF objects and skeletons, and exports the include paths, a bpf_link
helper, and BPF_LDLIBS.  Use can control the behavior by several knobs
(source layout/suffix, extra headers/cflags, skeleton suffix,
subskeletons, output dirs) that can be used commonly in general cases.

Patch 2 adds a new selftest, test_memcg_stat_cross_cpu, under
selftests/cgroup. This test is a memory-cgroup statistics correctness
test that compares the memcg BPF kfuncs against memory.stat over a whole
cgroup subtree charged across many CPUs, and checks the cross-CPU rstat
flush. It is the first in-tree consumer of lib.bpf.mk outside
selftests/bpf.

Patches 3 and 4 convert the duplicated parts in Makefile for two
existing duplicating bpf consumers, the selftests/hid and
selftests/sched_ext, to lib.bpf.mk.  The generated skeletons keep
a byte-identical public API and land in the same locations as before.
The folders build cleanly under both plain make and LLVM=1.

Changes since v1:
  - Generalized lib.bpf.mk (source layout/suffix, extra hdrs/cflags,
    skeleton suffix, subskeletons, configurable output dirs) so it can
    serve hid and sched_ext, not just cgroup.
  - Added patch 3 (hid) and patch 4 (sched_ext), converting those folders
    to the shared fragment.

Ziyang Men (4):
  selftests: add shared lib.bpf.mk to build BPF progs and skeletons
  selftests/cgroup: add memcg_stat_cross_cpu correctness test for flush
  selftests/hid: build the BPF program via the shared lib.bpf.mk
  selftests/sched_ext: build BPF schedulers via the shared lib.bpf.mk

 tools/testing/selftests/cgroup/.gitignore     |   6 +
 tools/testing/selftests/cgroup/Makefile       |  21 +
 tools/testing/selftests/cgroup/config         |   4 +
 .../selftests/cgroup/lib/cgroup_util.c        |  48 ++
 .../cgroup/lib/include/cgroup_util.h          |   1 +
 .../cgroup/memcg_stat_cross_cpu.bpf.c         |  86 ++
 .../selftests/cgroup/memcg_stat_cross_cpu.h   |  27 +
 .../cgroup/test_memcg_stat_cross_cpu.c        | 780 ++++++++++++++++++
 tools/testing/selftests/hid/Makefile          | 182 +---
 tools/testing/selftests/lib.bpf.mk            | 247 ++++++
 tools/testing/selftests/sched_ext/Makefile    | 153 +---
 11 files changed, 1275 insertions(+), 280 deletions(-)
 create mode 100644 tools/testing/selftests/cgroup/memcg_stat_cross_cpu.bpf.c
 create mode 100644 tools/testing/selftests/cgroup/memcg_stat_cross_cpu.h
 create mode 100644 tools/testing/selftests/cgroup/test_memcg_stat_cross_cpu.c
 create mode 100644 tools/testing/selftests/lib.bpf.mk


base-commit: 6eb8711ece2ce27e52e327a5b7a628ed39b97f45
-- 
2.53.0-Meta


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-07-22  9:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-21 17:48 [PATCH v2 0/4] selftests: shared lib.bpf.mk for building BPF progs and skeletons Ziyang Men
2026-07-21 17:48 ` [PATCH v2 1/4] selftests: add shared lib.bpf.mk to build " Ziyang Men
2026-07-21 17:58   ` sashiko-bot
2026-07-22  6:50   ` Viktor Malik
2026-07-22  9:56   ` bot+bpf-ci
2026-07-21 17:48 ` [PATCH v2 2/4] selftests/cgroup: add memcg_stat_cross_cpu correctness test for flush Ziyang Men
2026-07-21 18:01   ` sashiko-bot
2026-07-22  9:43   ` Michal Koutný
2026-07-21 17:48 ` [PATCH v2 3/4] selftests/hid: build the BPF program via the shared lib.bpf.mk Ziyang Men
2026-07-21 17:48 ` [PATCH v2 4/4] selftests/sched_ext: build BPF schedulers " Ziyang Men

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox