The prepare step is a large serialization point before parallel sub-makes build the perf tool. The libbpf headers are used in the bench and util libraries, as well as individual perf builtin commands. Move the libbpf dependency out of the prepare step and into the dependencies for those targets to avoid it being a source of serialization in the prepare step. Tested-by: James Clark Assisted-by: Gemini:gemini-3.1-pro-preview Signed-off-by: Ian Rogers --- tools/perf/Makefile.perf | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index ec0e91bedce1..5af767415c11 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -547,7 +547,7 @@ export NO_JEVENTS build := -f $(srctree)/tools/build/Makefile.build dir=. obj -$(PERF_IN): prepare FORCE +$(PERF_IN): prepare $(LIBBPF) FORCE $(Q)$(MAKE) $(build)=perf $(LIBPMU_EVENTS_IN): FORCE $(LIBPERF) @@ -558,7 +558,7 @@ $(LIBPMU_EVENTS): $(LIBPMU_EVENTS_IN) # The $(LIBPERF_UTIL) dependency is to ensure bpftool and vmlinux.h # aren't racily built for bench/bpf_skel/bench_uprobe.bpf.c -$(LIBPERF_BENCH_IN): FORCE prepare | $(LIBPERF_UTIL) +$(LIBPERF_BENCH_IN): FORCE prepare $(LIBBPF) | $(LIBPERF_UTIL) $(Q)$(MAKE) $(build)=perf-bench $(LIBPERF_BENCH): $(LIBPERF_BENCH_IN) @@ -576,7 +576,7 @@ $(LIBPERF_UI_IN): FORCE prepare $(LIBPERF_UI): $(LIBPERF_UI_IN) $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $< -$(LIBPERF_UTIL_IN): FORCE prepare +$(LIBPERF_UTIL_IN): FORCE prepare $(LIBBPF) $(Q)$(MAKE) $(build)=perf-util $(LIBPERF_UTIL): $(LIBPERF_UTIL_IN) @@ -636,10 +636,6 @@ prepare: $(OUTPUT)PERF-VERSION-FILE \ $(LIBSUBCMD) \ $(LIBSYMBOL) -ifdef LIBBPF_STATIC -prepare: $(LIBBPF) -endif - $(OUTPUT)%.o: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ -- 2.54.0.563.g4f69b47b94-goog