perf augmented_raw_syscalls.bpf: Move 'struct timespec64' to vmlinux.h
Arnaldo Carvalho de Melo
maintainerPATCH v2 1/1 perf augmented_raw_syscalls.bpf: Move 'struct timespec64' to vmlinux.h
If we instead decide to generate vmlinux.h from BTF info, it will be there:
$ pahole timespec64
struct timespec64 {
time64_t tv_sec; /* 0 8 */
long int tv_nsec; /* 8 8 *//* size: 16, cachelines: 1, members: 2 */ /* last cacheline: 16 bytes */ };
$
pahole manages to find it from /sys/kernel/btf/vmlinux, that is generated from the kernel types.
With this linux/bpf.h doesn't need to be included, as its already in the minimalistic tools/perf/util/bpf_skel/vmlinux/vmlinux.h file or what we need comes when generating a vmlinux.h file from BTF info, i.e. when using GEN_VMLINUX_H=1, as noticed by Namyung in a build break before removing linux/bpf.h.
---
v2: Remove linux/bpf.h as explained in the commit log message.
--- .../util/bpf_skel/augmented_raw_syscalls.bpf.c | 15 +-------------- tools/perf/util/bpf_skel/vmlinux/vmlinux.h | 7 +++++++ 2 files changed, 8 insertions(+), 14 deletions(-)
tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c +1 -14
@@ -6,7 +6,7 @@* payload expected by the 'perf trace' beautifiers. */ -#include <linux/bpf.h> +#include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <linux/limits.h>
@@ -22,19 +22,6 @@#define MAX_CPUS 4096 -// FIXME: These should come from system headers -#ifndef bool -typedef char bool ; -#endif -typedef int pid_t ; -typedef long long int __s64 ; -typedef __s64 time64_t ; - -struct timespec64 { -time64_t tv_sec; -long int tv_nsec; -}; -/* bpf-output associated map */ struct __augmented_syscalls__ { __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
tools/perf/util/bpf_skel/vmlinux/vmlinux.h +7 -0
@@ -20,6 +20,13 @@ typedef __s64 s64;typedef int pid_t ; +typedef __s64 time64_t ; + +struct timespec64 { +time64_t tv_sec; +long int tv_nsec; +}; +enum cgroup_subsys_id { perf_event_cgrp_id =8 , };
Signature · 1 line
2.43.0
Quoted 9 lines · Arnaldo Carvalho de Melo
If we instead decide to generate
vmlinux.hfrom BTF info, it will be there:$ pahole timespec64 struct timespec64 { time64_t tv_sec; /* 0 8 */ long int tv_nsec; /* 8 8 */[...]
Applied to perf-tools-next, thanks!
Best regards,
Signature · 1 line
Namhyung Kim <[email protected]>