[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7ch6tvwMgdOg=1hZqE23bQUKDtYOdyJ16kkyt+6uY4q7pw@mail.gmail.com>
Date: Fri, 2 Feb 2024 18:01:16 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Adrian Hunter <adrian.hunter@...el.com>, Ian Rogers <irogers@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] perf augmented_raw_syscalls.bpf: Move 'struct
timespec64' to vmlinux.h
On Fri, Feb 2, 2024 at 11:35 AM Arnaldo Carvalho de Melo
<acme@...nel.org> wrote:
>
> 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.
>
> Cc: Adrian Hunter <adrian.hunter@...el.com>
> Cc: Ian Rogers <irogers@...gle.com>
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Link: https://lore.kernel.org/lkml/
> Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Acked-by: Namhyung Kim <namhyung@...nel.org>
Thanks,
Namhyung
> ---
> .../util/bpf_skel/augmented_raw_syscalls.bpf.c | 14 +-------------
> tools/perf/util/bpf_skel/vmlinux/vmlinux.h | 7 +++++++
> 2 files changed, 8 insertions(+), 13 deletions(-)
>
> diff --git a/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c b/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
> index baecffbece14fb68..d3b672593c540259 100644
> --- a/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
> +++ b/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
> @@ -6,6 +6,7 @@
> * payload expected by the 'perf trace' beautifiers.
> */
>
> +#include "vmlinux.h"
> #include <linux/bpf.h>
> #include <bpf/bpf_helpers.h>
> #include <linux/limits.h>
> @@ -22,19 +23,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);
> diff --git a/tools/perf/util/bpf_skel/vmlinux/vmlinux.h b/tools/perf/util/bpf_skel/vmlinux/vmlinux.h
> index ab84a6e1da5eedb3..e9028235d7717b59 100644
> --- a/tools/perf/util/bpf_skel/vmlinux/vmlinux.h
> +++ b/tools/perf/util/bpf_skel/vmlinux/vmlinux.h
> @@ -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,
> };
> --
> 2.43.0
>
Powered by blists - more mailing lists