perf augmented_raw_syscalls.bpf: Move 'struct timespec64' to vmlinux.h
authorArnaldo Carvalho de Melo <acme@kernel.org>
Fri, 16 Feb 2024 22:20:23 +0000 (19:20 -0300)
committerNamhyung Kim <namhyung@kernel.org>
Fri, 16 Feb 2024 23:19:57 +0000 (15:19 -0800)
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.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/Zc_fp6CgDClPhS_O@x1
tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
tools/perf/util/bpf_skel/vmlinux/vmlinux.h

index 52c270330ae0d2f362aad1fa71f5ad5cc3c0b824..2872f9bc07850bd7ed34336d61c38fa7c485e84b 100644 (file)
@@ -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>
 
 
 #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);
index ab84a6e1da5eedb3f6877c0f83212cba3c55c1e4..e9028235d7717b59dcab75014dba7a6c16022760 100644 (file)
@@ -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,
 };