linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf tools: Fix arm64 build by generating unistd_64.h
@ 2025-04-17 13:55 James Clark
  2025-04-23 11:16 ` Harshit Mogalapalli
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: James Clark @ 2025-04-17 13:55 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, arnd
  Cc: Ingo Molnar, linux-perf-users, linux-kernel, James Clark

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 <james.clark@linaro.org>


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

* Re: [PATCH] perf tools: Fix arm64 build by generating unistd_64.h
  2025-04-17 13:55 [PATCH] perf tools: Fix arm64 build by generating unistd_64.h James Clark
@ 2025-04-23 11:16 ` Harshit Mogalapalli
  2025-04-24 10:28 ` Leo Yan
  2025-04-28 13:23 ` Thorsten Leemhuis
  2 siblings, 0 replies; 8+ messages in thread
From: Harshit Mogalapalli @ 2025-04-23 11:16 UTC (permalink / raw)
  To: James Clark, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter, arnd
  Cc: Ingo Molnar, linux-perf-users, linux-kernel

Hi James,

On 17/04/25 19:25, James Clark wrote:
> 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
>  

Thanks for fixing this.

This patch fixes the perf build failure on mainline ARM64.

Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>


Regards,
Harshit

>   # Additional ARCH settings for ppc
>   ifeq ($(SRCARCH),powerpc)
> 
> ---
> base-commit: 2b70702917337a8d6d07f03eed961e0119091647
> change-id: 20250414-james-perf-fix-gen-syscall-a8d9b4367d07
> 
> Best regards,


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

* Re: [PATCH] perf tools: Fix arm64 build by generating unistd_64.h
  2025-04-17 13:55 [PATCH] perf tools: Fix arm64 build by generating unistd_64.h James Clark
  2025-04-23 11:16 ` Harshit Mogalapalli
@ 2025-04-24 10:28 ` Leo Yan
  2025-04-28 13:23 ` Thorsten Leemhuis
  2 siblings, 0 replies; 8+ messages in thread
From: Leo Yan @ 2025-04-24 10:28 UTC (permalink / raw)
  To: James Clark
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, arnd, Ingo Molnar, linux-perf-users,
	linux-kernel

On Thu, Apr 17, 2025 at 02:55:50PM +0100, James Clark wrote:
> 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>

Reviewed-by: Leo Yan <leo.yan@arm.com>

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

* Re: [PATCH] perf tools: Fix arm64 build by generating unistd_64.h
  2025-04-17 13:55 [PATCH] perf tools: Fix arm64 build by generating unistd_64.h James Clark
  2025-04-23 11:16 ` Harshit Mogalapalli
  2025-04-24 10:28 ` Leo Yan
@ 2025-04-28 13:23 ` Thorsten Leemhuis
  2025-04-29  7:42   ` James Clark
  2 siblings, 1 reply; 8+ messages in thread
From: Thorsten Leemhuis @ 2025-04-28 13:23 UTC (permalink / raw)
  To: James Clark, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter, arnd
  Cc: Ingo Molnar, linux-perf-users, linux-kernel

On 17.04.25 15:55, James Clark wrote:
> 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.

FYI, my daily -next build for Fedora based on its RPM spec file broke
on arm64 (x86_64 worked fine) while building libperf. I haven't checked
yet, but due to the error messages and a quick look in the history I
wonder if this is due to the quoted change, which showed up in -next
today:

"""
kernel.spec:3115: build libperf
+ /usr/bin/make -s 'EXTRA_CFLAGS=-O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection  ' 'LDFLAGS=-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' -C tools/lib/perf V=1 DESTDIR=/builddir/build/BUILD/kernel-6.15.0-build/BUILDROOT
mkdir: cannot create directory ‘/../arch’: Permission denied
/builddir/build/BUILD/kernel-6.15.0-build/kernel-next-20250428/linux-6.15.0-0.0.next.20250428.435.vanilla.fc43.aarch64/scripts/syscallhdr.sh: line 98: /../arch/arm64/include/generated/uapi/asm/unistd_64.h: No such file or directory
make[2]: *** [/builddir/build/BUILD/kernel-6.15.0-build/kernel-next-20250428/linux-6.15.0-0.0.next.20250428.435.vanilla.fc43.aarch64/scripts/Makefile.asm-headers:81: /../arch/arm64/include/generated/uapi/asm/unistd_64.h] Error 1
make[1]: *** [Makefile:108: uapi-asm-generic] Error 2
make: *** [Makefile:128: all] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.vAfil2 (%build)
"""

Full log: https://download.copr.fedorainfracloud.org/results/@kernel-vanilla/next/fedora-rawhide-aarch64/08975350-next-next-all/builder-live.log.gz

Ciao, Thorsten
 
> 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,


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

* Re: [PATCH] perf tools: Fix arm64 build by generating unistd_64.h
  2025-04-28 13:23 ` Thorsten Leemhuis
@ 2025-04-29  7:42   ` James Clark
  2025-04-29  7:52     ` James Clark
  0 siblings, 1 reply; 8+ messages in thread
From: James Clark @ 2025-04-29  7:42 UTC (permalink / raw)
  To: Thorsten Leemhuis
  Cc: Ingo Molnar, linux-perf-users, linux-kernel, Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter, arnd



On 28/04/2025 2:23 pm, Thorsten Leemhuis wrote:
> On 17.04.25 15:55, James Clark wrote:
>> 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.
> 
> FYI, my daily -next build for Fedora based on its RPM spec file broke
> on arm64 (x86_64 worked fine) while building libperf. I haven't checked
> yet, but due to the error messages and a quick look in the history I
> wonder if this is due to the quoted change, which showed up in -next
> today:
> 
> """
> kernel.spec:3115: build libperf
> + /usr/bin/make -s 'EXTRA_CFLAGS=-O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection  ' 'LDFLAGS=-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' -C tools/lib/perf V=1 DESTDIR=/builddir/build/BUILD/kernel-6.15.0-build/BUILDROOT
> mkdir: cannot create directory ‘/../arch’: Permission denied
> /builddir/build/BUILD/kernel-6.15.0-build/kernel-next-20250428/linux-6.15.0-0.0.next.20250428.435.vanilla.fc43.aarch64/scripts/syscallhdr.sh: line 98: /../arch/arm64/include/generated/uapi/asm/unistd_64.h: No such file or directory
> make[2]: *** [/builddir/build/BUILD/kernel-6.15.0-build/kernel-next-20250428/linux-6.15.0-0.0.next.20250428.435.vanilla.fc43.aarch64/scripts/Makefile.asm-headers:81: /../arch/arm64/include/generated/uapi/asm/unistd_64.h] Error 1
> make[1]: *** [Makefile:108: uapi-asm-generic] Error 2
> make: *** [Makefile:128: all] Error 2
> error: Bad exit status from /var/tmp/rpm-tmp.vAfil2 (%build)
> """
> 
> Full log: https://download.copr.fedorainfracloud.org/results/@kernel-vanilla/next/fedora-rawhide-aarch64/08975350-next-next-all/builder-live.log.gz
> 
> Ciao, Thorsten
>   

Hi Thorsten,

Yes, this is the error that the fix is for.


James

>> 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,
> 


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

* Re: [PATCH] perf tools: Fix arm64 build by generating unistd_64.h
  2025-04-29  7:42   ` James Clark
@ 2025-04-29  7:52     ` James Clark
  2025-04-29  8:02       ` Thorsten Leemhuis
  0 siblings, 1 reply; 8+ messages in thread
From: James Clark @ 2025-04-29  7:52 UTC (permalink / raw)
  To: Thorsten Leemhuis
  Cc: Ingo Molnar, linux-perf-users, linux-kernel, Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter, arnd



On 29/04/2025 8:42 am, James Clark wrote:
> 
> 
> On 28/04/2025 2:23 pm, Thorsten Leemhuis wrote:
>> On 17.04.25 15:55, James Clark wrote:
>>> 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.
>>
>> FYI, my daily -next build for Fedora based on its RPM spec file broke
>> on arm64 (x86_64 worked fine) while building libperf. I haven't checked
>> yet, but due to the error messages and a quick look in the history I
>> wonder if this is due to the quoted change, which showed up in -next
>> today:
>>
>> """
>> kernel.spec:3115: build libperf
>> + /usr/bin/make -s 'EXTRA_CFLAGS=-O2  -fexceptions -g -grecord-gcc- 
>> switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security 
>> -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS - 
>> specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong 
>> -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch- 
>> protection=standard -fasynchronous-unwind-tables -fstack-clash- 
>> protection  ' 'LDFLAGS=-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack- 
>> relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened- 
>> ld -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -specs=/usr/ 
>> lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -specs=/usr/ 
>> lib/rpm/redhat/redhat-package-notes ' -C tools/lib/perf V=1 DESTDIR=/ 
>> builddir/build/BUILD/kernel-6.15.0-build/BUILDROOT
>> mkdir: cannot create directory ‘/../arch’: Permission denied
>> /builddir/build/BUILD/kernel-6.15.0-build/kernel-next-20250428/ 
>> linux-6.15.0-0.0.next.20250428.435.vanilla.fc43.aarch64/scripts/ 
>> syscallhdr.sh: line 98: /../arch/arm64/include/generated/uapi/asm/ 
>> unistd_64.h: No such file or directory
>> make[2]: *** [/builddir/build/BUILD/kernel-6.15.0-build/kernel- 
>> next-20250428/linux-6.15.0-0.0.next.20250428.435.vanilla.fc43.aarch64/ 
>> scripts/Makefile.asm-headers:81: /../arch/arm64/include/generated/ 
>> uapi/asm/unistd_64.h] Error 1
>> make[1]: *** [Makefile:108: uapi-asm-generic] Error 2
>> make: *** [Makefile:128: all] Error 2
>> error: Bad exit status from /var/tmp/rpm-tmp.vAfil2 (%build)
>> """
>>
>> Full log: https://download.copr.fedorainfracloud.org/results/@kernel- 
>> vanilla/next/fedora-rawhide-aarch64/08975350-next-next-all/builder- 
>> live.log.gz
>>
>> Ciao, Thorsten
> 
> Hi Thorsten,
> 
> Yes, this is the error that the fix is for.
> 
> 
> James
> 

Sorry I had it the wrong way around, I see you were asking about a new 
build failure caused by the fix. Looking into it now.

I noticed some strange characters in here, but I might have enough to go 
on from the logs:

   mkdir: cannot create directory ‘/../arch’: Permission denied


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

* Re: [PATCH] perf tools: Fix arm64 build by generating unistd_64.h
  2025-04-29  7:52     ` James Clark
@ 2025-04-29  8:02       ` Thorsten Leemhuis
  2025-04-29  9:21         ` James Clark
  0 siblings, 1 reply; 8+ messages in thread
From: Thorsten Leemhuis @ 2025-04-29  8:02 UTC (permalink / raw)
  To: James Clark
  Cc: Ingo Molnar, linux-perf-users, linux-kernel, Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter, arnd

On 29.04.25 09:52, James Clark wrote:
> On 29/04/2025 8:42 am, James Clark wrote:
>> On 28/04/2025 2:23 pm, Thorsten Leemhuis wrote:
>>> On 17.04.25 15:55, James Clark wrote:
>>>> 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.
>>>
>>> FYI, my daily -next build for Fedora based on its RPM spec file broke
>>> on arm64 (x86_64 worked fine) while building libperf. I haven't checked
>>> yet, but due to the error messages and a quick look in the history I
>>> wonder if this is due to the quoted change, which showed up in -next
>>> today:
>>>
>>> """
>>> kernel.spec:3115: build libperf
>>> + /usr/bin/make -s 'EXTRA_CFLAGS=-O2  -fexceptions -g -grecord-gcc-
>>> switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security
>>> -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -
>>> specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-
>>> strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-
>>> protection=standard -fasynchronous-unwind-tables -fstack-clash-
>>> protection  ' 'LDFLAGS=-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-
>>> relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-
>>> hardened- ld -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -
>>> specs=/usr/ lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -
>>> specs=/usr/ lib/rpm/redhat/redhat-package-notes ' -C tools/lib/perf
>>> V=1 DESTDIR=/ builddir/build/BUILD/kernel-6.15.0-build/BUILDROOT
>>> mkdir: cannot create directory ‘/../arch’: Permission denied
>>> /builddir/build/BUILD/kernel-6.15.0-build/kernel-next-20250428/
>>> linux-6.15.0-0.0.next.20250428.435.vanilla.fc43.aarch64/scripts/
>>> syscallhdr.sh: line 98: /../arch/arm64/include/generated/uapi/asm/
>>> unistd_64.h: No such file or directory
>>> make[2]: *** [/builddir/build/BUILD/kernel-6.15.0-build/kernel-
>>> next-20250428/
>>> linux-6.15.0-0.0.next.20250428.435.vanilla.fc43.aarch64/ scripts/
>>> Makefile.asm-headers:81: /../arch/arm64/include/generated/ uapi/asm/
>>> unistd_64.h] Error 1
>>> make[1]: *** [Makefile:108: uapi-asm-generic] Error 2
>>> make: *** [Makefile:128: all] Error 2
>>> error: Bad exit status from /var/tmp/rpm-tmp.vAfil2 (%build)
>>> """
>>>
>>> Full log: https://download.copr.fedorainfracloud.org/results/@kernel-
>>> vanilla/next/fedora-rawhide-aarch64/08975350-next-next-all/builder-
>>> live.log.gz
>>
>> Yes, this is the error that the fix is for.
> 
> Sorry I had it the wrong way around,

Okay, for a moment I was confused and wondered if I was holding things
wrong. :-D

> I see you were asking about a new
> build failure caused by the fix. Looking into it now.

Many thx!

> I noticed some strange characters in here

Sorry, that was my (or my browsers) fault (some encoding mixup somewhere
I've seen earlier) and highly unlikely to be related.

>   mkdir: cannot create directory ‘/../arch’: Permission denied

Ciao, Thorsten

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

* Re: [PATCH] perf tools: Fix arm64 build by generating unistd_64.h
  2025-04-29  8:02       ` Thorsten Leemhuis
@ 2025-04-29  9:21         ` James Clark
  0 siblings, 0 replies; 8+ messages in thread
From: James Clark @ 2025-04-29  9:21 UTC (permalink / raw)
  To: Thorsten Leemhuis
  Cc: Ingo Molnar, linux-perf-users, linux-kernel, Peter Zijlstra,
	Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter, arnd



On 29/04/2025 9:02 am, Thorsten Leemhuis wrote:
> On 29.04.25 09:52, James Clark wrote:
>> On 29/04/2025 8:42 am, James Clark wrote:
>>> On 28/04/2025 2:23 pm, Thorsten Leemhuis wrote:
>>>> On 17.04.25 15:55, James Clark wrote:
>>>>> 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.
>>>>
>>>> FYI, my daily -next build for Fedora based on its RPM spec file broke
>>>> on arm64 (x86_64 worked fine) while building libperf. I haven't checked
>>>> yet, but due to the error messages and a quick look in the history I
>>>> wonder if this is due to the quoted change, which showed up in -next
>>>> today:
>>>>
>>>> """
>>>> kernel.spec:3115: build libperf
>>>> + /usr/bin/make -s 'EXTRA_CFLAGS=-O2  -fexceptions -g -grecord-gcc-
>>>> switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security
>>>> -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -
>>>> specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-
>>>> strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-
>>>> protection=standard -fasynchronous-unwind-tables -fstack-clash-
>>>> protection  ' 'LDFLAGS=-Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-
>>>> relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-
>>>> hardened- ld -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -
>>>> specs=/usr/ lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1 -
>>>> specs=/usr/ lib/rpm/redhat/redhat-package-notes ' -C tools/lib/perf
>>>> V=1 DESTDIR=/ builddir/build/BUILD/kernel-6.15.0-build/BUILDROOT
>>>> mkdir: cannot create directory ‘/../arch’: Permission denied
>>>> /builddir/build/BUILD/kernel-6.15.0-build/kernel-next-20250428/
>>>> linux-6.15.0-0.0.next.20250428.435.vanilla.fc43.aarch64/scripts/
>>>> syscallhdr.sh: line 98: /../arch/arm64/include/generated/uapi/asm/
>>>> unistd_64.h: No such file or directory
>>>> make[2]: *** [/builddir/build/BUILD/kernel-6.15.0-build/kernel-
>>>> next-20250428/
>>>> linux-6.15.0-0.0.next.20250428.435.vanilla.fc43.aarch64/ scripts/
>>>> Makefile.asm-headers:81: /../arch/arm64/include/generated/ uapi/asm/
>>>> unistd_64.h] Error 1
>>>> make[1]: *** [Makefile:108: uapi-asm-generic] Error 2
>>>> make: *** [Makefile:128: all] Error 2
>>>> error: Bad exit status from /var/tmp/rpm-tmp.vAfil2 (%build)
>>>> """
>>>>
>>>> Full log: https://download.copr.fedorainfracloud.org/results/@kernel-
>>>> vanilla/next/fedora-rawhide-aarch64/08975350-next-next-all/builder-
>>>> live.log.gz
>>>
>>> Yes, this is the error that the fix is for.
>>
>> Sorry I had it the wrong way around,
> 
> Okay, for a moment I was confused and wondered if I was holding things
> wrong. :-D
> 
>> I see you were asking about a new
>> build failure caused by the fix. Looking into it now.
> 
> Many thx!
> 
>> I noticed some strange characters in here
> 
> Sorry, that was my (or my browsers) fault (some encoding mixup somewhere
> I've seen earlier) and highly unlikely to be related.
> 

Yep, not related it's just the quotes around the error printout. I just 
need to use $(OUTPUT) properly without the "/../" on the end of it. If 
OUTPUT isn't set it tries to go up one from root rather than being 
relative to cwd.

I'll send a patch.

>>    mkdir: cannot create directory ‘/../arch’: Permission denied
> 
> Ciao, Thorsten


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

end of thread, other threads:[~2025-04-29  9:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-17 13:55 [PATCH] perf tools: Fix arm64 build by generating unistd_64.h James Clark
2025-04-23 11:16 ` Harshit Mogalapalli
2025-04-24 10:28 ` Leo Yan
2025-04-28 13:23 ` Thorsten Leemhuis
2025-04-29  7:42   ` James Clark
2025-04-29  7:52     ` James Clark
2025-04-29  8:02       ` Thorsten Leemhuis
2025-04-29  9:21         ` James Clark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).