Skip to contentSkip to conversation

perf MANIFEST: Add arch/*/include/uapi/asm/bpf_perf_event.h to the perf tarball

PATCH In review Arnaldo Carvalho de Melo 2 participants 4 messages Nov 26, 2024 – Jan 10, 2025 perf events

lore
Share & tools
lore

Arnaldo Carvalho de Melo

author maintainer
#0 lore raw

PATCH 1/1 perf MANIFEST: Add arch/*/include/uapi/asm/bpf_perf_event.h to the perf tarball

Needed to build tools/lib/bpf/ on various arches other than x86_64, notably arm64 when using the perf tarballs generated by:

  $ make help | grep perf-
    perf-tar-src-pkg    - Build the perf source tarball with no compression
    perf-targz-src-pkg  - Build the perf source tarball with gzip compression
    perf-tarbz2-src-pkg - Build the perf source tarball with bz2 compression
    perf-tarxz-src-pkg  - Build the perf source tarball with xz compression
    perf-tarzst-src-pkg - Build the perf source tarball with zst compression
  $

Building with BPF support was opt-in in perf for a long time, and testing it via the tarball main kernel Makefile targets in an architecture other than x86_64 was an odd case.

I had noticed this at some point earlier this year while cross building perf to some arches, including arm64, but it fell thru the cracks, see the Link tag below.

Fix it now by adding those arch/*/include/uapi/asm/bpf_perf_event.h files to the MANIFEST file used in building the perf source tarball.

Tested with:

  perfbuilder@number:~$ time dm debian:experimental-x-arm64
     1    21.60 debian:experimental-x-arm64   : Ok   aarch64-linux-gnu-gcc (Debian 14.1.0-5) 14.1.0  flex 2.6.4
  BUILD_TARBALL_HEAD=d31a974f6edc576f84c35be9526fec549a3b3520
  $
  $ git log --oneline -1 d31a974f6edc576f84c35be9526fec549a3b3520
  d31a974f6edc576f (HEAD -> perf-tools-next) perf MANIFEST: Add arch/*/include/uapi/asm/bpf_perf_event.h to the perf tarball
  $

That was previously failing:

  perfbuilder@number:~$ grep debian:experimental-x-arm64 dm.log.old/summary
  19     4.80 debian:experimental-x-arm64   : FAIL gcc version 14.1.0 (Debian 14.1.0-5)
  $
  perfbuilder@number:~$ grep -B6 'Error 1' dm.log.old/debian:experimental-x-arm64
  In file included from /git/perf-6.12.0-rc6/tools/include/uapi/linux/bpf_perf_event.h:11,
                   from libbpf.c:36:
  /git/perf-6.12.0-rc6/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"
        |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  compilation terminated.
  make[4]: *** [/git/perf-6.12.0-rc6/tools/build/Makefile.build:105: /tmp/build/perf/libbpf/staticobjs/libbpf.o] Error 1
  perfbuilder@number:~$
Fixes 9eea8fafe33eb708 ("libbpf: fix __arg_ctx type enforcement for perf_event programs")
Cc Alexei Starovoitov <[email protected]>
Cc Andrii Nakryiko <[email protected]>
---
 tools/perf/MANIFEST | 1 +
 1 file changed, 1 insertion(+)
tools/perf/MANIFEST +1 -0
index dc42de1785cee715..908165fcec7de3c4 100644
@@ -1,5 +1,6 @@
 arch/arm64/tools/gen-sysreg.awk
 arch/arm64/tools/sysreg
+arch/*/include/uapi/asm/bpf_perf_event.h
 tools/perf
 tools/arch
 tools/scripts
Signature · 1 line
2.47.0
#1 lore raw
Quoted 15 lines · Arnaldo Carvalho de Melo

Needed to build tools/lib/bpf/ on various arches other than x86_64, notably arm64 when using the perf tarballs generated by:

  $ make help | grep perf-
    perf-tar-src-pkg    - Build the perf source tarball with no compression
    perf-targz-src-pkg  - Build the perf source tarball with gzip compression
    perf-tarbz2-src-pkg - Build the perf source tarball with bz2 compression
    perf-tarxz-src-pkg  - Build the perf source tarball with xz compression
    perf-tarzst-src-pkg - Build the perf source tarball with zst compression
  $

Building with BPF support was opt-in in perf for a long time, and testing it via the tarball main kernel Makefile targets in an architecture other than x86_64 was an odd case.

Quoted 7 lines

I had noticed this at some point earlier this year while cross building perf to some arches, including arm64, but it fell thru the cracks, see the Link tag below.

Fix it now by adding those arch/*/include/uapi/asm/bpf_perf_event.h files to the MANIFEST file used in building the perf source tarball.

FWIW - when testing against the architectures Fedora carry (x86_64, aarch64/arm64, ppc64le, s390x) only the arm64 and s390 headers are needed; see

https://git.centos.org/rpms/perf/blob/c9s-sig-hyperscale/f/perf.spec#_120-128

(I would link to my Koji scratch build but Koji has some sort of glitch right now)

It's probably safer to just include all headers just in case.

Thanks for this patch, it is really instructive in figuring out how perf is put together!

Best regards,

Signature · 2 lines
 _o) Michel Lind
_( ) identities: https://keyoxide.org/5dce2e7e9c3b1cffd335c1d78b229d2f7ccc04f2
#2 lore raw
In reply to Arnaldo Carvalho de Melo

Hi Arnaldo,

Quoted 4 lines · Arnaldo Carvalho de Melo

Needed to build tools/lib/bpf/ on various arches other than x86_64, notably arm64 when using the perf tarballs generated by:

  $ make help | grep perf-

I can confirm this works - I've applied this on top of the stable tree's 6.12.9 tag, and generated a tarball that works for building perf in Hyperscale, e.g.

https://cbs.centos.org/koji/buildinfo?buildID=57925

Can this be merged too? Thanks

(Also - presumably merged changes eventually shows up in the perf- tools-next branch)

Best regards,

Signature · 3 lines
 _o) Michel Lind
_( ) identities:
https://keyoxide.org/5dce2e7e9c3b1cffd335c1d78b229d2f7ccc04f2
author maintainer Tested-by Michel Lind Applied
#3 lore raw
Quoted 9 lines · Michel Lind

Hi Arnaldo,

Quoted 4 lines · Arnaldo Carvalho de Melo

Needed to build tools/lib/bpf/ on various arches other than x86_64, notably arm64 when using the perf tarballs generated by:

  $ make help | grep perf-

I can confirm this works - I've applied this on top of the stable

Ok, so I'm taking this as a:

Applied.

- Arnaldo

Quoted 17 lines

tree's 6.12.9 tag, and generated a tarball that works for building perf in Hyperscale, e.g.

https://cbs.centos.org/koji/buildinfo?buildID=57925

Can this be merged too? Thanks

(Also - presumably merged changes eventually shows up in the perf- tools-next branch)

Best regards,

Signature · 3 lines
 _o) Michel Lind
_( ) identities:
https://keyoxide.org/5dce2e7e9c3b1cffd335c1d78b229d2f7ccc04f2