Skip to contentSkip to conversation

perf build broken looking for bpf/{libbpf,bpf}.h after merge with upstream

DISCUSSION Arnaldo Carvalho de Melo 5 participants 14 messages Nov 4, 2021 – Nov 5, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Song,

I just did a merge with upstream and I'm getting this:

LINK /tmp/build/perf/plugins/plugin_scsi.so
INSTALL trace_plugins

Auto-detecting system features:

...                        libbfd: [ on  ]
...        disassembler-four-args: [ on  ]
...                          zlib: [ on  ]
...                        libcap: [ on  ]
...               clang-bpf-co-re: [ on  ]
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//libbpf//include/bpf
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/
  INSTALL /tmp/build/perf/util/bpf_skel/.tmp//libbpf//include/bpf/hashmap.h
  INSTALL /tmp/build/perf/util/bpf_skel/.tmp//libbpf//include/bpf/nlattr.h
  GEN     /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/bpf_helper_defs.h
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf_probes.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/xsk.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/bpf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/nlattr.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/btf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf_errno.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/hashmap.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/str_error.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/netlink.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/btf_dump.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/bpf_prog_linfo.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/ringbuf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/strset.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/linker.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/gen_loader.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/relo_core.o
  LD      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf-in.o
  LINK    /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/libbpf.a
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/main.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/common.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/gen.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/json_writer.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/xlated_dumper.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf_dumper.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/disasm.o
gen.c:15:10: fatal error: bpf/bpf.h: No such file or directory
   15 | #include <bpf/bpf.h>
      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/gen.o] Error 1 make[3]: *** Waiting for unfinished jobs....
xlated_dumper.c:10:10: fatal error: bpf/libbpf.h: No such file or directory
10 | #include <bpf/libbpf.h>

      |          ^~~~~~~~~~~~~~
compilation terminated.
btf.c:15:10: fatal error: bpf/bpf.h: No such file or directory
   15 | #include <bpf/bpf.h>
      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/xlated_dumper.o] Error 1 make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf.o] Error 1 main.c:12:10: fatal error: bpf/bpf.h: No such file or directory
12 | #include <bpf/bpf.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/main.o] Error 1 btf_dumper.c:12:10: fatal error: bpf/btf.h: No such file or directory
12 | #include <bpf/btf.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf_dumper.o] Error 1 common.c:24:10: fatal error: bpf/bpf.h: No such file or directory
24 | #include <bpf/bpf.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/common.o] Error 1 make[2]: *** [Makefile.perf:1048: /tmp/build/perf/util/bpf_skel/.tmp/bootstrap/bpftool] Error 2 make[1]: *** [Makefile.perf:240: sub-make] Error 2
make: *** [Makefile:113: install-bin] Error 2
make: Leaving directory '/var/home/acme/git/perf/tools/perf'

Performance counter stats for 'make -k BUILD_BPF_SKEL=1 CORESIGHT=1 PYTHON=python3 O=/tmp/build/perf -C tools/perf install-bin':

          6,965.78 msec task-clock:u              #    1.492 CPUs utilized
          6,937.93 msec cpu-clock:u               #    1.486 CPUs utilized
       4.669198336 seconds time elapsed

       4.015978000 seconds user
       3.202660000 seconds sys

70: Event expansion for cgroups : Ok
88: perf all metricgroups test : FAILED!
⬢[acme@toolbox perf]$ find tools/ -name bpf.h tools/include/uapi/linux/bpf.h tools/lib/bpf/bpf.h tools/perf/include/bpf/bpf.h ⬢[acme@toolbox perf]$ find tools/ -name libbpf.h tools/lib/bpf/libbpf.h
⬢[acme@toolbox perf]$ find tools/perf/ -name gen.c ⬢[acme@toolbox perf]$

Before the merge, with pristine sources I wasn't getting this, investigating now.

⬢[acme@toolbox perf]$ git show HEAD
commit e1498f18537a1639963370a4635c6fb99e7d672b (HEAD -> perf/core)
Merge: 32f7aa2731b24ad8 abfecb39092029c4
Author: Arnaldo Carvalho de Melo <[email protected]>
Date: Thu Nov 4 14:32:11 2021 -0300

Merge remote-tracking branch 'torvalds/master' into perf/core

To pick up some tools/perf/ patches that went via tip/perf/core, such as:

tools/perf: Add mem_hops field in perf_mem_data_src structure

⬢[acme@toolbox perf]$

⬢[acme@toolbox perf]$ git log --oneline -10 torvalds/master
abfecb39092029c4 (torvalds/master) Merge tag 'tty-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
95faf6ba654dd334 Merge tag 'driver-core-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
5c904c66ed4e86c3 Merge tag 'char-misc-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
5cd4dc44b8a0f656 Merge tag 'staging-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
048ff8629e117d84 Merge tag 'usb-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
7ddb58cb0ecae8e8 Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
ce840177930f591a Merge tag 'defconfig-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
d461e96cd22b5aeb Merge tag 'drivers-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
ae45d84fc36d01dc Merge tag 'dt-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
2219b0ceefe835b9 Merge tag 'soc-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
⬢[acme@toolbox perf]$

- Arnaldo

#1 lore raw
Quoted 4 lines · Arnaldo Carvalho de Melo

Hi Song,

cc Quentin as well, might be related to recent Makefiles revamp for users of libbpf. But in bpf-next perf builds perfectly fine, so not sure.

Quoted 146 lines

I just did a merge with upstream and I'm getting this:

LINK /tmp/build/perf/plugins/plugin_scsi.so
INSTALL trace_plugins

Auto-detecting system features:

...                        libbfd: [ on  ]
...        disassembler-four-args: [ on  ]
...                          zlib: [ on  ]
...                        libcap: [ on  ]
...               clang-bpf-co-re: [ on  ]
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//libbpf//include/bpf
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/
  INSTALL /tmp/build/perf/util/bpf_skel/.tmp//libbpf//include/bpf/hashmap.h
  INSTALL /tmp/build/perf/util/bpf_skel/.tmp//libbpf//include/bpf/nlattr.h
  GEN     /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/bpf_helper_defs.h
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf_probes.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/xsk.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/bpf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/nlattr.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/btf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf_errno.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/hashmap.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/str_error.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/netlink.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/btf_dump.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/bpf_prog_linfo.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/ringbuf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/strset.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/linker.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/gen_loader.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/relo_core.o
  LD      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf-in.o
  LINK    /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/libbpf.a
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/main.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/common.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/gen.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/json_writer.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/xlated_dumper.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf_dumper.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/disasm.o
gen.c:15:10: fatal error: bpf/bpf.h: No such file or directory
   15 | #include <bpf/bpf.h>
      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/gen.o] Error 1 make[3]: *** Waiting for unfinished jobs....
xlated_dumper.c:10:10: fatal error: bpf/libbpf.h: No such file or directory
10 | #include <bpf/libbpf.h>

      |          ^~~~~~~~~~~~~~
compilation terminated.
btf.c:15:10: fatal error: bpf/bpf.h: No such file or directory
   15 | #include <bpf/bpf.h>
      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/xlated_dumper.o] Error 1 make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf.o] Error 1 main.c:12:10: fatal error: bpf/bpf.h: No such file or directory
12 | #include <bpf/bpf.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/main.o] Error 1 btf_dumper.c:12:10: fatal error: bpf/btf.h: No such file or directory
12 | #include <bpf/btf.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf_dumper.o] Error 1 common.c:24:10: fatal error: bpf/bpf.h: No such file or directory
24 | #include <bpf/bpf.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/common.o] Error 1 make[2]: *** [Makefile.perf:1048: /tmp/build/perf/util/bpf_skel/.tmp/bootstrap/bpftool] Error 2 make[1]: *** [Makefile.perf:240: sub-make] Error 2
make: *** [Makefile:113: install-bin] Error 2
make: Leaving directory '/var/home/acme/git/perf/tools/perf'

Performance counter stats for 'make -k BUILD_BPF_SKEL=1 CORESIGHT=1 PYTHON=python3 O=/tmp/build/perf -C tools/perf install-bin':

          6,965.78 msec task-clock:u              #    1.492 CPUs utilized
          6,937.93 msec cpu-clock:u               #    1.486 CPUs utilized
       4.669198336 seconds time elapsed

       4.015978000 seconds user
       3.202660000 seconds sys

70: Event expansion for cgroups : Ok
88: perf all metricgroups test : FAILED!
⬢[acme@toolbox perf]$ find tools/ -name bpf.h tools/include/uapi/linux/bpf.h tools/lib/bpf/bpf.h tools/perf/include/bpf/bpf.h ⬢[acme@toolbox perf]$ find tools/ -name libbpf.h tools/lib/bpf/libbpf.h
⬢[acme@toolbox perf]$ find tools/perf/ -name gen.c ⬢[acme@toolbox perf]$

Before the merge, with pristine sources I wasn't getting this, investigating now.

⬢[acme@toolbox perf]$ git show HEAD
commit e1498f18537a1639963370a4635c6fb99e7d672b (HEAD -> perf/core)
Merge: 32f7aa2731b24ad8 abfecb39092029c4
Author: Arnaldo Carvalho de Melo <[email protected]>
Date: Thu Nov 4 14:32:11 2021 -0300

Merge remote-tracking branch 'torvalds/master' into perf/core

To pick up some tools/perf/ patches that went via tip/perf/core, such as:

tools/perf: Add mem_hops field in perf_mem_data_src structure

⬢[acme@toolbox perf]$

⬢[acme@toolbox perf]$ git log --oneline -10 torvalds/master
abfecb39092029c4 (torvalds/master) Merge tag 'tty-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
95faf6ba654dd334 Merge tag 'driver-core-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
5c904c66ed4e86c3 Merge tag 'char-misc-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
5cd4dc44b8a0f656 Merge tag 'staging-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
048ff8629e117d84 Merge tag 'usb-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
7ddb58cb0ecae8e8 Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
ce840177930f591a Merge tag 'defconfig-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
d461e96cd22b5aeb Merge tag 'drivers-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
ae45d84fc36d01dc Merge tag 'dt-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
2219b0ceefe835b9 Merge tag 'soc-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
⬢[acme@toolbox perf]$

- Arnaldo

#2 lore raw

Em Thu, Nov 04, 2021 at 10:47:12AM -0700, Andrii Nakryiko escreveu:

Quoted 10 lines
Quoted 4 lines · Arnaldo Carvalho de Melo

Hi Song,

cc Quentin as well, might be related to recent Makefiles revamp for users of libbpf. But in bpf-next perf builds perfectly fine, so not sure.

This did the trick:

⬢[acme@toolbox perf]$ git show
commit 504afe6757ec646539ca3b4aa0431820e8c92b45 (HEAD -> perf/core)

Author: Arnaldo Carvalho de Melo <[email protected]>
Date:   Thu Nov 4 14:58:56 2021 -0300
    Revert "bpftool: Remove Makefile dep. on $(LIBBPF) for $(LIBBPF_INTERNAL_HDRS)"

    This reverts commit 8b6c46241c774c83998092a4eafe40f054568881.

    Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/bpf/bpftool/Makefile +2 -2
index c0c30e56988f2cbe..c5ad996ee95d4e87 100644
@@ -39,14 +39,14 @@ ifeq ($(BPFTOOL_VERSION),)
 BPFTOOL_VERSION := $(shell make -rR --no-print-directory -sC ../../.. kernelversion)
 endif
 
-$(LIBBPF_OUTPUT) $(BOOTSTRAP_OUTPUT) $(LIBBPF_BOOTSTRAP_OUTPUT) $(LIBBPF_HDRS_DIR):
+$(LIBBPF_OUTPUT) $(BOOTSTRAP_OUTPUT) $(LIBBPF_BOOTSTRAP_OUTPUT):
        $(QUIET_MKDIR)mkdir -p $@
 
 $(LIBBPF): $(wildcard $(BPF_DIR)/*.[ch] $(BPF_DIR)/Makefile) | $(LIBBPF_OUTPUT)
        $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIBBPF_OUTPUT) \
                DESTDIR=$(LIBBPF_DESTDIR) prefix= $(LIBBPF) install_headers
 
-$(LIBBPF_INTERNAL_HDRS): $(LIBBPF_HDRS_DIR)/%.h: $(BPF_DIR)/%.h | $(LIBBPF_HDRS_DIR)
+$(LIBBPF_INTERNAL_HDRS): $(LIBBPF_HDRS_DIR)/%.h: $(BPF_DIR)/%.h $(LIBBPF)
        $(call QUIET_INSTALL, $@)
        $(Q)install -m 644 -t $(LIBBPF_HDRS_DIR) $<
 

⬢[acme@toolbox perf]$

Quoted 146 lines
Quoted 146 lines

I just did a merge with upstream and I'm getting this:

LINK /tmp/build/perf/plugins/plugin_scsi.so
INSTALL trace_plugins

Auto-detecting system features:

...                        libbfd: [ on  ]
...        disassembler-four-args: [ on  ]
...                          zlib: [ on  ]
...                        libcap: [ on  ]
...               clang-bpf-co-re: [ on  ]
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//libbpf//include/bpf
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/
  INSTALL /tmp/build/perf/util/bpf_skel/.tmp//libbpf//include/bpf/hashmap.h
  INSTALL /tmp/build/perf/util/bpf_skel/.tmp//libbpf//include/bpf/nlattr.h
  GEN     /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/bpf_helper_defs.h
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf_probes.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/xsk.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/bpf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/nlattr.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/btf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf_errno.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/hashmap.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/str_error.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/netlink.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/btf_dump.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/bpf_prog_linfo.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/ringbuf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/strset.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/linker.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/gen_loader.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/relo_core.o
  LD      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf-in.o
  LINK    /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/libbpf.a
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/main.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/common.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/gen.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/json_writer.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/xlated_dumper.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf_dumper.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/disasm.o
gen.c:15:10: fatal error: bpf/bpf.h: No such file or directory
   15 | #include <bpf/bpf.h>
      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/gen.o] Error 1 make[3]: *** Waiting for unfinished jobs....
xlated_dumper.c:10:10: fatal error: bpf/libbpf.h: No such file or directory
10 | #include <bpf/libbpf.h>

      |          ^~~~~~~~~~~~~~
compilation terminated.
btf.c:15:10: fatal error: bpf/bpf.h: No such file or directory
   15 | #include <bpf/bpf.h>
      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/xlated_dumper.o] Error 1 make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf.o] Error 1 main.c:12:10: fatal error: bpf/bpf.h: No such file or directory
12 | #include <bpf/bpf.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/main.o] Error 1 btf_dumper.c:12:10: fatal error: bpf/btf.h: No such file or directory
12 | #include <bpf/btf.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf_dumper.o] Error 1 common.c:24:10: fatal error: bpf/bpf.h: No such file or directory
24 | #include <bpf/bpf.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/common.o] Error 1 make[2]: *** [Makefile.perf:1048: /tmp/build/perf/util/bpf_skel/.tmp/bootstrap/bpftool] Error 2 make[1]: *** [Makefile.perf:240: sub-make] Error 2
make: *** [Makefile:113: install-bin] Error 2
make: Leaving directory '/var/home/acme/git/perf/tools/perf'

Performance counter stats for 'make -k BUILD_BPF_SKEL=1 CORESIGHT=1 PYTHON=python3 O=/tmp/build/perf -C tools/perf install-bin':

          6,965.78 msec task-clock:u              #    1.492 CPUs utilized
          6,937.93 msec cpu-clock:u               #    1.486 CPUs utilized
       4.669198336 seconds time elapsed

       4.015978000 seconds user
       3.202660000 seconds sys

70: Event expansion for cgroups : Ok
88: perf all metricgroups test : FAILED!
⬢[acme@toolbox perf]$ find tools/ -name bpf.h tools/include/uapi/linux/bpf.h tools/lib/bpf/bpf.h tools/perf/include/bpf/bpf.h ⬢[acme@toolbox perf]$ find tools/ -name libbpf.h tools/lib/bpf/libbpf.h
⬢[acme@toolbox perf]$ find tools/perf/ -name gen.c ⬢[acme@toolbox perf]$

Before the merge, with pristine sources I wasn't getting this, investigating now.

⬢[acme@toolbox perf]$ git show HEAD
commit e1498f18537a1639963370a4635c6fb99e7d672b (HEAD -> perf/core)
Merge: 32f7aa2731b24ad8 abfecb39092029c4
Author: Arnaldo Carvalho de Melo <[email protected]>
Date: Thu Nov 4 14:32:11 2021 -0300

Merge remote-tracking branch 'torvalds/master' into perf/core

To pick up some tools/perf/ patches that went via tip/perf/core, such as:

tools/perf: Add mem_hops field in perf_mem_data_src structure

⬢[acme@toolbox perf]$

⬢[acme@toolbox perf]$ git log --oneline -10 torvalds/master
abfecb39092029c4 (torvalds/master) Merge tag 'tty-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
95faf6ba654dd334 Merge tag 'driver-core-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
5c904c66ed4e86c3 Merge tag 'char-misc-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
5cd4dc44b8a0f656 Merge tag 'staging-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
048ff8629e117d84 Merge tag 'usb-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
7ddb58cb0ecae8e8 Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
ce840177930f591a Merge tag 'defconfig-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
d461e96cd22b5aeb Merge tag 'drivers-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
ae45d84fc36d01dc Merge tag 'dt-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
2219b0ceefe835b9 Merge tag 'soc-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
⬢[acme@toolbox perf]$

- Arnaldo

Signature · 1 line
- Arnaldo
#3 lore raw

2021-11-04 15:09 UTC-0300 ~ Arnaldo Carvalho de Melo <[email protected]>

Quoted 35 lines

Em Thu, Nov 04, 2021 at 10:47:12AM -0700, Andrii Nakryiko escreveu:

Quoted 10 lines
Quoted 4 lines · Arnaldo Carvalho de Melo

Hi Song,

cc Quentin as well, might be related to recent Makefiles revamp for users of libbpf. But in bpf-next perf builds perfectly fine, so not sure.

This did the trick:

⬢[acme@toolbox perf]$ git show
commit 504afe6757ec646539ca3b4aa0431820e8c92b45 (HEAD -> perf/core)

Author: Arnaldo Carvalho de Melo <[email protected]>
Date:   Thu Nov 4 14:58:56 2021 -0300
    Revert "bpftool: Remove Makefile dep. on $(LIBBPF) for $(LIBBPF_INTERNAL_HDRS)"

    This reverts commit 8b6c46241c774c83998092a4eafe40f054568881.

    Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/bpf/bpftool/Makefile +1 -1
index c0c30e56988f2cbe..c5ad996ee95d4e87 100644
@@ -39,14 +39,14 @@ ifeq ($(BPFTOOL_VERSION),)
 BPFTOOL_VERSION := $(shell make -rR --no-print-directory -sC ../../.. kernelversion)
 endif
 
-$(LIBBPF_OUTPUT) $(BOOTSTRAP_OUTPUT) $(LIBBPF_BOOTSTRAP_OUTPUT) $(LIBBPF_HDRS_DIR):
+$(LIBBPF_OUTPUT) $(BOOTSTRAP_OUTPUT) $(LIBBPF_BOOTSTRAP_OUTPUT):

tools/bpf/bpftool/Makefile ifeq ($(BPFTOOL_VERSION),) · line 51

Quoted 10 lines
tools/bpf/bpftool/Makefile +1 -1
        $(QUIET_MKDIR)mkdir -p $@
 
 $(LIBBPF): $(wildcard $(BPF_DIR)/*.[ch] $(BPF_DIR)/Makefile) | $(LIBBPF_OUTPUT)
        $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIBBPF_OUTPUT) \
                DESTDIR=$(LIBBPF_DESTDIR) prefix= $(LIBBPF) install_headers
 
-$(LIBBPF_INTERNAL_HDRS): $(LIBBPF_HDRS_DIR)/%.h: $(BPF_DIR)/%.h | $(LIBBPF_HDRS_DIR)
+$(LIBBPF_INTERNAL_HDRS): $(LIBBPF_HDRS_DIR)/%.h: $(BPF_DIR)/%.h $(LIBBPF)
        $(call QUIET_INSTALL, $@)
        $(Q)install -m 644 -t $(LIBBPF_HDRS_DIR) $<

Interesting. I needed that patch because otherwise I'd get errors when compiling bpftool after the switch to libbpf's hashmap implementation. For the current breakage, it could be a matter of how we pass variables when descending into bpftool/ from perf's Makefile.perf. I'll try to look at this in details, and to experiment tonight, if I can. (Thanks Andrii for the CC!)

Thanks,
Quentin

#4 lore raw

Em Thu, Nov 04, 2021 at 06:15:57PM +0000, Quentin Monnet escreveu:

Quoted 42 lines

2021-11-04 15:09 UTC-0300 ~ Arnaldo Carvalho de Melo <[email protected]>

Quoted 41 lines

Em Thu, Nov 04, 2021 at 10:47:12AM -0700, Andrii Nakryiko escreveu:

Quoted 10 lines
Quoted 4 lines · Arnaldo Carvalho de Melo

Hi Song,

cc Quentin as well, might be related to recent Makefiles revamp for users of libbpf. But in bpf-next perf builds perfectly fine, so not sure.

This did the trick:

⬢[acme@toolbox perf]$ git show
commit 504afe6757ec646539ca3b4aa0431820e8c92b45 (HEAD -> perf/core)

Author: Arnaldo Carvalho de Melo <[email protected]>
Date:   Thu Nov 4 14:58:56 2021 -0300
    Revert "bpftool: Remove Makefile dep. on $(LIBBPF) for $(LIBBPF_INTERNAL_HDRS)"

    This reverts commit 8b6c46241c774c83998092a4eafe40f054568881.

    Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/bpf/bpftool/Makefile +1 -1
index c0c30e56988f2cbe..c5ad996ee95d4e87 100644
@@ -39,14 +39,14 @@ ifeq ($(BPFTOOL_VERSION),)
 BPFTOOL_VERSION := $(shell make -rR --no-print-directory -sC ../../.. kernelversion)
 endif
 
-$(LIBBPF_OUTPUT) $(BOOTSTRAP_OUTPUT) $(LIBBPF_BOOTSTRAP_OUTPUT) $(LIBBPF_HDRS_DIR):
+$(LIBBPF_OUTPUT) $(BOOTSTRAP_OUTPUT) $(LIBBPF_BOOTSTRAP_OUTPUT):
        $(QUIET_MKDIR)mkdir -p $@
 
 $(LIBBPF): $(wildcard $(BPF_DIR)/*.[ch] $(BPF_DIR)/Makefile) | $(LIBBPF_OUTPUT)
        $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIBBPF_OUTPUT) \
                DESTDIR=$(LIBBPF_DESTDIR) prefix= $(LIBBPF) install_headers
 
Quoted 12 lines

tools/bpf/bpftool/Makefile ifeq ($(BPFTOOL_VERSION),) · line 51

Quoted 4 lines
tools/bpf/bpftool/Makefile +1 -1
-$(LIBBPF_INTERNAL_HDRS): $(LIBBPF_HDRS_DIR)/%.h: $(BPF_DIR)/%.h | $(LIBBPF_HDRS_DIR)
+$(LIBBPF_INTERNAL_HDRS): $(LIBBPF_HDRS_DIR)/%.h: $(BPF_DIR)/%.h $(LIBBPF)
        $(call QUIET_INSTALL, $@)
        $(Q)install -m 644 -t $(LIBBPF_HDRS_DIR) $<

Interesting. I needed that patch because otherwise I'd get errors when compiling bpftool after the switch to libbpf's hashmap implementation. For the current breakage, it could be a matter of how we pass variables when descending into bpftool/ from perf's Makefile.perf. I'll try to look at this in details, and to experiment tonight, if I can. (Thanks Andrii for the CC!)

yeah, if we pass the location for those headers from the perf side, it should work.

Extra info: if libbpf-devel is installed, it "builds", well, built before the merge, as the one available for fedora 34 is:

libbpf-devel-2:0.4.0-1.fc34.x86_64

after installing it, on the merged tree, with the above revert, I get:

CC /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/disasm.o
btf.c: In function ‘dump_btf_type’:
btf.c:328:47: warning: implicit declaration of function ‘btf__type_cnt’ [-Wimplicit-function-declaration]
328 | if (v->type < btf__type_cnt(btf)) {
| ^~~~~~~~~~~~~
btf.c:328:45: warning: comparison of integer expressions of different signedness: ‘__u32’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]
328 | if (v->type < btf__type_cnt(btf)) {
| ^
btf.c: In function ‘do_dump’:
btf.c:591:23: warning: implicit declaration of function ‘btf__load_from_kernel_by_id_split’ [-Wimplicit-function-declaration]

  591 |                 btf = btf__load_from_kernel_by_id_split(btf_id, base_btf);
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

btf.c:591:21: warning: assignment to ‘struct btf *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
591 | btf = btf__load_from_kernel_by_id_split(btf_id, base_btf);
| ^
btf_dumper.c: In function ‘dump_prog_id_as_func_ptr’:
btf_dumper.c:69:20: warning: implicit declaration of function ‘btf__load_from_kernel_by_id’ [-Wimplicit-function-declaration]

   69 |         prog_btf = btf__load_from_kernel_by_id(info->btf_id);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~

btf_dumper.c:69:18: warning: assignment to ‘struct btf *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
69 | prog_btf = btf__load_from_kernel_by_id(info->btf_id);
| ^
LINK /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/bpftool

If I revert the above revert I get a more catastrophic breakage:

CC /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/disasm.o
btf.c: In function ‘dump_btf_type’:
btf.c:328:47: warning: implicit declaration of function ‘btf__type_cnt’ [-Wimplicit-function-declaration]
328 | if (v->type < btf__type_cnt(btf)) {
| ^~~~~~~~~~~~~
btf.c:328:45: warning: comparison of integer expressions of different signedness: ‘__u32’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]
328 | if (v->type < btf__type_cnt(btf)) {
| ^
btf.c: In function ‘do_dump’:
btf.c:591:23: warning: implicit declaration of function ‘btf__load_from_kernel_by_id_split’ [-Wimplicit-function-declaration]

  591 |                 btf = btf__load_from_kernel_by_id_split(btf_id, base_btf);
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

btf.c:591:21: warning: assignment to ‘struct btf *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
591 | btf = btf__load_from_kernel_by_id_split(btf_id, base_btf);
| ^
btf_dumper.c: In function ‘dump_prog_id_as_func_ptr’:
btf_dumper.c:69:20: warning: implicit declaration of function ‘btf__load_from_kernel_by_id’ [-Wimplicit-function-declaration]

   69 |         prog_btf = btf__load_from_kernel_by_id(info->btf_id);
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~

btf_dumper.c:69:18: warning: assignment to ‘struct btf *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
69 | prog_btf = btf__load_from_kernel_by_id(info->btf_id);
| ^
gen.c: In function ‘codegen_datasecs’:
gen.c:214:17: warning: implicit declaration of function ‘btf__type_cnt’ [-Wimplicit-function-declaration]

  214 |         int n = btf__type_cnt(btf);
      |                 ^~~~~~~~~~~~~
In file included from /usr/include/bpf/bpf.h:31,
                 from gen.c:15:
gen.c: In function ‘gen_trace’:
gen.c:489:29: error: variable ‘opts’ has initializer but incomplete type
  489 |         DECLARE_LIBBPF_OPTS(gen_loader_opts, opts);
      |                             ^~~~~~~~~~~~~~~
gen.c:489:9: error: invalid application of ‘sizeof’ to incomplete type ‘struct gen_loader_opts’
  489 |         DECLARE_LIBBPF_OPTS(gen_loader_opts, opts);
      |         ^~~~~~~~~~~~~~~~~~~
gen.c:489:9: error: ‘struct gen_loader_opts’ has no member named ‘sz’
  489 |         DECLARE_LIBBPF_OPTS(gen_loader_opts, opts);
      |         ^~~~~~~~~~~~~~~~~~~
gen.c:489:9: error: invalid application of ‘sizeof’ to incomplete type ‘struct gen_loader_opts’
  489 |         DECLARE_LIBBPF_OPTS(gen_loader_opts, opts);
      |         ^~~~~~~~~~~~~~~~~~~
gen.c:489:9: warning: excess elements in struct initializer
  489 |         DECLARE_LIBBPF_OPTS(gen_loader_opts, opts);
      |         ^~~~~~~~~~~~~~~~~~~
gen.c:489:9: note: (near initialization for ‘(anonymous)’)
In file included from /usr/include/bpf/bpf.h:31,
                 from gen.c:15:
gen.c:489:9: error: invalid use of undefined type ‘struct gen_loader_opts’
  489 |         DECLARE_LIBBPF_OPTS(gen_loader_opts, opts);
      |         ^~~~~~~~~~~~~~~~~~~

gen.c:489:46: error: storage size of ‘opts’ isn’t known
489 | DECLARE_LIBBPF_OPTS(gen_loader_opts, opts);
| ^~~~
gen.c:494:15: warning: implicit declaration of function ‘bpf_object__gen_loader’; did you mean ‘bpf_object__unload’? [-Wimplicit-function-declaration]

  494 |         err = bpf_object__gen_loader(obj, &opts);
      |               ^~~~~~~~~~~~~~~~~~~~~~
      |               bpf_object__unload
gen.c:556:29: warning: implicit declaration of function ‘bpf_map__initial_value’; did you mean ‘bpf_map__set_initial_value’? [-Wimplicit-function-declaration]
  556 |                 mmap_data = bpf_map__initial_value(map, &mmap_size);
      |                             ^~~~~~~~~~~~~~~~~~~~~~
      |                             bpf_map__set_initial_value

gen.c:556:27: warning: assignment to ‘const void *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
556 | mmap_data = bpf_map__initial_value(map, &mmap_size);
| ^
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/gen.o] Error 1
make[2]: *** [Makefile.perf:1048: /tmp/build/perf/util/bpf_skel/.tmp/bootstrap/bpftool] Error 2 make[1]: *** [Makefile.perf:240: sub-make] Error 2
make: *** [Makefile:113: install-bin] Error 2
make: Leaving directory '/var/home/acme/git/perf/tools/perf'

Performance counter stats for 'make -k BUILD_BPF_SKEL=1 CORESIGHT=1 PYTHON=python3 O=/tmp/build/perf -C tools/perf install-bin':

          7,103.73 msec task-clock:u              #    1.476 CPUs utilized
          7,074.44 msec cpu-clock:u               #    1.469 CPUs utilized
       4.814384825 seconds time elapsed

       3.917534000 seconds user
       3.433976000 seconds sys

70: Event expansion for cgroups : Ok
88: perf all metricgroups test : FAILED!
⬢[acme@toolbox perf]$

Kinda expected, as its an old libbpf version, the one in fedora 34. I'll remove it, and try to fix it on the perf side, i.e. telling where to find bpf/bpf.h, bpf/libbpf.h.

- Arnaldo

#5 lore raw

Em Thu, Nov 04, 2021 at 05:15:20PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 49 lines

Em Thu, Nov 04, 2021 at 06:15:57PM +0000, Quentin Monnet escreveu:

Quoted 41 lines

2021-11-04 15:09 UTC-0300 ~ Arnaldo Carvalho de Melo <[email protected]>

Quoted 29 lines

Em Thu, Nov 04, 2021 at 10:47:12AM -0700, Andrii Nakryiko escreveu:

Quoted 4 lines · Arnaldo Carvalho de Melo

cc Quentin as well, might be related to recent Makefiles revamp for users of libbpf. But in bpf-next perf builds perfectly fine, so not sure.

This did the trick:

⬢[acme@toolbox perf]$ git show
commit 504afe6757ec646539ca3b4aa0431820e8c92b45 (HEAD -> perf/core)

Author: Arnaldo Carvalho de Melo <[email protected]>
Date:   Thu Nov 4 14:58:56 2021 -0300
    Revert "bpftool: Remove Makefile dep. on $(LIBBPF) for $(LIBBPF_INTERNAL_HDRS)"

    This reverts commit 8b6c46241c774c83998092a4eafe40f054568881.

    Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/bpf/bpftool/Makefile +1 -1
index c0c30e56988f2cbe..c5ad996ee95d4e87 100644
@@ -39,14 +39,14 @@ ifeq ($(BPFTOOL_VERSION),)
 BPFTOOL_VERSION := $(shell make -rR --no-print-directory -sC ../../.. kernelversion)
 endif
 
-$(LIBBPF_OUTPUT) $(BOOTSTRAP_OUTPUT) $(LIBBPF_BOOTSTRAP_OUTPUT) $(LIBBPF_HDRS_DIR):
+$(LIBBPF_OUTPUT) $(BOOTSTRAP_OUTPUT) $(LIBBPF_BOOTSTRAP_OUTPUT):

tools/bpf/bpftool/Makefile ifeq ($(BPFTOOL_VERSION),) · line 51

Quoted 10 lines
tools/bpf/bpftool/Makefile +1 -1
        $(QUIET_MKDIR)mkdir -p $@
 
 $(LIBBPF): $(wildcard $(BPF_DIR)/*.[ch] $(BPF_DIR)/Makefile) | $(LIBBPF_OUTPUT)
        $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIBBPF_OUTPUT) \
                DESTDIR=$(LIBBPF_DESTDIR) prefix= $(LIBBPF) install_headers
 
-$(LIBBPF_INTERNAL_HDRS): $(LIBBPF_HDRS_DIR)/%.h: $(BPF_DIR)/%.h | $(LIBBPF_HDRS_DIR)
+$(LIBBPF_INTERNAL_HDRS): $(LIBBPF_HDRS_DIR)/%.h: $(BPF_DIR)/%.h $(LIBBPF)
        $(call QUIET_INSTALL, $@)
        $(Q)install -m 644 -t $(LIBBPF_HDRS_DIR) $<
Quoted 6 lines

Interesting. I needed that patch because otherwise I'd get errors when compiling bpftool after the switch to libbpf's hashmap implementation. For the current breakage, it could be a matter of how we pass variables when descending into bpftool/ from perf's Makefile.perf. I'll try to look at this in details, and to experiment tonight, if I can. (Thanks Andrii for the CC!)

Quoted 2 lines

yeah, if we pass the location for those headers from the perf side, it should work.

But it isn't obvious how perf should communicate to bpftool where to find bpf/bpf.h for the bootstrap make target, which seems something bpftool should know.

Anyway, I'm calling it a day, will get back to this tomorrow, if you don't beat me to it.

- Arnaldo

#6 lore raw

2021-11-04 17:45 UTC-0300 ~ Arnaldo Carvalho de Melo <[email protected]>

Quoted 53 lines

Em Thu, Nov 04, 2021 at 05:15:20PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 49 lines

Em Thu, Nov 04, 2021 at 06:15:57PM +0000, Quentin Monnet escreveu:

Quoted 41 lines

2021-11-04 15:09 UTC-0300 ~ Arnaldo Carvalho de Melo <[email protected]>

Quoted 29 lines

Em Thu, Nov 04, 2021 at 10:47:12AM -0700, Andrii Nakryiko escreveu:

Quoted 4 lines · Arnaldo Carvalho de Melo

cc Quentin as well, might be related to recent Makefiles revamp for users of libbpf. But in bpf-next perf builds perfectly fine, so not sure.

This did the trick:

⬢[acme@toolbox perf]$ git show
commit 504afe6757ec646539ca3b4aa0431820e8c92b45 (HEAD -> perf/core)

Author: Arnaldo Carvalho de Melo <[email protected]>
Date:   Thu Nov 4 14:58:56 2021 -0300
    Revert "bpftool: Remove Makefile dep. on $(LIBBPF) for $(LIBBPF_INTERNAL_HDRS)"

    This reverts commit 8b6c46241c774c83998092a4eafe40f054568881.

    Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/bpf/bpftool/Makefile +1 -1
index c0c30e56988f2cbe..c5ad996ee95d4e87 100644
@@ -39,14 +39,14 @@ ifeq ($(BPFTOOL_VERSION),)
 BPFTOOL_VERSION := $(shell make -rR --no-print-directory -sC ../../.. kernelversion)
 endif
 
-$(LIBBPF_OUTPUT) $(BOOTSTRAP_OUTPUT) $(LIBBPF_BOOTSTRAP_OUTPUT) $(LIBBPF_HDRS_DIR):
+$(LIBBPF_OUTPUT) $(BOOTSTRAP_OUTPUT) $(LIBBPF_BOOTSTRAP_OUTPUT):

tools/bpf/bpftool/Makefile ifeq ($(BPFTOOL_VERSION),) · line 51

Quoted 10 lines
tools/bpf/bpftool/Makefile +1 -1
        $(QUIET_MKDIR)mkdir -p $@
 
 $(LIBBPF): $(wildcard $(BPF_DIR)/*.[ch] $(BPF_DIR)/Makefile) | $(LIBBPF_OUTPUT)
        $(Q)$(MAKE) -C $(BPF_DIR) OUTPUT=$(LIBBPF_OUTPUT) \
                DESTDIR=$(LIBBPF_DESTDIR) prefix= $(LIBBPF) install_headers
 
-$(LIBBPF_INTERNAL_HDRS): $(LIBBPF_HDRS_DIR)/%.h: $(BPF_DIR)/%.h | $(LIBBPF_HDRS_DIR)
+$(LIBBPF_INTERNAL_HDRS): $(LIBBPF_HDRS_DIR)/%.h: $(BPF_DIR)/%.h $(LIBBPF)
        $(call QUIET_INSTALL, $@)
        $(Q)install -m 644 -t $(LIBBPF_HDRS_DIR) $<
Quoted 6 lines

Interesting. I needed that patch because otherwise I'd get errors when compiling bpftool after the switch to libbpf's hashmap implementation. For the current breakage, it could be a matter of how we pass variables when descending into bpftool/ from perf's Makefile.perf. I'll try to look at this in details, and to experiment tonight, if I can. (Thanks Andrii for the CC!)

Quoted 2 lines

yeah, if we pass the location for those headers from the perf side, it should work.

Quoted 6 lines

But it isn't obvious how perf should communicate to bpftool where to find bpf/bpf.h for the bootstrap make target, which seems something bpftool should know.

Anyway, I'm calling it a day, will get back to this tomorrow, if you don't beat me to it.

Found it. The issue is on bpftool's side.

Background context: I've recently changed the way that bpftool (and other tools) include libbpf's headers: now they "install" the API headers locally, instead of including them directly from libbpf's source directory. Looks like I forgot perf's Makefile in the process by the way, I've sent a patch to address this (but this is not the cause of the breakage).

For bpftool, we need to build two versions of libbpf, the bootstrap version (for bootstrap bpftool) and the "regular" one. But I made the Makefile export the API headers from libbpf only once, for the "regular" build, and not for the bootstrap build. For bpftool it doesn't matter, because the bootstrap bpftool build always occurs after libbpf has been built and its headers have been exported.

For other tools relying on bootstrap bpftool only, like perf, this means that the libbpf headers are not installed. For some time, the build was still working, because the regular build for libbpf (with its export of the headers) was passed as a dependency to another step required by the bootstrap bpftool, such that the headers were (involuntarily) installed for bootstrap bpftool. This was changed in commit 8b6c46241c77, the one that you proposed to revert. That commit removes the dependency on the "regular" libbpf build for the bootstrap bpftool. It's cleaner, but it breaks the build for tools that just need boostrap bpftool.

Anyway. I just sent a fix, in which I propose to also install libbpf's headers for the bootstrap build.

Quentin

#7 lore raw
In reply to Andrii Nakryiko

Em Thu, Nov 04, 2021 at 10:47:12AM -0700, Andrii Nakryiko escreveu:

Quoted 5 lines · Arnaldo Carvalho de Melo

cc Quentin as well, might be related to recent Makefiles revamp for users of libbpf. But in bpf-next perf builds perfectly fine, so not sure.

You have to use:

make BUILD_BPF_SKEL=1 O=/tmp/build/perf -C tools/perf install-bin

Song, I think its time we make BUILD_BPF_SKEL=1 the default, wdyt?

- Arnaldo

Quoted 146 lines
Quoted 146 lines

I just did a merge with upstream and I'm getting this:

LINK /tmp/build/perf/plugins/plugin_scsi.so
INSTALL trace_plugins

Auto-detecting system features:

...                        libbfd: [ on  ]
...        disassembler-four-args: [ on  ]
...                          zlib: [ on  ]
...                        libcap: [ on  ]
...               clang-bpf-co-re: [ on  ]
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//libbpf//include/bpf
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/
  INSTALL /tmp/build/perf/util/bpf_skel/.tmp//libbpf//include/bpf/hashmap.h
  INSTALL /tmp/build/perf/util/bpf_skel/.tmp//libbpf//include/bpf/nlattr.h
  GEN     /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/bpf_helper_defs.h
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf_probes.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/xsk.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/bpf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/nlattr.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/btf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf_errno.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/hashmap.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/str_error.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/netlink.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/btf_dump.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/bpf_prog_linfo.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/ringbuf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/strset.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/linker.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/gen_loader.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/relo_core.o
  LD      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf-in.o
  LINK    /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/libbpf.a
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/main.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/common.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/gen.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/json_writer.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/xlated_dumper.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf_dumper.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/disasm.o
gen.c:15:10: fatal error: bpf/bpf.h: No such file or directory
   15 | #include <bpf/bpf.h>
      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/gen.o] Error 1 make[3]: *** Waiting for unfinished jobs....
xlated_dumper.c:10:10: fatal error: bpf/libbpf.h: No such file or directory
10 | #include <bpf/libbpf.h>

      |          ^~~~~~~~~~~~~~
compilation terminated.
btf.c:15:10: fatal error: bpf/bpf.h: No such file or directory
   15 | #include <bpf/bpf.h>
      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/xlated_dumper.o] Error 1 make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf.o] Error 1 main.c:12:10: fatal error: bpf/bpf.h: No such file or directory
12 | #include <bpf/bpf.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/main.o] Error 1 btf_dumper.c:12:10: fatal error: bpf/btf.h: No such file or directory
12 | #include <bpf/btf.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf_dumper.o] Error 1 common.c:24:10: fatal error: bpf/bpf.h: No such file or directory
24 | #include <bpf/bpf.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/common.o] Error 1 make[2]: *** [Makefile.perf:1048: /tmp/build/perf/util/bpf_skel/.tmp/bootstrap/bpftool] Error 2 make[1]: *** [Makefile.perf:240: sub-make] Error 2
make: *** [Makefile:113: install-bin] Error 2
make: Leaving directory '/var/home/acme/git/perf/tools/perf'

Performance counter stats for 'make -k BUILD_BPF_SKEL=1 CORESIGHT=1 PYTHON=python3 O=/tmp/build/perf -C tools/perf install-bin':

          6,965.78 msec task-clock:u              #    1.492 CPUs utilized
          6,937.93 msec cpu-clock:u               #    1.486 CPUs utilized
       4.669198336 seconds time elapsed

       4.015978000 seconds user
       3.202660000 seconds sys

70: Event expansion for cgroups : Ok
88: perf all metricgroups test : FAILED!
⬢[acme@toolbox perf]$ find tools/ -name bpf.h tools/include/uapi/linux/bpf.h tools/lib/bpf/bpf.h tools/perf/include/bpf/bpf.h ⬢[acme@toolbox perf]$ find tools/ -name libbpf.h tools/lib/bpf/libbpf.h
⬢[acme@toolbox perf]$ find tools/perf/ -name gen.c ⬢[acme@toolbox perf]$

Before the merge, with pristine sources I wasn't getting this, investigating now.

⬢[acme@toolbox perf]$ git show HEAD
commit e1498f18537a1639963370a4635c6fb99e7d672b (HEAD -> perf/core)
Merge: 32f7aa2731b24ad8 abfecb39092029c4
Author: Arnaldo Carvalho de Melo <[email protected]>
Date: Thu Nov 4 14:32:11 2021 -0300

Merge remote-tracking branch 'torvalds/master' into perf/core

To pick up some tools/perf/ patches that went via tip/perf/core, such as:

tools/perf: Add mem_hops field in perf_mem_data_src structure

⬢[acme@toolbox perf]$

⬢[acme@toolbox perf]$ git log --oneline -10 torvalds/master
abfecb39092029c4 (torvalds/master) Merge tag 'tty-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
95faf6ba654dd334 Merge tag 'driver-core-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
5c904c66ed4e86c3 Merge tag 'char-misc-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
5cd4dc44b8a0f656 Merge tag 'staging-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
048ff8629e117d84 Merge tag 'usb-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
7ddb58cb0ecae8e8 Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
ce840177930f591a Merge tag 'defconfig-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
d461e96cd22b5aeb Merge tag 'drivers-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
ae45d84fc36d01dc Merge tag 'dt-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
2219b0ceefe835b9 Merge tag 'soc-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
⬢[acme@toolbox perf]$

- Arnaldo

Signature · 1 line
- Arnaldo
#8 lore raw
In reply to Arnaldo Carvalho de Melo

Em Thu, Nov 04, 2021 at 02:37:57PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 7 lines

Hi Song,

I just did a merge with upstream and I'm getting this:

LINK /tmp/build/perf/plugins/plugin_scsi.so
INSTALL trace_plugins

To clarify, the command line to build perf that results in this problem is:

make -k BUILD_BPF_SKEL=1 CORESIGHT=1 PYTHON=python3 O=/tmp/build/perf -C tools/perf install-bin

Quoted 141 lines

Auto-detecting system features:

...                        libbfd: [ on  ]
...        disassembler-four-args: [ on  ]
...                          zlib: [ on  ]
...                        libcap: [ on  ]
...               clang-bpf-co-re: [ on  ]
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//libbpf//include/bpf
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/
  INSTALL /tmp/build/perf/util/bpf_skel/.tmp//libbpf//include/bpf/hashmap.h
  INSTALL /tmp/build/perf/util/bpf_skel/.tmp//libbpf//include/bpf/nlattr.h
  GEN     /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/bpf_helper_defs.h
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  MKDIR   /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf_probes.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/xsk.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/bpf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/nlattr.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/btf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf_errno.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/hashmap.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/str_error.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/netlink.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/btf_dump.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/bpf_prog_linfo.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/ringbuf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/strset.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/linker.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/gen_loader.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/relo_core.o
  LD      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/staticobjs/libbpf-in.o
  LINK    /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/libbpf/libbpf.a
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/main.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/common.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/gen.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/json_writer.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/xlated_dumper.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf_dumper.o
  CC      /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/disasm.o
gen.c:15:10: fatal error: bpf/bpf.h: No such file or directory
   15 | #include <bpf/bpf.h>
      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/gen.o] Error 1 make[3]: *** Waiting for unfinished jobs....
xlated_dumper.c:10:10: fatal error: bpf/libbpf.h: No such file or directory
10 | #include <bpf/libbpf.h>

      |          ^~~~~~~~~~~~~~
compilation terminated.
btf.c:15:10: fatal error: bpf/bpf.h: No such file or directory
   15 | #include <bpf/bpf.h>
      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/xlated_dumper.o] Error 1 make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf.o] Error 1 main.c:12:10: fatal error: bpf/bpf.h: No such file or directory
12 | #include <bpf/bpf.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/main.o] Error 1 btf_dumper.c:12:10: fatal error: bpf/btf.h: No such file or directory
12 | #include <bpf/btf.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/btf_dumper.o] Error 1 common.c:24:10: fatal error: bpf/bpf.h: No such file or directory
24 | #include <bpf/bpf.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:213: /tmp/build/perf/util/bpf_skel/.tmp//bootstrap/common.o] Error 1 make[2]: *** [Makefile.perf:1048: /tmp/build/perf/util/bpf_skel/.tmp/bootstrap/bpftool] Error 2 make[1]: *** [Makefile.perf:240: sub-make] Error 2
make: *** [Makefile:113: install-bin] Error 2
make: Leaving directory '/var/home/acme/git/perf/tools/perf'

Performance counter stats for 'make -k BUILD_BPF_SKEL=1 CORESIGHT=1 PYTHON=python3 O=/tmp/build/perf -C tools/perf install-bin':

          6,965.78 msec task-clock:u              #    1.492 CPUs utilized
          6,937.93 msec cpu-clock:u               #    1.486 CPUs utilized
       4.669198336 seconds time elapsed

       4.015978000 seconds user
       3.202660000 seconds sys

70: Event expansion for cgroups : Ok
88: perf all metricgroups test : FAILED!
⬢[acme@toolbox perf]$ find tools/ -name bpf.h tools/include/uapi/linux/bpf.h tools/lib/bpf/bpf.h tools/perf/include/bpf/bpf.h ⬢[acme@toolbox perf]$ find tools/ -name libbpf.h tools/lib/bpf/libbpf.h
⬢[acme@toolbox perf]$ find tools/perf/ -name gen.c ⬢[acme@toolbox perf]$

Before the merge, with pristine sources I wasn't getting this, investigating now.

⬢[acme@toolbox perf]$ git show HEAD
commit e1498f18537a1639963370a4635c6fb99e7d672b (HEAD -> perf/core)
Merge: 32f7aa2731b24ad8 abfecb39092029c4
Author: Arnaldo Carvalho de Melo <[email protected]>
Date: Thu Nov 4 14:32:11 2021 -0300

Merge remote-tracking branch 'torvalds/master' into perf/core

To pick up some tools/perf/ patches that went via tip/perf/core, such as:

tools/perf: Add mem_hops field in perf_mem_data_src structure

⬢[acme@toolbox perf]$

⬢[acme@toolbox perf]$ git log --oneline -10 torvalds/master
abfecb39092029c4 (torvalds/master) Merge tag 'tty-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
95faf6ba654dd334 Merge tag 'driver-core-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
5c904c66ed4e86c3 Merge tag 'char-misc-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
5cd4dc44b8a0f656 Merge tag 'staging-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
048ff8629e117d84 Merge tag 'usb-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
7ddb58cb0ecae8e8 Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
ce840177930f591a Merge tag 'defconfig-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
d461e96cd22b5aeb Merge tag 'drivers-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
ae45d84fc36d01dc Merge tag 'dt-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
2219b0ceefe835b9 Merge tag 'soc-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
⬢[acme@toolbox perf]$

- Arnaldo

Signature · 1 line
- Arnaldo
#9 lore raw
Quoted 7 lines · Arnaldo Carvalho de Melo

Em Thu, Nov 04, 2021 at 02:37:57PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 5 lines

Hi Song,

I just did a merge with upstream and I'm getting this:

Quoted 7 lines
Quoted 2 lines

LINK /tmp/build/perf/plugins/plugin_scsi.so
INSTALL trace_plugins

To clarify, the command line to build perf that results in this problem is:

make -k BUILD_BPF_SKEL=1 CORESIGHT=1 PYTHON=python3 O=/tmp/build/perf -C tools/perf install-bin

Oh, I dropped CORESIGN and left BUILD_BPF_SKEL=1 and yeah, I see the build failure. I do think now that it's related to the recent Makefile revamp effort. Quentin, PTAL.

On the side note, why BUILD_BPF_SKEL=1 is not a default, we might have caught this sooner. Is there any reason not to flip the default?

Quoted 9 lines
Quoted 9 lines

Auto-detecting system features:

...                        libbfd: [ on  ]
...        disassembler-four-args: [ on  ]
...                          zlib: [ on  ]
...                        libcap: [ on  ]
...               clang-bpf-co-re: [ on  ]

[...]

#10 lore raw

Em Thu, Nov 04, 2021 at 10:56:26AM -0700, Andrii Nakryiko escreveu:

Quoted 14 lines · Arnaldo Carvalho de Melo
Quoted 13 lines

Em Thu, Nov 04, 2021 at 02:37:57PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 7 lines

Hi Song,

I just did a merge with upstream and I'm getting this:

LINK /tmp/build/perf/plugins/plugin_scsi.so
INSTALL trace_plugins

To clarify, the command line to build perf that results in this problem is:

Quoted 8 lines
Quoted 1 line

make -k BUILD_BPF_SKEL=1 CORESIGHT=1 PYTHON=python3 O=/tmp/build/perf -C tools/perf install-bin

Oh, I dropped CORESIGN and left BUILD_BPF_SKEL=1 and yeah, I see the build failure. I do think now that it's related to the recent Makefile revamp effort. Quentin, PTAL.

On the side note, why BUILD_BPF_SKEL=1 is not a default, we might have caught this sooner. Is there any reason not to flip the default?

I asked Song in the past about this, and asked again on another reply to this thread, I think it should be the default.

Song, Namhyung? You're the skel guys (so far) :-)

- Arnaldo

#11 lore raw
Quoted 25 lines · Arnaldo Carvalho de Melo

Em Thu, Nov 04, 2021 at 10:56:26AM -0700, Andrii Nakryiko escreveu:

Quoted 20 lines · Arnaldo Carvalho de Melo
Quoted 7 lines

Em Thu, Nov 04, 2021 at 02:37:57PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 5 lines

Hi Song,

I just did a merge with upstream and I'm getting this:

Quoted 7 lines
Quoted 2 lines

LINK /tmp/build/perf/plugins/plugin_scsi.so
INSTALL trace_plugins

To clarify, the command line to build perf that results in this problem is:

make -k BUILD_BPF_SKEL=1 CORESIGHT=1 PYTHON=python3 O=/tmp/build/perf -C tools/perf install-bin

Oh, I dropped CORESIGN and left BUILD_BPF_SKEL=1 and yeah, I see the build failure. I do think now that it's related to the recent Makefile revamp effort. Quentin, PTAL.

Quoted 7 lines
Quoted 2 lines

On the side note, why BUILD_BPF_SKEL=1 is not a default, we might have caught this sooner. Is there any reason not to flip the default?

I asked Song in the past about this, and asked again on another reply to this thread, I think it should be the default.

Song, Namhyung? You're the skel guys (so far) :-)

Yeah, let's make it default.

Song

#12 lore raw

Hello,

Quoted 29 lines · Song Liu
Quoted 29 lines · Arnaldo Carvalho de Melo

Em Thu, Nov 04, 2021 at 10:56:26AM -0700, Andrii Nakryiko escreveu:

Quoted 22 lines · Arnaldo Carvalho de Melo
Quoted 7 lines

Em Thu, Nov 04, 2021 at 02:37:57PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 5 lines

Hi Song,

I just did a merge with upstream and I'm getting this:

Quoted 7 lines
Quoted 2 lines

LINK /tmp/build/perf/plugins/plugin_scsi.so
INSTALL trace_plugins

To clarify, the command line to build perf that results in this problem is:

make -k BUILD_BPF_SKEL=1 CORESIGHT=1 PYTHON=python3 O=/tmp/build/perf -C tools/perf install-bin

Oh, I dropped CORESIGN and left BUILD_BPF_SKEL=1 and yeah, I see the build failure. I do think now that it's related to the recent Makefile revamp effort. Quentin, PTAL.

On the side note, why BUILD_BPF_SKEL=1 is not a default, we might have caught this sooner. Is there any reason not to flip the default?

Quoted 6 lines
Quoted 4 lines

I asked Song in the past about this, and asked again on another reply to this thread, I think it should be the default.

Song, Namhyung? You're the skel guys (so far) :-)

Yeah, let's make it default.

Then it'd require 'clang' for the perf build. Maybe we can check the availability of the compiler and disable it back if not.

Thanks,
Namhyung

#13 lore raw

Em Thu, Nov 04, 2021 at 01:33:20PM -0700, Namhyung Kim escreveu:

Quoted 9 lines · Song Liu
Quoted 7 lines
Quoted 7 lines · Arnaldo Carvalho de Melo

Em Thu, Nov 04, 2021 at 10:56:26AM -0700, Andrii Nakryiko escreveu:

Quoted 2 lines

On the side note, why BUILD_BPF_SKEL=1 is not a default, we might have caught this sooner. Is there any reason not to flip the default?

I asked Song in the past about this, and asked again on another reply to this thread, I think it should be the default.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Song, Namhyung? You're the skel guys (so far) :-)

Yeah, let's make it default.

Then it'd require 'clang' for the perf build. Maybe we can check the availability of the compiler and disable it back if not.

Right, an extra feature check.

- Arnaldo