perf bpf: Check that the minimal vmlinux.h installed is the latest one
Arnaldo Carvalho de Melo
maintainerPATCH 1/1 perf bpf: Check that the minimal vmlinux.h installed is the latest one
When building BPF skels perf will, by default, install a minimalistic vmlinux.h file with the types needed by the BPF skels in tools/perf/util/bpf_skel/ in its build directory.
When 29d16de26df17e94 ("perf augmented_raw_syscalls.bpf: Move 'struct timespec64' to vmlinux.h") was added, a type used in the augmented_raw_syscalls BPF skel, 'struct timespec64' was not found when building from a pre-existing build directory, because the vmlinux.h there didn't contain that type, ending up with this error, spotted in linux-next:
CLANG /tmp/build/perf-tools-next/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o
util/bpf_skel/augmented_raw_syscalls.bpf.c:329:15: error: invalid application of 'sizeof' to an incomplete type 'struct timespec64'
329 | __u32 size = sizeof(struct timespec64);
| ^ ~~~~~~~~~~~~~~~~~~~
util/bpf_skel/augmented_raw_syscalls.bpf.c:329:29: note: forward declaration of 'struct timespec64'
329 | __u32 size = sizeof(struct timespec64);
| ^
util/bpf_skel/augmented_raw_syscalls.bpf.c:350:15: error: invalid application of 'sizeof' to an incomplete type 'struct timespec64'
350 | __u32 size = sizeof(struct timespec64);
| ^ ~~~~~~~~~~~~~~~~~~~
util/bpf_skel/augmented_raw_syscalls.bpf.c:350:29: note: forward declaration of 'struct timespec64'
350 | __u32 size = sizeof(struct timespec64);
| ^ 2 errors generated.
make[2]: *** [Makefile.perf:1158: /tmp/build/perf-tools-next/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o] Error 1 make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile.perf:261: sub-make] Error 2
make: *** [Makefile:113: install-bin] Error 2
make: Leaving directory '/home/acme/git/perf-tools-next/tools/perf'
So add a Makefile dependency (Namhyung's suggestion) to make sure that the new tools/perf/util/bpf_skel/vmlinux/vmlinux.h minimal vmlinux is updated in the build directory, providing the moved 'struct timespec64' type.
--- tools/perf/Makefile.perf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile.perf +1 -1
@@ -1147,7 +1147,7 @@ ifeq ($(VMLINUX_H),) endif endif -$(SKEL_OUT)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL) +$(SKEL_OUT)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL) $(VMLINUX_H) ifeq ($(VMLINUX_H),) $(QUIET_GEN)$(BPFTOOL) btf dump file $< format c > $@ else
Signature · 1 line
2.43.0
Quoted 36 lines · Arnaldo Carvalho de Melo
When building BPF skels perf will, by default, install a minimalistic
vmlinux.hfile with the types needed by the BPF skels intools/perf/util/bpf_skel/in its build directory.When
29d16de26df17e94("perf augmented_raw_syscalls.bpf: Move 'struct timespec64' tovmlinux.h") was added, a type used in theaugmented_raw_syscallsBPF skel, 'struct timespec64' was not found when building from a pre-existing build directory, because thevmlinux.hthere didn't contain that type, ending up with this error, spotted in linux-next:CLANG
/tmp/build/perf-tools-next/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o
util/bpf_skel/augmented_raw_syscalls.bpf.c:329:15: error: invalid application of 'sizeof' to an incomplete type 'struct timespec64'329 | __u32 size = sizeof(struct timespec64); | ^ ~~~~~~~~~~~~~~~~~~~ util/bpf_skel/augmented_raw_syscalls.bpf.c:329:29: note: forward declaration of 'struct timespec64' 329 | __u32 size = sizeof(struct timespec64); | ^ util/bpf_skel/augmented_raw_syscalls.bpf.c:350:15: error: invalid application of 'sizeof' to an incomplete type 'struct timespec64' 350 | __u32 size = sizeof(struct timespec64); | ^ ~~~~~~~~~~~~~~~~~~~ util/bpf_skel/augmented_raw_syscalls.bpf.c:350:29: note: forward declaration of 'struct timespec64' 350 | __u32 size = sizeof(struct timespec64); | ^2 errors generated.
make[2]: *** [Makefile.perf:1158:/tmp/build/perf-tools-next/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o] Error 1 make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile.perf:261: sub-make] Error 2
make: *** [Makefile:113: install-bin] Error 2
make: Leaving directory '/home/acme/git/perf-tools-next/tools/perf'So add a
Makefiledependency (Namhyung's suggestion) to make sure that the newtools/perf/util/bpf_skel/vmlinux/vmlinux.hminimal vmlinux is updated in the build directory, providing the moved 'struct timespec64' type.
Quoted 6 lines
Fixes 29d16de26df17e94 ("perf augmented_raw_syscalls.bpf: Move 'struct timespec64' to vmlinux.h")Cc Ian Rogers <[email protected]>Cc Namhyung Kim <[email protected]>Reported-by Stephen Rothwell <[email protected]>Link https://lore.kernel.org/lkml/CAM9d7ciaj80QZL0AS_T2HNBdMOyS-j1wBHQSYs=U3kHQimY1mQ@mail.gmail.com open hereSigned-off-by Arnaldo Carvalho de Melo <[email protected]>
Thanks,
Ian
Quoted 20 lines
--- tools/perf/Makefile.perf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/Makefile.perf +1
-2@@ -1147,7 +1147,7 @@ ifeq ($(VMLINUX_H),) endif endif -$(SKEL_OUT)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL) +$(SKEL_OUT)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL) $(VMLINUX_H) ifeq ($(VMLINUX_H),) $(QUIET_GEN)$(BPFTOOL) btf dump file $< format c > $@ else --2.43.0
Namhyung Kim
maintainerQuoted 39 lines · Ian Rogers
Quoted 36 lines · Arnaldo Carvalho de Melo
When building BPF skels perf will, by default, install a minimalistic
vmlinux.hfile with the types needed by the BPF skels intools/perf/util/bpf_skel/in its build directory.When
29d16de26df17e94("perf augmented_raw_syscalls.bpf: Move 'struct timespec64' tovmlinux.h") was added, a type used in theaugmented_raw_syscallsBPF skel, 'struct timespec64' was not found when building from a pre-existing build directory, because thevmlinux.hthere didn't contain that type, ending up with this error, spotted in linux-next:CLANG
/tmp/build/perf-tools-next/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o
util/bpf_skel/augmented_raw_syscalls.bpf.c:329:15: error: invalid application of 'sizeof' to an incomplete type 'struct timespec64'329 | __u32 size = sizeof(struct timespec64); | ^ ~~~~~~~~~~~~~~~~~~~ util/bpf_skel/augmented_raw_syscalls.bpf.c:329:29: note: forward declaration of 'struct timespec64' 329 | __u32 size = sizeof(struct timespec64); | ^ util/bpf_skel/augmented_raw_syscalls.bpf.c:350:15: error: invalid application of 'sizeof' to an incomplete type 'struct timespec64' 350 | __u32 size = sizeof(struct timespec64); | ^ ~~~~~~~~~~~~~~~~~~~ util/bpf_skel/augmented_raw_syscalls.bpf.c:350:29: note: forward declaration of 'struct timespec64' 350 | __u32 size = sizeof(struct timespec64); | ^2 errors generated.
make[2]: *** [Makefile.perf:1158:/tmp/build/perf-tools-next/util/bpf_skel/.tmp/augmented_raw_syscalls.bpf.o] Error 1 make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile.perf:261: sub-make] Error 2
make: *** [Makefile:113: install-bin] Error 2
make: Leaving directory '/home/acme/git/perf-tools-next/tools/perf'So add a
Makefiledependency (Namhyung's suggestion) to make sure that the newtools/perf/util/bpf_skel/vmlinux/vmlinux.hminimal vmlinux is updated in the build directory, providing the moved 'struct timespec64' type.
Quoted 8 lines
Quoted 6 lines
Fixes 29d16de26df17e94 ("perf augmented_raw_syscalls.bpf: Move 'struct timespec64' to vmlinux.h")Cc Ian Rogers <[email protected]>Cc Namhyung Kim <[email protected]>Reported-by Stephen Rothwell <[email protected]>Link https://lore.kernel.org/lkml/CAM9d7ciaj80QZL0AS_T2HNBdMOyS-j1wBHQSYs=U3kHQimY1mQ@mail.gmail.com open hereSigned-off-by Arnaldo Carvalho de Melo <[email protected]>Reviewed-by Ian Rogers <[email protected]>
Thanks,
Namhyung
Quoted 11 lines · Arnaldo Carvalho de Melo
When building BPF skels perf will, by default, install a minimalistic
vmlinux.hfile with the types needed by the BPF skels intools/perf/util/bpf_skel/in its build directory.When
29d16de26df17e94("perf augmented_raw_syscalls.bpf: Move 'struct timespec64' tovmlinux.h") was added, a type used in theaugmented_raw_syscallsBPF skel, 'struct timespec64' was not found when building from a pre-existing build directory, because thevmlinux.hthere didn't contain that type, ending up with this error, spotted in linux-next:[...]
Applied to perf-tools-next, thanks!
Best regards,
Signature · 1 line
Namhyung Kim <[email protected]>