* [PATCH v4 0/3] tools build: Fix arm64 unistd.h dependency
@ 2026-01-08 9:43 Leo Yan
2026-01-08 9:43 ` [PATCH v4 1/3] tools headers: Go back to include asm-generic/unistd.h for arm64 Leo Yan
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Leo Yan @ 2026-01-08 9:43 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, Arnd Bergmann
Cc: linux-kernel, linux-perf-users, Leo Yan
The perf build includes arm64's unistd.h, but its dependent header
unistd_64.h is missing.
As suggested by Arnd in [1]:
"I would suggest using the same method across all architectures:
either we figure out how to use the generated headers on all of them
(including x86, which uses yet another method), or we just stick with
the old asm-generic/unistd.h copy and use that on arm64 as well."
A dynamic approach (e.g., make headers_install) may be explored later to
generate headers for tools, but that will need consensus from the tools
maintainers. In the meantime, this series provides a quick fix by using
the asm-generic/unistd.h copy for arm64.
[1] https://lore.kernel.org/linux-arm-kernel/20251222173653.GF9788@e132581.arm.com/T/#m69a051aae5e53a65f9b10e1d13f67b3e92f4bbc7
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
Changes in v4:
- Updated commit log in patch 01 to avoid confusion (James).
- Link to v3: https://lore.kernel.org/r/20251222-perf_fix_syscall_header-v3-0-eb4a8b9dfe66@arm.com
Changes in v3:
- Changed to include asm-generic/unistd.h copy (Arnd).
- Removed check due to divergence between the kernel and tools.
- Link to v2: https://lore.kernel.org/r/20251210-perf_fix_syscall_header-v2-0-b18b6016e0ea@arm.com
Changes in v2:
- Added a consistency check (Ian).
- Rebased on the latest perf-tools-next.
- Link to v1: https://lore.kernel.org/r/20251204-perf_fix_syscall_header-v1-0-b8e27f74ed6a@arm.com
---
Leo Yan (3):
tools headers: Go back to include asm-generic/unistd.h for arm64
Revert "perf tools: Fix arm64 build by generating unistd_64.h"
tools headers: Don't check arm64's unistd.h
tools/arch/arm64/include/uapi/asm/unistd.h | 24 +++++++++++++++++++++++-
tools/lib/perf/Makefile | 14 ++------------
tools/perf/Makefile.config | 1 -
tools/perf/check-headers.sh | 1 -
4 files changed, 25 insertions(+), 15 deletions(-)
---
base-commit: cbd41c6d4c26c161a2b0e70ad411d3885ff13507
change-id: 20251203-perf_fix_syscall_header-e280fa931d44
Best regards,
--
Leo Yan <leo.yan@arm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v4 1/3] tools headers: Go back to include asm-generic/unistd.h for arm64
2026-01-08 9:43 [PATCH v4 0/3] tools build: Fix arm64 unistd.h dependency Leo Yan
@ 2026-01-08 9:43 ` Leo Yan
2026-01-08 9:43 ` [PATCH v4 2/3] Revert "perf tools: Fix arm64 build by generating unistd_64.h" Leo Yan
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Leo Yan @ 2026-01-08 9:43 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, Arnd Bergmann
Cc: linux-kernel, linux-perf-users, Leo Yan
The header unistd.h is included under Arm64's uAPI folder (see
tools/arch/arm64/include/uapi/asm/), but it does not include its
dependent header unistd_64.h. The intention is for unistd_64.h to be
generated dynamically using scripts/Makefile.asm-headers.
However, this dynamic approach causes problems because the header is not
available early enough, even though it is widely included throughout
tools. Using the perf build as an example:
1) Feature detection: Perf first runs feature tests.
The BPF feature program test-bpf.c includes unistd.h. Since
unistd_64.h has not been generated yet, the program fails to build,
and the BPF feature ends up being disabled.
2) libperf build:
The libperf Makefile later generates unistd_64.h on the fly, so
libperf itself builds successfully.
3) Final perf build:
Although the perf binary can build successfully using the generated
header, we never get a chance to build BPF skeleton programs,
because BPF support was already disabled earlier.
Restore to include asm-generic/unistd.h for fixing the issue. This
aligns with most architectures (x86 is a special case that keeps
unistd_32.h/unistd_64.h for its particular syscall numbers) and ensures
the header is available from the start.
Fixes: 22f72088ffe6 ("tools headers: Update the syscall table with the kernel sources")
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
| 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
--git a/tools/arch/arm64/include/uapi/asm/unistd.h b/tools/arch/arm64/include/uapi/asm/unistd.h
index df36f23876e863ff0a9e88473d5339f7ab69516d..9306726337fe005e3cf3e1ffd38dc6356191fa95 100644
--- a/tools/arch/arm64/include/uapi/asm/unistd.h
+++ b/tools/arch/arm64/include/uapi/asm/unistd.h
@@ -1,2 +1,24 @@
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
-#include <asm/unistd_64.h>
+/*
+ * Copyright (C) 2012 ARM Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define __ARCH_WANT_RENAMEAT
+#define __ARCH_WANT_NEW_STAT
+#define __ARCH_WANT_SET_GET_RLIMIT
+#define __ARCH_WANT_TIME32_SYSCALLS
+#define __ARCH_WANT_MEMFD_SECRET
+
+#include <asm-generic/unistd.h>
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v4 2/3] Revert "perf tools: Fix arm64 build by generating unistd_64.h"
2026-01-08 9:43 [PATCH v4 0/3] tools build: Fix arm64 unistd.h dependency Leo Yan
2026-01-08 9:43 ` [PATCH v4 1/3] tools headers: Go back to include asm-generic/unistd.h for arm64 Leo Yan
@ 2026-01-08 9:43 ` Leo Yan
2026-01-08 9:43 ` [PATCH v4 3/3] tools headers: Don't check arm64's unistd.h Leo Yan
2026-01-20 10:30 ` [PATCH v4 0/3] tools build: Fix arm64 unistd.h dependency James Clark
3 siblings, 0 replies; 5+ messages in thread
From: Leo Yan @ 2026-01-08 9:43 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, Arnd Bergmann
Cc: linux-kernel, linux-perf-users, Leo Yan
This reverts:
commit 8988c4b91945 ("perf tools: Fix in-source libperf build")
commit bfb713ea53c7 ("perf tools: Fix arm64 build by generating unistd_64.h")
Since we now have a static unistd_64.h for the arm64 build, there is no
need to generate unistd_64.h in libperf. Revert all patches related to
generating unistd_64.h.
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
| 14 ++------------
| 1 -
2 files changed, 2 insertions(+), 13 deletions(-)
--git a/tools/lib/perf/Makefile b/tools/lib/perf/Makefile
index 7fbb50b74c00b3b99ac538821124e04bfbc6da6a..ffcfd777c45181960afc7505ef8f85d0b7ea7e8d 100644
--- a/tools/lib/perf/Makefile
+++ b/tools/lib/perf/Makefile
@@ -42,7 +42,6 @@ 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 \
@@ -100,16 +99,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
-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
+$(LIBPERF_IN): FORCE
$(Q)$(MAKE) $(build)=libperf
$(LIBPERF_A): $(LIBPERF_IN)
@@ -130,7 +120,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) $(syscall-y)
+ $(TESTS_STATIC) $(TESTS_SHARED)
TESTS_IN = tests-in.o
--git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index bd9f4804d56babeeefd0c02758bebf1ff0c040dd..c97ed1190ea097c41ca83f2ace06c008cd7f0ca9 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -64,7 +64,6 @@ include $(srctree)/tools/scripts/Makefile.arch
$(call detected_var,SRCARCH)
CFLAGS += -I$(OUTPUT)arch/$(SRCARCH)/include/generated
-CFLAGS += -I$(OUTPUT)libperf/arch/$(SRCARCH)/include/generated/uapi
# Additional ARCH settings for ppc
ifeq ($(SRCARCH),powerpc)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v4 3/3] tools headers: Don't check arm64's unistd.h
2026-01-08 9:43 [PATCH v4 0/3] tools build: Fix arm64 unistd.h dependency Leo Yan
2026-01-08 9:43 ` [PATCH v4 1/3] tools headers: Go back to include asm-generic/unistd.h for arm64 Leo Yan
2026-01-08 9:43 ` [PATCH v4 2/3] Revert "perf tools: Fix arm64 build by generating unistd_64.h" Leo Yan
@ 2026-01-08 9:43 ` Leo Yan
2026-01-20 10:30 ` [PATCH v4 0/3] tools build: Fix arm64 unistd.h dependency James Clark
3 siblings, 0 replies; 5+ messages in thread
From: Leo Yan @ 2026-01-08 9:43 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Ian Rogers,
Adrian Hunter, James Clark, Arnd Bergmann
Cc: linux-kernel, linux-perf-users, Leo Yan
The arm64 unistd.h in tools now diverges from the kernel header.
Comparing the two headers is pointless, remove the check.
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
| 1 -
1 file changed, 1 deletion(-)
--git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index e0537f275da2f79ea9e05b91300aa1e2f996e9f1..da3aca87457fdc56c96d4184f2dee88dab026d98 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -54,7 +54,6 @@ declare -a FILES=(
"arch/s390/include/uapi/asm/kvm.h"
"arch/s390/include/uapi/asm/sie.h"
"arch/arm64/include/uapi/asm/kvm.h"
- "arch/arm64/include/uapi/asm/unistd.h"
"arch/alpha/include/uapi/asm/errno.h"
"arch/mips/include/asm/errno.h"
"arch/mips/include/uapi/asm/errno.h"
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v4 0/3] tools build: Fix arm64 unistd.h dependency
2026-01-08 9:43 [PATCH v4 0/3] tools build: Fix arm64 unistd.h dependency Leo Yan
` (2 preceding siblings ...)
2026-01-08 9:43 ` [PATCH v4 3/3] tools headers: Don't check arm64's unistd.h Leo Yan
@ 2026-01-20 10:30 ` James Clark
3 siblings, 0 replies; 5+ messages in thread
From: James Clark @ 2026-01-20 10:30 UTC (permalink / raw)
To: Leo Yan, Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa,
Ian Rogers, Adrian Hunter, Arnd Bergmann
Cc: linux-kernel, linux-perf-users
On 08/01/2026 9:43 am, Leo Yan wrote:
> The perf build includes arm64's unistd.h, but its dependent header
> unistd_64.h is missing.
>
> As suggested by Arnd in [1]:
>
> "I would suggest using the same method across all architectures:
> either we figure out how to use the generated headers on all of them
> (including x86, which uses yet another method), or we just stick with
> the old asm-generic/unistd.h copy and use that on arm64 as well."
>
> A dynamic approach (e.g., make headers_install) may be explored later to
> generate headers for tools, but that will need consensus from the tools
> maintainers. In the meantime, this series provides a quick fix by using
> the asm-generic/unistd.h copy for arm64.
>
BPF feature detection is fixed on Arm with this change. And the make
headers_install idea sounds good for later.
Reviewed-by: James Clark <james.clark@linaro.org>
> [1] https://lore.kernel.org/linux-arm-kernel/20251222173653.GF9788@e132581.arm.com/T/#m69a051aae5e53a65f9b10e1d13f67b3e92f4bbc7
>
> Signed-off-by: Leo Yan <leo.yan@arm.com>
> ---
> Changes in v4:
> - Updated commit log in patch 01 to avoid confusion (James).
> - Link to v3: https://lore.kernel.org/r/20251222-perf_fix_syscall_header-v3-0-eb4a8b9dfe66@arm.com
>
> Changes in v3:
> - Changed to include asm-generic/unistd.h copy (Arnd).
> - Removed check due to divergence between the kernel and tools.
> - Link to v2: https://lore.kernel.org/r/20251210-perf_fix_syscall_header-v2-0-b18b6016e0ea@arm.com
>
> Changes in v2:
> - Added a consistency check (Ian).
> - Rebased on the latest perf-tools-next.
> - Link to v1: https://lore.kernel.org/r/20251204-perf_fix_syscall_header-v1-0-b8e27f74ed6a@arm.com
>
> ---
> Leo Yan (3):
> tools headers: Go back to include asm-generic/unistd.h for arm64
> Revert "perf tools: Fix arm64 build by generating unistd_64.h"
> tools headers: Don't check arm64's unistd.h
>
> tools/arch/arm64/include/uapi/asm/unistd.h | 24 +++++++++++++++++++++++-
> tools/lib/perf/Makefile | 14 ++------------
> tools/perf/Makefile.config | 1 -
> tools/perf/check-headers.sh | 1 -
> 4 files changed, 25 insertions(+), 15 deletions(-)
> ---
> base-commit: cbd41c6d4c26c161a2b0e70ad411d3885ff13507
> change-id: 20251203-perf_fix_syscall_header-e280fa931d44
>
> Best regards,
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-20 10:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-08 9:43 [PATCH v4 0/3] tools build: Fix arm64 unistd.h dependency Leo Yan
2026-01-08 9:43 ` [PATCH v4 1/3] tools headers: Go back to include asm-generic/unistd.h for arm64 Leo Yan
2026-01-08 9:43 ` [PATCH v4 2/3] Revert "perf tools: Fix arm64 build by generating unistd_64.h" Leo Yan
2026-01-08 9:43 ` [PATCH v4 3/3] tools headers: Don't check arm64's unistd.h Leo Yan
2026-01-20 10:30 ` [PATCH v4 0/3] tools build: Fix arm64 unistd.h dependency James Clark
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®