diff mbox series

[2/2,RFC] perf: make bpf asm include arch conditional

Message ID 20240404204702.3380236-2-bruce.ashfield@gmail.com
State Accepted, archived
Commit 879b4a7d378b4d4d11fdda7921b8c47e4523a948
Headers show
Series [1/2] perf: add asm include required for v6.9+ | expand

Commit Message

Bruce Ashfield April 4, 2024, 8:47 p.m. UTC
From: Bruce Ashfield <bruce.ashfield@gmail.com>

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.

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---

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(-)

Comments

Max Krummenacher April 5, 2024, 12:37 p.m. UTC | #1
Hi Bruce

Thanks for working on this.

On Thu, Apr 4, 2024 at 10:47 PM Bruce Ashfield <bruce.ashfield@gmail.com> wrote:
>
> From: Bruce Ashfield <bruce.ashfield@gmail.com>
>
> 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.

>
> 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.
>
> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
> ---
>
> 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(-)
>
> diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
> index 2f540cd54b..3cc7f63610 100644
> --- a/meta/recipes-kernel/perf/perf.bb
> +++ b/meta/recipes-kernel/perf/perf.bb
> @@ -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

>  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: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [max.oss.09@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Bruce Ashfield April 5, 2024, 1:02 p.m. UTC | #2
On Fri, Apr 5, 2024 at 8:38 AM Max Krummenacher <max.oss.09@gmail.com>
wrote:

> Hi Bruce
>
> Thanks for working on this.
>
> On Thu, Apr 4, 2024 at 10:47 PM Bruce Ashfield <bruce.ashfield@gmail.com>
> wrote:
> >
> > From: Bruce Ashfield <bruce.ashfield@gmail.com>
> >
> > 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.
>
> >
> > 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.
> >
> > Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
> > ---
> >
> > 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(-)
> >
> > diff --git a/meta/recipes-kernel/perf/perf.bb
> b/meta/recipes-kernel/perf/perf.bb
> > index 2f540cd54b..3cc7f63610 100644
> > --- a/meta/recipes-kernel/perf/perf.bb
> > +++ b/meta/recipes-kernel/perf/perf.bb
> > @@ -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
>

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


> 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



> Cheers
> Max
>
> >  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: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> max.oss.09@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
diff mbox series

Patch

diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
index 2f540cd54b..3cc7f63610 100644
--- a/meta/recipes-kernel/perf/perf.bb
+++ b/meta/recipes-kernel/perf/perf.bb
@@ -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 \
 "