Skip to contentSkip to conversation

perf: add asm include required for v6.9+

PATCH In review [email protected] 2 participants 4 messages Apr 4, 2024 – Apr 5, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 perf: add asm include required for v6.9+

From: Max Krummenacher <[email protected]>

Kernel commit 9eea8fafe33e ("libbpf: fix __arg_ctx type enforcement for perf_event programs") added with 6.9-rc1 tools/include/uapi/asm/bpf_perf_event.h which for arc, arm64, loongarch, riscv and s390 includes headers from the arch/${ARCH}/... directories.

Which results in:

ERROR: perf-1.0-r0 do_compile: oe_runmake failed

  | In file included from 1.0/perf-1.0/tools/include/uapi/linux/bpf_perf_event.h:11,
  |                  from libbpf.c:36:
  | perf/1.0/perf-1.0/tools/include/uapi/asm/bpf_perf_event.h:2:10: fatal error: ../../arch/arm64/include/uapi/asm/bpf_perf_event.h: No such file or directory
  |     2 | #include "../../arch/arm64/include/uapi/asm/bpf_perf_event.h"
  |       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We copy the uapi/asm directory to make sure the header file is present.

---

This is a tweak of the commit from max to only include the uapi/asm directory.

A second patch will further refine it.

Bruce

 meta/recipes-kernel/perf/perf.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-kernel/perf/perf.bb +2 -0
index 2c6ab060e3..2f540cd54b 100644
@@ -129,6 +129,7 @@ EXTRA_OEMAKE += "\
 # honour a JOBS variable.
 EXTRA_OEMAKE:append:task-configure = " JOBS=1"
 
+# include/uapi/asm is for: include/uapi/asm/bpf_perf_event.h
 PERF_SRC ?= "Makefile \
              tools/arch \
              tools/build \
@@ -139,6 +140,7 @@ PERF_SRC ?= "Makefile \
              tools/scripts \
              scripts/ \
              arch/arm64/tools \
+             arch/${ARCH}/include/uapi/asm/ \
              arch/${ARCH}/Makefile \
 "
 
Signature · 1 line
2.39.2
#1 lore raw

RFC PATCH 2/2 perf: make bpf asm include arch conditional

From: Bruce Ashfield <[email protected]>

To keep the perf source copying as small as possible, we can further refine the arch/uapi copy to the single file that we currently need.

To avoid a warning from the general perf source copy routine, we make the .h conditional based on the architecture.

The supported architectures will not change often, so updating this arch list is very minimal effort. Alternatively, we could add a PERF_OPTIONAL_SRC variable and not warn if a file isn't available for a given architecture.

---

This is a further refinement of the perf header that is required outside of tools.

I'm trying it this way first, versus making the perf source copy not warn on missing files, since we risk skipping warnings we want to see!

Bruce

 meta/recipes-kernel/perf/perf.bb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
meta/recipes-kernel/perf/perf.bb +4 -2
index 2f540cd54b..3cc7f63610 100644
@@ -129,7 +129,9 @@ EXTRA_OEMAKE += "\
 # honour a JOBS variable.
 EXTRA_OEMAKE:append:task-configure = " JOBS=1"
 
-# include/uapi/asm is for: include/uapi/asm/bpf_perf_event.h
+# the architectures that need this file can be found in
+# ./tools/include/uapi/asm/bpf_perf_event.h
+PERF_BPF_EVENT_SRC ?= '${@bb.utils.contains_any("ARCH", [ "riscv", "arm64", "powerpc" ], "arch/${ARCH}/include/uapi/asm/bpf_perf_event.h", "", d)}'
 PERF_SRC ?= "Makefile \
              tools/arch \
              tools/build \
@@ -140,7 +142,7 @@ PERF_SRC ?= "Makefile \
              tools/scripts \
              scripts/ \
              arch/arm64/tools \
-             arch/${ARCH}/include/uapi/asm/ \
+             ${PERF_BPF_EVENT_SRC} \
              arch/${ARCH}/Makefile \
 "
 
Signature · 1 line
2.39.2
#2 lore raw

Re: [OE-core] [PATCH 2/2][RFC] perf: make bpf asm include arch conditional

Hi Bruce

Thanks for working on this.

Quoted 6 lines · Bruce Ashfield

From: Bruce Ashfield <[email protected]>

To keep the perf source copying as small as possible, we can further refine the arch/uapi copy to the single file that we currently need.

With that design goal in mind I would go with this solution, Tested for an aarch64 target, 6.9-rc2 builds perf for me while before this series it failed.

Quoted 29 lines

To avoid a warning from the general perf source copy routine, we make the .h conditional based on the architecture.

The supported architectures will not change often, so updating this arch list is very minimal effort. Alternatively, we could add a PERF_OPTIONAL_SRC variable and not warn if a file isn't available for a given architecture.

---

This is a further refinement of the perf header that is required outside of tools.

I'm trying it this way first, versus making the perf source copy not warn on missing files, since we risk skipping warnings we want to see!

Bruce

 meta/recipes-kernel/perf/perf.bb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
meta/recipes-kernel/perf/perf.bb +0 -0
index 2f540cd54b..3cc7f63610 100644

meta/recipes-kernel/perf/perf.bb EXTRA_OEMAKE += "\ · line 134

Quoted 7 lines
meta/recipes-kernel/perf/perf.bb +3 -1
@@ -129,7 +129,9 @@ EXTRA_OEMAKE += "\
 # honour a JOBS variable.
 EXTRA_OEMAKE:append:task-configure = " JOBS=1"
 
-# include/uapi/asm is for: include/uapi/asm/bpf_perf_event.h
+# the architectures that need this file can be found in
+# ./tools/include/uapi/asm/bpf_perf_event.h
+PERF_BPF_EVENT_SRC ?= '${@bb.utils.contains_any("ARCH", [ "riscv", "arm64", "powerpc" ], "arch/${ARCH}/include/uapi/asm/bpf_perf_event.h", "", d)}'

s/powerpc/loongarch/
If I get it right from tools/include/uapi/asm/bpf_perf_event.h powerpc is not needed. (I didn't test)
However "loongarch" does and seems to be supported in OE.

Cheers
Max

Quoted 24 lines
meta/recipes-kernel/perf/perf.bb +1 -2
 PERF_SRC ?= "Makefile \
              tools/arch \
              tools/build \
@@ -140,7 +142,7 @@ PERF_SRC ?= "Makefile \
              tools/scripts \
              scripts/ \
              arch/arm64/tools \
-             arch/${ARCH}/include/uapi/asm/ \
+             ${PERF_BPF_EVENT_SRC} \
              arch/${ARCH}/Makefile \
 "
 
--

2.39.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#197973): https://lists.openembedded.org/g/openembedded-core/message/197973
Mute This Topic: https://lists.openembedded.org/mt/105337225/3617484
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw

Re: [OE-core] [PATCH 2/2][RFC] perf: make bpf asm include arch conditional

Quoted 57 lines · Max Krummenacher

Hi Bruce

Thanks for working on this.

Quoted 6 lines · Bruce Ashfield

From: Bruce Ashfield <[email protected]>

To keep the perf source copying as small as possible, we can further refine the arch/uapi copy to the single file that we currently need.

With that design goal in mind I would go with this solution, Tested for an aarch64 target, 6.9-rc2 builds perf for me while before this series it failed.

Quoted 19 lines

To avoid a warning from the general perf source copy routine, we make the .h conditional based on the architecture.

The supported architectures will not change often, so updating this arch list is very minimal effort. Alternatively, we could add a PERF_OPTIONAL_SRC variable and not warn if a file isn't available for a given architecture.

---

This is a further refinement of the perf header that is required outside of tools.

I'm trying it this way first, versus making the perf source copy not warn on missing files, since we risk skipping warnings we want to see!

Review

Quoted 6 lines

Bruce

 meta/recipes-kernel/perf/perf.bb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/meta/recipes-kernel/perf/perf.bb

meta/recipes-kernel/perf/perf.bb EXTRA_OEMAKE += "\ · line 134

Quoted 11 lines

index 2f540cd54b..3cc7f63610 100644

meta/recipes-kernel/perf/perf.bb +3 -1
@@ -129,7 +129,9 @@ EXTRA_OEMAKE += "\
 # honour a JOBS variable.
 EXTRA_OEMAKE:append:task-configure = " JOBS=1"
 
-# include/uapi/asm is for: include/uapi/asm/bpf_perf_event.h
+# the architectures that need this file can be found in
+# ./tools/include/uapi/asm/bpf_perf_event.h
+PERF_BPF_EVENT_SRC ?= '${@bb.utils.contains_any("ARCH", [ "riscv",

"arm64", "powerpc" ], "arch/${ARCH}/include/uapi/asm/bpf_perf_event.h", "", d)}'

Quoted 3 lines

s/powerpc/loongarch/
If I get it right from tools/include/uapi/asm/bpf_perf_event.h powerpc

You are correct! I swear I read powerpc in the file, but looking again this morning .. it isn't there!

Quoted 4 lines

is not needed. (I didn't test)
However "loongarch" does and seems to be supported in OE.

Correct! I skipped arc and s390 for the same reason. If someone is using those arches, we can find out when they send a patch.

I'm going to send a v2 with powerpc dropped from the list.

Thanks for the test and review, it is most appreciated.

Bruce

Quoted 30 lines

Cheers
Max

Quoted 16 lines
meta/recipes-kernel/perf/perf.bb +1 -2
 PERF_SRC ?= "Makefile \
              tools/arch \
              tools/build \
@@ -140,7 +142,7 @@ PERF_SRC ?= "Makefile \
              tools/scripts \
              scripts/ \
              arch/arm64/tools \
-             arch/${ARCH}/include/uapi/asm/ \
+             ${PERF_BPF_EVENT_SRC} \
              arch/${ARCH}/Makefile \
 "
 
--

2.39.2

Quoted 3 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#197973):

https://lists.openembedded.org/g/openembedded-core/message/197973

Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/105337225/3617484
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II