View Issue Details

IDProjectCategoryView StatusLast Update
0001523channel: kernel/el9kernel-mlpublic2025-05-04 22:14
Reportertoracat Assigned Totoracat  
PrioritynormalSeverityminorReproducibilityhave not tried
Status assignedResolutionopen 
Summary0001523: kernel-ml-6.15.0-0.rc3.el9.elrepo.aarch64 fails to build
DescriptionBuild error is:

tools/arch/arm64/include/uapi/asm/unistd.h:2:10: fatal error: asm/unistd_64.h: No such file or directory
 #include <asm/unistd_64.h>
         ^~~~~~~~~~~~~~~~~

The error is unique to aarch64. x86_64 builds fine.
TagsNo tags attached.

Activities

toracat

2025-04-21 14:36

administrator   ~0010376

This is a know issue. The patch to fix the error is in the queue.

Subject: [PATCH] perf tools: Fix arm64 build by generating unistd_64.h
From: James Clark <james.clark@linaro.org>
Date: Thu, 17 Apr 2025 14:55:50 +0100

Since pulling in the kernel changes in commit 22f72088ffe6 ("tools
headers: Update the syscall table with the kernel sources"), arm64 is
no longer using a generic syscall header and generates one from the
syscall table. Therefore we must also generate the syscall header for
arm64 before building Perf.

Add it as a dependency to libperf which uses one syscall number. Perf
uses more, but as libperf is a dependency of Perf it will be generated
for both.

Future platforms that need this will have to add their own syscall-y
targets in libperf manually. Unfortunately the arch specific files that
do this (e.g. arch/arm64/include/asm/Kbuild) can't easily be imported
into the Perf build. But Perf only needs a subset of the generated files
anyway, so redefining them is probably the correct thing to do.

Fixes: 22f72088ffe6 ("tools headers: Update the syscall table with the kernel sources")
Signed-off-by: James Clark <james.clark@linaro.org>
---
 tools/lib/perf/Makefile | 12 +++++++++++-
 tools/perf/Makefile.config | 1 +
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/lib/perf/Makefile b/tools/lib/perf/Makefile
index ffcfd777c451..1a19b5013f45 100644
--- a/tools/lib/perf/Makefile
+++ b/tools/lib/perf/Makefile
@@ -42,6 +42,7 @@ libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
 TEST_ARGS := $(if $(V),-v)
 
 INCLUDES = \
+-I$(OUTPUT)/../arch/$(SRCARCH)/include/generated/uapi \
 -I$(srctree)/tools/lib/perf/include \
 -I$(srctree)/tools/lib/ \
 -I$(srctree)/tools/include \
@@ -99,7 +100,16 @@ $(LIBAPI)-clean:
     $(call QUIET_CLEAN, libapi)
     $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
 
-$(LIBPERF_IN): FORCE
+uapi-asm := $(OUTPUT)/../arch/$(SRCARCH)/include/generated/uapi/asm
+ifeq ($(SRCARCH),arm64)
+ syscall-y := $(uapi-asm)/unistd_64.h
+endif
+uapi-asm-generic:
+ $(if $(syscall-y),\
+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-headers obj=$(uapi-asm) \
+ generic=include/uapi/asm-generic $(syscall-y),)
+
+$(LIBPERF_IN): uapi-asm-generic FORCE
     $(Q)$(MAKE) $(build)=libperf
 
 $(LIBPERF_A): $(LIBPERF_IN)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index eea95c6c0c71..a52482654d4b 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -29,6 +29,7 @@ include $(srctree)/tools/scripts/Makefile.arch
 $(call detected_var,SRCARCH)
 
 CFLAGS += -I$(OUTPUT)arch/$(SRCARCH)/include/generated
+CFLAGS += -I$(OUTPUT)arch/$(SRCARCH)/include/generated/uapi
 
 # Additional ARCH settings for ppc
 ifeq ($(SRCARCH),powerpc)

---
base-commit: 2b70702917337a8d6d07f03eed961e0119091647
change-id: 20250414-james-perf-fix-gen-syscall-a8d9b4367d07

Best regards,
james.clark@linaro.org

toracat

2025-04-21 14:38

administrator   ~0010377

Applying the patch was confirmed to fix the build error.

At the top of the build tree, run:

$ make -s -C tools/perf NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1 WERROR=0 NO_LIBUNWIND=1 HAVE_CPLUS_DEMANGLE=1 NO_GTK2=1 NO_STRLCPY=1 NO_BIONIC=1 LIBTRACEEVENT_DYNAMIC=1 CORESIGHT=1

toracat

2025-04-24 12:07

administrator   ~0010381

Status update:

Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> on 2025-04-23
Reviewed-by: Leo Yan <leo.yan@arm.com> on 2025-04-24

toracat

2025-04-27 22:42

administrator   ~0010382

The patch did not make it into linux-6.15-rc4 released today. Its build failed with the same error.

toracat

2025-04-29 11:43

administrator   ~0010383

An issue was reported for the patch. The author is now working on fixing it.

toracat

2025-04-29 13:05

administrator   ~0010384

An additional patch has been released to fix the reported issue.

Subject: [PATCH] perf tools: Fix in-source libperf build
From: James Clark <james.clark@linaro.org>
Date: Tue, 29 Apr 2025 15:22:18 +0100

When libperf is built alone in-source, $(OUTPUT) isn't set. This causes
the generated uapi path to resolve to '/../arch' which results in a
permissions error:

  mkdir: cannot create directory '/../arch': Permission denied

Fix it by removing the preceding '/..' which means that it gets
generated either in the tools/lib/perf part of the tree or the OUTPUT
folder. Some other rules that rely on OUTPUT further refine this
conditionally depending on whether it's an in-source or out-of-source
build, but I don't think we need the extra complexity here. And this
rule is slightly different to others because the header is needed by
both libperf and Perf. This is further complicated by the fact that Perf
always passes O=... to libperf even for in source builds, meaning that
OUTPUT isn't set consistently between projects.

Because we're no longer going one level up to try to generate the file
in the tools/ folder, Perf's include rule needs to descend into libperf.
Also fix the clean rule while we're here.

Reported-by: Thorsten Leemhuis <linux@leemhuis.info>
Closes: https://lore.kernel.org/linux-perf-users/7703f88e-ccb7-4c98-9da4-8aad224e780f@leemhuis.info/
Fixes: bfb713ea53c7 ("perf tools: Fix arm64 build by generating unistd_64.h")
Signed-off-by: James Clark <james.clark@linaro.org>
---
 tools/lib/perf/Makefile | 6 +++---
 tools/perf/Makefile.config | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/lib/perf/Makefile b/tools/lib/perf/Makefile
index 1a19b5013f45..7fbb50b74c00 100644
--- a/tools/lib/perf/Makefile
+++ b/tools/lib/perf/Makefile
@@ -42,7 +42,7 @@ libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
 TEST_ARGS := $(if $(V),-v)
 
 INCLUDES = \
--I$(OUTPUT)/../arch/$(SRCARCH)/include/generated/uapi \
+-I$(OUTPUT)arch/$(SRCARCH)/include/generated/uapi \
 -I$(srctree)/tools/lib/perf/include \
 -I$(srctree)/tools/lib/ \
 -I$(srctree)/tools/include \
@@ -100,7 +100,7 @@ $(LIBAPI)-clean:
     $(call QUIET_CLEAN, libapi)
     $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
 
-uapi-asm := $(OUTPUT)/../arch/$(SRCARCH)/include/generated/uapi/asm
+uapi-asm := $(OUTPUT)arch/$(SRCARCH)/include/generated/uapi/asm
 ifeq ($(SRCARCH),arm64)
     syscall-y := $(uapi-asm)/unistd_64.h
 endif
@@ -130,7 +130,7 @@ all: fixdep
 clean: $(LIBAPI)-clean
     $(call QUIET_CLEAN, libperf) $(RM) $(LIBPERF_A) \
                 *.o *~ *.a *.so *.so.$(VERSION) *.so.$(LIBPERF_VERSION) .*.d .*.cmd tests/*.o LIBPERF-CFLAGS $(LIBPERF_PC) \
- $(TESTS_STATIC) $(TESTS_SHARED)
+ $(TESTS_STATIC) $(TESTS_SHARED) $(syscall-y)
 
 TESTS_IN = tests-in.o
 
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index a52482654d4b..b7769a22fe1a 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -29,7 +29,7 @@ include $(srctree)/tools/scripts/Makefile.arch
 $(call detected_var,SRCARCH)
 
 CFLAGS += -I$(OUTPUT)arch/$(SRCARCH)/include/generated
-CFLAGS += -I$(OUTPUT)arch/$(SRCARCH)/include/generated/uapi
+CFLAGS += -I$(OUTPUT)libperf/arch/$(SRCARCH)/include/generated/uapi
 
 # Additional ARCH settings for ppc
 ifeq ($(SRCARCH),powerpc)

---
base-commit: bfb713ea53c746b07ae69fe97fa9b5388e4f34f9
change-id: 20250429-james-perf-fix-libperf-in-source-build-15609cc212aa

Best regards,
james.clark@linaro.org

toracat

2025-04-29 16:21

administrator   ~0010385

Namhyung Kim is going to submit a pull request to Linus soon. Depending on the timing, this might be in 6.15-rc5.

toracat

2025-05-04 15:49

administrator   ~0010392

The pull request submitted to Linus today.

toracat

2025-05-04 19:53

administrator   ~0010393

And the PR has been merged to v6.15-rc5.

toracat

2025-05-04 21:59

administrator   ~0010394

Last edited: 2025-05-04 22:14

I confirmed that the patch was in the source code of v6.15-rc5. However, perf build still fails with the same error. For now we will build and publish x86_64 only.

[EDIT] aarch64 will be built with baseonly.

Issue History

Date Modified Username Field Change
2025-04-21 14:33 toracat New Issue
2025-04-21 14:33 toracat Status new => assigned
2025-04-21 14:33 toracat Assigned To => toracat
2025-04-21 14:36 toracat Note Added: 0010376
2025-04-21 14:38 toracat Note Added: 0010377
2025-04-24 12:07 toracat Note Added: 0010381
2025-04-27 22:42 toracat Note Added: 0010382
2025-04-29 11:43 toracat Note Added: 0010383
2025-04-29 13:05 toracat Note Added: 0010384
2025-04-29 16:21 toracat Note Added: 0010385
2025-05-04 15:49 toracat Note Added: 0010392
2025-05-04 19:53 toracat Note Added: 0010393
2025-05-04 21:59 toracat Note Added: 0010394
2025-05-04 22:14 toracat Note Edited: 0010394