From: Gaurav Sharma <sgaurav00719@gmail.com>
To: linux-perf-users@vger.kernel.org
Cc: acme@kernel.org, namhyung@kernel.org, irogers@google.com,
stable@vger.kernel.org, linux-kernel@vger.kernel.org,
Gaurav Sharma <mgsharm@amazon.com>
Subject: [PATCH] libperf: fix parallel build race with header install
Date: Tue, 14 Apr 2026 00:12:42 -0700 [thread overview]
Message-ID: <20260414071242.95637-1-mgsharm@amazon.com> (raw)
When perf is built with high parallelism (-j128), there is a race
condition between the install_headers and libperf.a targets in the
libperf sub-build. Both are invoked as targets of a single make
invocation from Makefile.perf:
$(MAKE) -C $(LIBPERF_DIR) ... $@ install_headers
The perf tool's exported CFLAGS includes -I$(LIBPERF_OUTPUT)/include
which points to the header install destination. The coreutils install
command creates the destination file (truncated) before writing content.
If the compiler runs between file creation and content write, it
includes an empty header, causing incomplete type and missing prototype
errors in the libperf source files.
Fix this by making the libperf compilation target depend on
install_headers, ensuring all headers are fully installed before any
source files are compiled.
Fixes: 91009a3a9913 ("perf build: Install libperf locally when building")
Cc: stable@vger.kernel.org
Signed-off-by: Gaurav Sharma <mgsharm@amazon.com>
---
tools/lib/perf/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/perf/Makefile b/tools/lib/perf/Makefile
index 32301a1d8f0c..8372cd9919b7 100644
--- a/tools/lib/perf/Makefile
+++ b/tools/lib/perf/Makefile
@@ -99,7 +99,7 @@ $(LIBAPI)-clean:
$(call QUIET_CLEAN, libapi)
$(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
-$(LIBPERF_IN): FORCE
+$(LIBPERF_IN): install_headers FORCE
$(Q)$(MAKE) $(build)=libperf
$(LIBPERF_A): $(LIBPERF_IN)
--
2.50.1 (Apple Git-155)
next reply other threads:[~2026-04-14 7:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-14 7:12 Gaurav Sharma [this message]
2026-04-14 13:13 ` [PATCH] libperf: fix parallel build race with header install Ian Rogers
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=20260414071242.95637-1-mgsharm@amazon.com \
--to=sgaurav00719@gmail.com \
--cc=acme@kernel.org \
--cc=irogers@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mgsharm@amazon.com \
--cc=namhyung@kernel.org \
--cc=stable@vger.kernel.org \
/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