Skip to contentSkip to conversation

linux-next: build failure after merge of the perf tree

DISCUSSION Stephen Rothwell 4 participants 14 messages Mar 16, 2023 – Apr 3, 2023 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the perf tree, today's linux-next build (native perf) failed like this:

Auto-detecting system features:
... clang-bpf-co-re: [ on ]
... llvm: [ OFF ]

...                                  libcap: [ on  ]
...                                  libbfd: [ on  ]

make[1]: *** Deleting file '/home/sfr/next/perf/util/bpf_skel/vmlinux.h'
libbpf: failed to find '.BTF' ELF section in /boot/vmlinux-6.0.0-5-powerpc64le
Error: failed to load BTF from /boot/vmlinux-6.0.0-5-powerpc64le: No data available make[1]: *** [Makefile.perf:1075: /home/sfr/next/perf/util/bpf_skel/vmlinux.h] Error 195 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile.perf:236: sub-make] Error 2
Command exited with non-zero status 2

To be clear this is a native build of perf on a PPC64le host using this command line:

make -C tools/perf -f Makefile.perf -s -O -j60 O=../perf EXTRA_CFLAGS=-Wno-psabi

(I could probably remove the EXTRA_CLFAGS now that I am building with gcc 12.2)

I don't know which commit caused this.

I have used the perf tree from next-20230316 for today.

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw
Quoted 22 lines · Stephen Rothwell

Hi all,

After merging the perf tree, today's linux-next build (native perf) failed like this:

Auto-detecting system features:
... clang-bpf-co-re: [ on ]
... llvm: [ OFF ]

...                                  libcap: [ on  ]
...                                  libbfd: [ on  ]

make[1]: *** Deleting file '/home/sfr/next/perf/util/bpf_skel/vmlinux.h'
libbpf: failed to find '.BTF' ELF section in /boot/vmlinux-6.0.0-5-powerpc64le
Error: failed to load BTF from /boot/vmlinux-6.0.0-5-powerpc64le: No data available make[1]: *** [Makefile.perf:1075: /home/sfr/next/perf/util/bpf_skel/vmlinux.h] Error 195 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile.perf:236: sub-make] Error 2
Command exited with non-zero status 2

To be clear this is a native build of perf on a PPC64le host using this command line:

Quoted 6 lines

make -C tools/perf -f Makefile.perf -s -O -j60 O=../perf EXTRA_CFLAGS=-Wno-psabi

(I could probably remove the EXTRA_CLFAGS now that I am building with gcc 12.2)

I don't know which commit caused this.

Can you try adding NO_BPF_SKEL=1 to the make -C tools/perf command line?

- Arnaldo

Quoted 5 lines

I have used the perf tree from next-20230316 for today.

#2 lore raw

Hi Arnaldo,

Quoted 2 lines · On Thu, 16 Mar 2023 20:11:11 -0300 Arnaldo Carvalho de Melo…

Can you try adding NO_BPF_SKEL=1 to the make -C tools/perf command line?

That made it build. Can that be automated, or is there something else I need to install to make it work? Or, at least can the error be made more informative?

Signature · 2 lines
Cheers,
Stephen Rothwell
#3 lore raw
Quoted 10 lines · Stephen Rothwell

Hi Arnaldo,

Quoted 2 lines · On Thu, 16 Mar 2023 20:11:11 -0300 Arnaldo Carvalho de Melo…

Can you try adding NO_BPF_SKEL=1 to the make -C tools/perf command line?

That made it build. Can that be automated, or is there something else I need to install to make it work? Or, at least can the error be made more informative?

Good idea. I'll look into a feature test to cover this. For context the change that altered the behavior was:
https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf-tools-next&id=a980755beb5aca9002e1c95ba519b83a44242b5b

Thanks,
Ian

Quoted 3 lines

--
Cheers,
Stephen Rothwell

#4 lore raw
In reply to Stephen Rothwell

Hi all,

Quoted 21 lines · On Fri, 17 Mar 2023 09:50:25 +1100 Stephen Rothwell <[email protected]>…

After merging the perf tree, today's linux-next build (native perf) failed like this:

Auto-detecting system features:
... clang-bpf-co-re: [ on ]
... llvm: [ OFF ]

...                                  libcap: [ on  ]
...                                  libbfd: [ on  ]

make[1]: *** Deleting file '/home/sfr/next/perf/util/bpf_skel/vmlinux.h'
libbpf: failed to find '.BTF' ELF section in /boot/vmlinux-6.0.0-5-powerpc64le
Error: failed to load BTF from /boot/vmlinux-6.0.0-5-powerpc64le: No data available make[1]: *** [Makefile.perf:1075: /home/sfr/next/perf/util/bpf_skel/vmlinux.h] Error 195 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile.perf:236: sub-make] Error 2
Command exited with non-zero status 2

To be clear this is a native build of perf on a PPC64le host using this command line:

Quoted 8 lines

make -C tools/perf -f Makefile.perf -s -O -j60 O=../perf EXTRA_CFLAGS=-Wno-psabi

(I could probably remove the EXTRA_CLFAGS now that I am building with gcc 12.2)

I don't know which commit caused this.

I have used the perf tree from next-20230316 for today.

I am still getting this build failure.

Signature · 2 lines
Cheers,
Stephen Rothwell
#5 lore raw
Quoted 27 lines · Stephen Rothwell

Hi all,

Quoted 23 lines · On Fri, 17 Mar 2023 09:50:25 +1100 Stephen Rothwell <[email protected]>…

After merging the perf tree, today's linux-next build (native perf) failed like this:

Auto-detecting system features:

...                         clang-bpf-co-re: [  [32mon [m  ]
...                                    llvm: [  [31mOFF [m ]
...                                  libcap: [  [32mon [m  ]
...                                  libbfd: [  [32mon [m  ]

make[1]: *** Deleting file '/home/sfr/next/perf/util/bpf_skel/vmlinux.h'
libbpf: failed to find '.BTF' ELF section in /boot/vmlinux-6.0.0-5-powerpc64le
Error: failed to load BTF from /boot/vmlinux-6.0.0-5-powerpc64le: No data available make[1]: *** [Makefile.perf:1075: /home/sfr/next/perf/util/bpf_skel/vmlinux.h] Error 195 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile.perf:236: sub-make] Error 2
Command exited with non-zero status 2

To be clear this is a native build of perf on a PPC64le host using this command line:

make -C tools/perf -f Makefile.perf -s -O -j60 O=../perf EXTRA_CFLAGS=-Wno-psabi

Quoted 8 lines
Quoted 6 lines

(I could probably remove the EXTRA_CLFAGS now that I am building with gcc 12.2)

I don't know which commit caused this.

I have used the perf tree from next-20230316 for today.

I am still getting this build failure.

Hi Stephen,

The build failure is intentional as not having BPF skeleton support in the perf tool will remove features. I've just sent:
https://lore.kernel.org/lkml/[email protected]/
Which will recommend adding NO_BPF_SKEL=1 to your build options when this failure occurs. I didn't think a features test was appropriate for this as the feature test would basically replicate the vmlinux.h generation and I didn't want to move that support through the build system.

Thanks,
Ian

Quoted 3 lines

--
Cheers,
Stephen Rothwell

#6 lore raw

Hi Ian,

Quoted 38 lines · On Wed, 22 Mar 2023 11:37:31 -0700 Ian Rogers <[email protected]> wrote:
Quoted 27 lines · Stephen Rothwell

Hi all,

Quoted 23 lines · On Fri, 17 Mar 2023 09:50:25 +1100 Stephen Rothwell <[email protected]>…

After merging the perf tree, today's linux-next build (native perf) failed like this:

Auto-detecting system features:

...                         clang-bpf-co-re: [  [32mon [m  ]
...                                    llvm: [  [31mOFF [m ]
...                                  libcap: [  [32mon [m  ]
...                                  libbfd: [  [32mon [m  ]

make[1]: *** Deleting file '/home/sfr/next/perf/util/bpf_skel/vmlinux.h'
libbpf: failed to find '.BTF' ELF section in /boot/vmlinux-6.0.0-5-powerpc64le
Error: failed to load BTF from /boot/vmlinux-6.0.0-5-powerpc64le: No data available make[1]: *** [Makefile.perf:1075: /home/sfr/next/perf/util/bpf_skel/vmlinux.h] Error 195 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile.perf:236: sub-make] Error 2
Command exited with non-zero status 2

To be clear this is a native build of perf on a PPC64le host using this command line:

make -C tools/perf -f Makefile.perf -s -O -j60 O=../perf EXTRA_CFLAGS=-Wno-psabi

Quoted 8 lines
Quoted 6 lines

(I could probably remove the EXTRA_CLFAGS now that I am building with gcc 12.2)

I don't know which commit caused this.

I have used the perf tree from next-20230316 for today.

I am still getting this build failure.

Quoted 8 lines

The build failure is intentional as not having BPF skeleton support in the perf tool will remove features. I've just sent:
https://lore.kernel.org/lkml/[email protected]/
Which will recommend adding NO_BPF_SKEL=1 to your build options when this failure occurs. I didn't think a features test was appropriate for this as the feature test would basically replicate the vmlinux.h generation and I didn't want to move that support through the build system.

I was trying to understand why this step fails, but from the error messages, it seems to require something to be present in the distro supplied kernel image? Is there something missing from the ppc build process? Or toolchain? Why is it looking at the installed kernel and not the built kernel? Does the perf build now depend on the kernel being built first?

I will add NO_BPF_SKEL=1 to my build from tomorrow, but surely that means that we miss some perf build testing :-(

Signature · 2 lines
Cheers,
Stephen Rothwell
#7 lore raw

Em Thu, Mar 23, 2023 at 09:54:37AM +1100, Stephen Rothwell escreveu:

Quoted 57 lines

Hi Ian,

Quoted 38 lines · On Wed, 22 Mar 2023 11:37:31 -0700 Ian Rogers <[email protected]> wrote:
Quoted 27 lines · Stephen Rothwell

Hi all,

Quoted 23 lines · On Fri, 17 Mar 2023 09:50:25 +1100 Stephen Rothwell <[email protected]>…

After merging the perf tree, today's linux-next build (native perf) failed like this:

Auto-detecting system features:

...                         clang-bpf-co-re: [  [32mon [m  ]
...                                    llvm: [  [31mOFF [m ]
...                                  libcap: [  [32mon [m  ]
...                                  libbfd: [  [32mon [m  ]

make[1]: *** Deleting file '/home/sfr/next/perf/util/bpf_skel/vmlinux.h'
libbpf: failed to find '.BTF' ELF section in /boot/vmlinux-6.0.0-5-powerpc64le
Error: failed to load BTF from /boot/vmlinux-6.0.0-5-powerpc64le: No data available make[1]: *** [Makefile.perf:1075: /home/sfr/next/perf/util/bpf_skel/vmlinux.h] Error 195 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile.perf:236: sub-make] Error 2
Command exited with non-zero status 2

To be clear this is a native build of perf on a PPC64le host using this command line:

make -C tools/perf -f Makefile.perf -s -O -j60 O=../perf EXTRA_CFLAGS=-Wno-psabi

Quoted 8 lines
Quoted 6 lines

(I could probably remove the EXTRA_CLFAGS now that I am building with gcc 12.2)

I don't know which commit caused this.

I have used the perf tree from next-20230316 for today.

I am still getting this build failure.

Quoted 8 lines

The build failure is intentional as not having BPF skeleton support in the perf tool will remove features. I've just sent:
https://lore.kernel.org/lkml/[email protected]/
Which will recommend adding NO_BPF_SKEL=1 to your build options when this failure occurs. I didn't think a features test was appropriate for this as the feature test would basically replicate the vmlinux.h generation and I didn't want to move that support through the build system.

I was trying to understand why this step fails, but from the error messages, it seems to require something to be present in the distro supplied kernel image? Is there something missing from the ppc build process? Or toolchain? Why is it looking at the installed kernel and not the built kernel? Does the perf build now depend on the kernel being built first?

Quoted 2 lines

I will add NO_BPF_SKEL=1 to my build from tomorrow, but surely that means that we miss some perf build testing :-(

Before this BUILD_BPF_SKEL wasn't on by default, so you're back testing as much as before.

Having said that, we need to improve the warning and I processed a patch from Ian to that extent:

https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=tmp.perf-tools-next&id=12a83df53444165d39d3e09fcd9627e7bec7828e

$(SKEL_OUT)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL)
ifeq ($(VMLINUX_H),)
- $(QUIET_GEN)$(BPFTOOL) btf dump file $< format c > $@
+ $(QUIET_GEN)$(BPFTOOL) btf dump file $< format c > $@ || \
+ (echo "Failure to generate vmlinux.h needed for the recommended BPF skeleton support." && \
+ echo "To disable this use the build option NO_BPF_SKEL=1." && \
+ echo "Alternatively point at a pre-generated vmlinux.h with VMLINUX_H=<path>." && \
+ false)
else
$(Q)cp "$(VMLINUX_H)" $@
endif

Which improves a bit the situation.

We could check if bpftool is available and if not, suggest installing it.

If it is available, we could check if /sys/kernel/bpf/ is available, if not suggest using a kernel with CONFIG_DEBUG_INFO_BTF=y, as most distros have by now.

As to the features this enables:

⬢[acme@toolbox perf-tools-next]$ ls -la tools/perf/util/bpf_skel/*.c -rw-r--r--. 1 acme acme 5581 Oct 17 09:07 tools/perf/util/bpf_skel/bperf_cgroup.bpf.c

-rw-r--r--. 1 acme acme 1764 May  5  2022 tools/perf/util/bpf_skel/bperf_follower.bpf.c
-rw-r--r--. 1 acme acme 1438 May  5  2022 tools/perf/util/bpf_skel/bperf_leader.bpf.c
-rw-r--r--. 1 acme acme 2290 May  5  2022 tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
-rw-r--r--. 1 acme acme 2164 May  5  2022 tools/perf/util/bpf_skel/func_latency.bpf.c
-rw-r--r--. 1 acme acme 9017 Aug 26  2022 tools/perf/util/bpf_skel/kwork_trace.bpf.c

-rw-r--r--. 1 acme acme 9251 Mar 14 08:33 tools/perf/util/bpf_skel/lock_contention.bpf.c -rw-r--r--. 1 acme acme 6109 Feb 27 17:47 tools/perf/util/bpf_skel/off_cpu.bpf.c -rw-r--r--. 1 acme acme 4310 Mar 15 11:08 tools/perf/util/bpf_skel/sample_filter.bpf.c ⬢[acme@toolbox perf-tools-next]$

For instance, take a look at these csets:

⬢[acme@toolbox perf-tools-next]$ git log --oneline tools/perf/util/bpf_skel/lock_contention.bpf.c d24c0144b1dde00f perf lock contention: Show per-cpu rq_lock with address 1811e82767dcc6eb perf lock contention: Track and show siglock with address 3ace2435bb93445e perf lock contention: Track and show mmap_lock with address 17535a33a9c1e4fb perf lock contention: Fix compiler builtin detection 1bece1351c653c3d perf lock contention: Support old rw_semaphore type 3477f079fe70b3c9 perf lock contention: Add -o/--lock-owner option ebab291641bed48f perf lock contention: Support filters for different aggregation 5e3febe7b7b99f94 perf lock contention: Support lock addr/name filtering for BPF 529772c4df286159 perf lock contention: Support lock type filtering for BPF 688d2e8de231c54e perf lock contention: Add -l/--lock-addr option
eca949b2b4addd94 perf lock contention: Implement -t/--threads option for BPF fd507d3e359c7e06 perf lock contention: Add lock_data.h for common data c66a36af7ba3a628 perf lock contention: Do not use BPF task local storage 433b31fa00797a2a perf lock contention: Fix a build error on 32-bit c1da8dd5c11dabd5 perf lock contention: Skip stack trace from BPF
6d499a6b3d90277d perf lock: Print the number of lost entries for BPF 6fda2405f414b24a perf lock: Implement cpu and task filters for BPF 407b36f69efbdccf perf lock: Use BPF for lock contention analysis
⬢[acme@toolbox perf-tools-next]$

or:

⬢[acme@toolbox perf-tools-next]$ git log --oneline tools/perf/util/bpf_skel/kwork_trace.bpf.c acfb65fe1d11a97f perf kwork: Add workqueue trace BPF support
5a81927a407c050a perf kwork: Add softirq trace BPF support
420298aefe94840f perf kwork: Add IRQ trace BPF support
daf07d220710a3c8 perf kwork: Implement BPF trace
⬢[acme@toolbox perf-tools-next]$

So we need to fine tune this detection of needed components to build these features, in time for the v6.4 merge window, that is why we decided to make this opt-out to hammer out problems.

Other arches probably will hit some of these problems, lets try to encourage others to try what is in linux-next.

- Arnaldo

#8 lore raw
Quoted 138 lines · Arnaldo Carvalho de Melo

Em Thu, Mar 23, 2023 at 09:54:37AM +1100, Stephen Rothwell escreveu:

Quoted 57 lines

Hi Ian,

Quoted 38 lines · On Wed, 22 Mar 2023 11:37:31 -0700 Ian Rogers <[email protected]> wrote:
Quoted 27 lines · Stephen Rothwell

Hi all,

Quoted 23 lines · On Fri, 17 Mar 2023 09:50:25 +1100 Stephen Rothwell <[email protected]>…

After merging the perf tree, today's linux-next build (native perf) failed like this:

Auto-detecting system features:

...                         clang-bpf-co-re: [  [32mon [m  ]
...                                    llvm: [  [31mOFF [m ]
...                                  libcap: [  [32mon [m  ]
...                                  libbfd: [  [32mon [m  ]

make[1]: *** Deleting file '/home/sfr/next/perf/util/bpf_skel/vmlinux.h'
libbpf: failed to find '.BTF' ELF section in /boot/vmlinux-6.0.0-5-powerpc64le
Error: failed to load BTF from /boot/vmlinux-6.0.0-5-powerpc64le: No data available make[1]: *** [Makefile.perf:1075: /home/sfr/next/perf/util/bpf_skel/vmlinux.h] Error 195 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile.perf:236: sub-make] Error 2
Command exited with non-zero status 2

To be clear this is a native build of perf on a PPC64le host using this command line:

make -C tools/perf -f Makefile.perf -s -O -j60 O=../perf EXTRA_CFLAGS=-Wno-psabi

Quoted 8 lines
Quoted 6 lines

(I could probably remove the EXTRA_CLFAGS now that I am building with gcc 12.2)

I don't know which commit caused this.

I have used the perf tree from next-20230316 for today.

I am still getting this build failure.

Quoted 8 lines

The build failure is intentional as not having BPF skeleton support in the perf tool will remove features. I've just sent:
https://lore.kernel.org/lkml/[email protected]/
Which will recommend adding NO_BPF_SKEL=1 to your build options when this failure occurs. I didn't think a features test was appropriate for this as the feature test would basically replicate the vmlinux.h generation and I didn't want to move that support through the build system.

I was trying to understand why this step fails, but from the error messages, it seems to require something to be present in the distro supplied kernel image? Is there something missing from the ppc build process? Or toolchain? Why is it looking at the installed kernel and not the built kernel? Does the perf build now depend on the kernel being built first?

Quoted 2 lines

I will add NO_BPF_SKEL=1 to my build from tomorrow, but surely that means that we miss some perf build testing :-(

Before this BUILD_BPF_SKEL wasn't on by default, so you're back testing as much as before.

Having said that, we need to improve the warning and I processed a patch from Ian to that extent:

https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=tmp.perf-tools-next&id=12a83df53444165d39d3e09fcd9627e7bec7828e

$(SKEL_OUT)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL)
ifeq ($(VMLINUX_H),)

(quoted diff) +5 -1
-       $(QUIET_GEN)$(BPFTOOL) btf dump file $< format c > $@
+       $(QUIET_GEN)$(BPFTOOL) btf dump file $< format c > $@ || \
+       (echo "Failure to generate vmlinux.h needed for the recommended BPF skeleton support." && \
+       echo "To disable this use the build option NO_BPF_SKEL=1." && \
+       echo "Alternatively point at a pre-generated vmlinux.h with VMLINUX_H=<path>." && \
+       false)
 else
        $(Q)cp "$(VMLINUX_H)" $@
 endif
 
 Which improves a bit the situation.

We could check if bpftool is available and if not, suggest installing it.

If it is available, we could check if /sys/kernel/bpf/ is available, if not suggest using a kernel with CONFIG_DEBUG_INFO_BTF=y, as most distros have by now.

As to the features this enables:

⬢[acme@toolbox perf-tools-next]$ ls -la tools/perf/util/bpf_skel/*.c

(quoted diff) +0 -9
-rw-r--r--. 1 acme acme 5581 Oct 17 09:07 tools/perf/util/bpf_skel/bperf_cgroup.bpf.c
-rw-r--r--. 1 acme acme 1764 May  5  2022 tools/perf/util/bpf_skel/bperf_follower.bpf.c
-rw-r--r--. 1 acme acme 1438 May  5  2022 tools/perf/util/bpf_skel/bperf_leader.bpf.c
-rw-r--r--. 1 acme acme 2290 May  5  2022 tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
-rw-r--r--. 1 acme acme 2164 May  5  2022 tools/perf/util/bpf_skel/func_latency.bpf.c
-rw-r--r--. 1 acme acme 9017 Aug 26  2022 tools/perf/util/bpf_skel/kwork_trace.bpf.c
-rw-r--r--. 1 acme acme 9251 Mar 14 08:33 tools/perf/util/bpf_skel/lock_contention.bpf.c
-rw-r--r--. 1 acme acme 6109 Feb 27 17:47 tools/perf/util/bpf_skel/off_cpu.bpf.c
-rw-r--r--. 1 acme acme 4310 Mar 15 11:08 tools/perf/util/bpf_skel/sample_filter.bpf.c

⬢[acme@toolbox perf-tools-next]$

For instance, take a look at these csets:

⬢[acme@toolbox perf-tools-next]$ git log --oneline tools/perf/util/bpf_skel/lock_contention.bpf.c d24c0144b1dde00f perf lock contention: Show per-cpu rq_lock with address 1811e82767dcc6eb perf lock contention: Track and show siglock with address 3ace2435bb93445e perf lock contention: Track and show mmap_lock with address 17535a33a9c1e4fb perf lock contention: Fix compiler builtin detection 1bece1351c653c3d perf lock contention: Support old rw_semaphore type 3477f079fe70b3c9 perf lock contention: Add -o/--lock-owner option ebab291641bed48f perf lock contention: Support filters for different aggregation 5e3febe7b7b99f94 perf lock contention: Support lock addr/name filtering for BPF 529772c4df286159 perf lock contention: Support lock type filtering for BPF 688d2e8de231c54e perf lock contention: Add -l/--lock-addr option
eca949b2b4addd94 perf lock contention: Implement -t/--threads option for BPF fd507d3e359c7e06 perf lock contention: Add lock_data.h for common data c66a36af7ba3a628 perf lock contention: Do not use BPF task local storage 433b31fa00797a2a perf lock contention: Fix a build error on 32-bit c1da8dd5c11dabd5 perf lock contention: Skip stack trace from BPF
6d499a6b3d90277d perf lock: Print the number of lost entries for BPF 6fda2405f414b24a perf lock: Implement cpu and task filters for BPF 407b36f69efbdccf perf lock: Use BPF for lock contention analysis
⬢[acme@toolbox perf-tools-next]$

or:

⬢[acme@toolbox perf-tools-next]$ git log --oneline tools/perf/util/bpf_skel/kwork_trace.bpf.c acfb65fe1d11a97f perf kwork: Add workqueue trace BPF support
5a81927a407c050a perf kwork: Add softirq trace BPF support
420298aefe94840f perf kwork: Add IRQ trace BPF support
daf07d220710a3c8 perf kwork: Implement BPF trace
⬢[acme@toolbox perf-tools-next]$

Quoted 6 lines

So we need to fine tune this detection of needed components to build these features, in time for the v6.4 merge window, that is why we decided to make this opt-out to hammer out problems.

Other arches probably will hit some of these problems, lets try to encourage others to try what is in linux-next.

Just to throw out, perhaps we could ship a vmlinux.h in the perf source tree. We could also validate it with something similar to the header file checking. This would remove the bpftool and properly built kernel issues. It may make a package maintainer's life easier.

Thanks,
Ian

Quoted 1 line

- Arnaldo

#9 lore raw
In reply to Arnaldo Carvalho de Melo

Hi Arnaldo,

Just a few datapoints:

My build machine (Debian Testing PowerpcLE, not quite the latest kernel):

Quoted 4 lines · On Thu, 23 Mar 2023 10:27:36 -0300 Arnaldo Carvalho de Melo <[email protected]>…

Which improves a bit the situation.

We could check if bpftool is available and if not, suggest installing it.

$ ls -l /usr/sbin/bpftool
-rwxr-xr-x 1 root root 790504 Mar  6 02:33 /usr/sbin/bpftool
Quoted 3 lines

If it is available, we could check if /sys/kernel/bpf/ is available, if not suggest using a kernel with CONFIG_DEBUG_INFO_BTF=y, as most distros have by now.

$ uname -a
Linux zz1 6.0.0-5-powerpc64le #1 SMP Debian 6.0.10-2 (2022-12-01) ppc64le GNU/Linux
$ ls -l /sys/kernel/bpf/
ls: cannot access '/sys/kernel/bpf/': No such file or directory
$ grep CONFIG_DEBUG_INFO_BTF /boot/config-6.0.0-5-powerpc64le
# CONFIG_DEBUG_INFO_BTF is not set

And in the latest powerpc64le kernel:

$ grep CONFIG_DEBUG_INFO_BTF /boot/config-6.1.0-5-powerpc64le
# CONFIG_DEBUG_INFO_BTF is not set

Debian Testing arm64, not quite the latest kernel:

$ uname -a
Linux oak 6.1.0-5-arm64 #1 SMP Debian 6.1.12-1 (2023-02-15) aarch64 GNU/Linux
$ ls -l /sys/kernel/bpf/
ls: cannot access '/sys/kernel/bpf/': No such file or directory
$ grep CONFIG_DEBUG_INFO_BTF /boot/config-6.1.0-5-arm64
CONFIG_DEBUG_INFO_BTF=y
CONFIG_DEBUG_INFO_BTF_MODULES=y

Debian Testing amd64, the latest kernel:

$ uname -a
Linux pine 6.1.0-6-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.15-1 (2023-03-05) x86_64 GNU/Linux
$ ls -l /sys/kernel/bpf/
ls: cannot access '/sys/kernel/bpf/': No such file or directory
$ grep CONFIG_DEBUG_INFO_BTF /boot/config-6.1.0-6-amd64
CONFIG_DEBUG_INFO_BTF=y
CONFIG_DEBUG_INFO_BTF_MODULES=y

Debian Stable amd64, the latest kernel:

$ uname -a
Linux gimli 5.10.0-21-cloud-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 GNU/Linux
$ ls -l /sys/kernel/bpf/
ls: cannot access '/sys/kernel/bpf/': No such file or directory
$ grep CONFIG_DEBUG_INFO_BTF /boot/config-5.10.0-21-cloud-amd64
CONFIG_DEBUG_INFO_BTF=y
Signature · 2 lines
Cheers,
Stephen Rothwell
#10 lore raw

Em Tue, Mar 28, 2023 at 12:33:32PM +1100, Stephen Rothwell escreveu:

Quoted 7 lines

Hi Arnaldo,

Just a few datapoints:

My build machine (Debian Testing PowerpcLE, not quite the latest kernel):

Quoted 12 lines
Quoted 4 lines · On Thu, 23 Mar 2023 10:27:36 -0300 Arnaldo Carvalho de Melo <[email protected]>…

Which improves a bit the situation.

We could check if bpftool is available and if not, suggest installing it.

$ ls -l /usr/sbin/bpftool
-rwxr-xr-x 1 root root 790504 Mar  6 02:33 /usr/sbin/bpftool
Quoted 3 lines

If it is available, we could check if /sys/kernel/bpf/ is available, if not suggest using a kernel with CONFIG_DEBUG_INFO_BTF=y, as most distros have by now.

The config files you used don't match the running kernels

Quoted 14 lines
$ uname -a
Linux zz1 6.0.0-5-powerpc64le #1 SMP Debian 6.0.10-2 (2022-12-01) ppc64le GNU/Linux
$ ls -l /sys/kernel/bpf/
ls: cannot access '/sys/kernel/bpf/': No such file or directory
$ grep CONFIG_DEBUG_INFO_BTF /boot/config-6.0.0-5-powerpc64le
# CONFIG_DEBUG_INFO_BTF is not set

And in the latest powerpc64le kernel:

$ grep CONFIG_DEBUG_INFO_BTF /boot/config-6.1.0-5-powerpc64le
# CONFIG_DEBUG_INFO_BTF is not set

Debian Testing arm64, not quite the latest kernel:

Quoted 7 lines
$ uname -a
Linux oak 6.1.0-5-arm64 #1 SMP Debian 6.1.12-1 (2023-02-15) aarch64 GNU/Linux
$ ls -l /sys/kernel/bpf/
ls: cannot access '/sys/kernel/bpf/': No such file or directory
$ grep CONFIG_DEBUG_INFO_BTF /boot/config-6.1.0-5-arm64
CONFIG_DEBUG_INFO_BTF=y
CONFIG_DEBUG_INFO_BTF_MODULES=y

The running kernel is 6.1.12-1, the .config is 6.1.0-5

Quoted 9 lines

Debian Testing amd64, the latest kernel:

$ uname -a
Linux pine 6.1.0-6-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.15-1 (2023-03-05) x86_64 GNU/Linux
$ ls -l /sys/kernel/bpf/
ls: cannot access '/sys/kernel/bpf/': No such file or directory
$ grep CONFIG_DEBUG_INFO_BTF /boot/config-6.1.0-6-amd64
CONFIG_DEBUG_INFO_BTF=y
CONFIG_DEBUG_INFO_BTF_MODULES=y

Ditto, 6.1.15-1 != 6.1.0-6

Quoted 9 lines

Debian Stable amd64, the latest kernel:

$ uname -a
Linux gimli 5.10.0-21-cloud-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 GNU/Linux
$ ls -l /sys/kernel/bpf/
ls: cannot access '/sys/kernel/bpf/': No such file or directory
$ grep CONFIG_DEBUG_INFO_BTF /boot/config-5.10.0-21-cloud-amd64
CONFIG_DEBUG_INFO_BTF=y

Ditto, 5.10.162-1 != 5.10.0-21-cloud

Here:

[acme@quaco pahole]$ grep CONFIG_DEBUG_INFO_BTF /boot/config-uname -r CONFIG_DEBUG_INFO_BTF=y
CONFIG_DEBUG_INFO_BTF_MODULES=y
[acme@quaco pahole]$ uname -r
6.1.18-100.fc36.x86_64
[acme@quaco pahole]$

[acme@quaco pahole]$ ls -la /sys/kernel/btf/vmlinux -r--r--r--. 1 root root 5499812 Mar 20 17:45 /sys/kernel/btf/vmlinux [acme@quaco pahole]$ ls -la /sys/kernel/btf/nfsv4 -r--r--r--. 1 root root 319948 Mar 28 16:46 /sys/kernel/btf/nfsv4 [acme@quaco pahole]$ lsmod | grep -w nfsv4

nfsv4                1085440  1
dns_resolver           16384  1 nfsv4
nfs                   532480  2 nfsv4
sunrpc                704512  26 nfsd,rpcrdma,nfsv4,auth_rpcgss,lockd,rpcsec_gss_krb5,nfs_acl,nfs

[acme@quaco pahole]$ ls -la /sys/kernel/btf/nfsd -r--r--r--. 1 root root 596066 Mar 28 16:46 /sys/kernel/btf/nfsd [acme@quaco pahole]$ ls -la /sys/kernel/btf/lockd -r--r--r--. 1 root root 180234 Mar 28 16:46 /sys/kernel/btf/lockd [acme@quaco pahole]$

Quoted 3 lines
Signature · 2 lines
Cheers,
Stephen Rothwell
#11 lore raw

Hi Arnaldo,

Quoted 2 lines · On Tue, 28 Mar 2023 16:47:23 -0300 Arnaldo Carvalho de Melo <[email protected]>…

The config files you used don't match the running kernels

This is just the way Debian names its kernel packages.

Quoted 2 lines
Quoted 2 lines
$ uname -a
Linux zz1 6.0.0-5-powerpc64le #1 SMP Debian 6.0.10-2 (2022-12-01) ppc64le GNU/Linux
              ^^^^^^^^^^^^^^^^^^^
Quoted 3 lines
Quoted 3 lines
$ ls -l /sys/kernel/bpf/
ls: cannot access '/sys/kernel/bpf/': No such file or directory
$ grep CONFIG_DEBUG_INFO_BTF /boot/config-6.0.0-5-powerpc64le
                                              ^^^^^^^^^^^^^^^^^^^

And so on. It just happens that this kernel is based on v6.0.10.

$ uname -r
6.0.0-5-powerpc64le

So they are the correct config files.

Also, the mail I replied to talked about checking /sys/kernel/bpf/ (not btf) :-(

still on my build machine (of course):

$ ls -l /sys/kernel/btf/
ls: cannot access '/sys/kernel/btf/': No such file or directory

So it seems that Debian do not build their powerpcle kernels with CONFIG_DEBUG_INFO_BTF. I don't know why not since all the dependencies seem to be OK.

[On my arm64 machine:

$ ls -l /sys/kernel/btf/vmlinux
-r--r--r-- 1 root root 5209570 Mar 29 09:52 /sys/kernel/btf/vmlinux

and on my amd64 machine:

$ ls -l /sys/kernel/btf/vmlinux
-r--r--r-- 1 root root 8536946 Mar 29 10:04 /sys/kernel/btf/vmlinux
]
Signature · 2 lines
Cheers,
Stephen Rothwell
#12 lore raw

Em Wed, Mar 29, 2023 at 10:06:12AM +1100, Stephen Rothwell escreveu:

Quoted 16 lines

Hi Arnaldo,

Quoted 1 line · On Tue, 28 Mar 2023 16:47:23 -0300 Arnaldo Carvalho de Melo <[email protected]>…

The config files you used don't match the running kernels

This is just the way Debian names its kernel packages.

Quoted 2 lines
Quoted 2 lines
$ uname -a
Linux zz1 6.0.0-5-powerpc64le #1 SMP Debian 6.0.10-2 (2022-12-01) ppc64le GNU/Linux
              ^^^^^^^^^^^^^^^^^^^
Quoted 3 lines
Quoted 3 lines
$ ls -l /sys/kernel/bpf/
ls: cannot access '/sys/kernel/bpf/': No such file or directory
$ grep CONFIG_DEBUG_INFO_BTF /boot/config-6.0.0-5-powerpc64le
                                              ^^^^^^^^^^^^^^^^^^^

And so on. It just happens that this kernel is based on v6.0.10.

Quoted 7 lines
$ uname -r
6.0.0-5-powerpc64le

So they are the correct config files.

Also, the mail I replied to talked about checking /sys/kernel/bpf/ (not btf) :-(

Sorry about that, I replied from my smartphone, when on my workstation I try to try the commands and copy'n'paste the whole command + output sequence to avoid such mistakes.

Quoted 8 lines

still on my build machine (of course):

$ ls -l /sys/kernel/btf/
ls: cannot access '/sys/kernel/btf/': No such file or directory

So it seems that Debian do not build their powerpcle kernels with CONFIG_DEBUG_INFO_BTF. I don't know why not since all the dependencies seem to be OK.

Right, at this point they should if they want to properly support the full set of BPF functionalities, notably CO-RE.

Quoted 10 lines

[On my arm64 machine:

$ ls -l /sys/kernel/btf/vmlinux
-r--r--r-- 1 root root 5209570 Mar 29 09:52 /sys/kernel/btf/vmlinux

and on my amd64 machine:

$ ls -l /sys/kernel/btf/vmlinux
-r--r--r-- 1 root root 8536946 Mar 29 10:04 /sys/kernel/btf/vmlinux
]

Everything should be working fine on those machines, right?

- Arnaldo

#13 lore raw

Hi Arnaldo,

Quoted 6 lines · On Wed, 29 Mar 2023 09:28:39 -0300 Arnaldo Carvalho de Melo <[email protected]>…
Quoted 6 lines

[On my arm64 machine:

$ ls -l /sys/kernel/btf/vmlinux
-r--r--r-- 1 root root 5209570 Mar 29 09:52 /sys/kernel/btf/vmlinux
Quoted 7 lines
Quoted 5 lines

and on my amd64 machine:

$ ls -l /sys/kernel/btf/vmlinux
-r--r--r-- 1 root root 8536946 Mar 29 10:04 /sys/kernel/btf/vmlinux
]  

Everything should be working fine on those machines, right?

Sorry, I don;t build on those machines.

Signature · 2 lines
Cheers,
Stephen Rothwell