[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH0uvoigqSHEcC0+BUkdGMq5ODhJXh_JSjNB0d+-mf2UUkYfzQ@mail.gmail.com>
Date: Fri, 23 Aug 2024 12:09:43 +0800
From: Howard Chu <howardchu95@...il.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: adrian.hunter@...el.com, irogers@...gle.com, jolsa@...nel.org,
kan.liang@...ux.intel.com, namhyung@...nel.org,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 03/10] perf trace: Add trace__bpf_sys_enter_beauty_map()
to prepare for fetching data in BPF
On Fri, Aug 23, 2024 at 5:09 AM Arnaldo Carvalho de Melo
<acme@...nel.org> wrote:
>
> On Thu, Aug 22, 2024 at 02:53:22PM -0300, Arnaldo Carvalho de Melo wrote:
> > On Thu, Aug 22, 2024 at 02:49:41PM -0300, Arnaldo Carvalho de Melo wrote:
> > > On Thu, Aug 15, 2024 at 09:36:19AM +0800, Howard Chu wrote:
> > > > @@ -3624,7 +3719,9 @@ static int trace__init_syscalls_bpf_prog_array_maps(struct trace *trace)
> > > > {
> > > > int map_enter_fd = bpf_map__fd(trace->skel->maps.syscalls_sys_enter);
> > > > int map_exit_fd = bpf_map__fd(trace->skel->maps.syscalls_sys_exit);
> > > > + int beauty_map_fd = bpf_map__fd(trace->skel->maps.beauty_map_enter);
> >
> > > At this point we still don't have that, right? I.e. building with this
> > > patch, without the ones following it in your series, I get:
> >
> > > builtin-trace.c: In function ‘trace__init_syscalls_bpf_prog_array_maps’:
> > > builtin-trace.c:3723:58: error: ‘struct <anonymous>’ has no member named ‘beauty_map_enter’
> > > 3723 | int beauty_map_fd = bpf_map__fd(trace->skel->maps.beauty_map_enter);
> > > | ^
> > > CC /tmp/build/perf-tools-next/tests/code-reading.o
> > > CC /tmp/build/perf-tools-next/trace/beauty/clone.o
> > > make[3]: *** [/home/acme/git/perf-tools-next/tools/build/Makefile.build:105: /tmp/build/perf-tools-next/builtin-trace.o] Error 1
> > > make[3]: *** Waiting for unfinished jobs....
> > >
> > > So we need to squash the patch that introduces beauty_map_enter in the
> > > augmented_raw_syscalls.bpf.c file to this one, so that we keep things
> > > bisectable, I'll try to do that.
> >
> > So just this did the trick, I'll remove it from the later patch in your
> > series:
Okay, making every patch buildable on their own, I see, didn't know
that's the rule, sorry (separating hunks is a little too hard for me).
Will do that in the future.
>
> But then you added syscall_arg_fmt__cache_btf_struct() ifdef'ed by
> HAVE_LIBBPF_SUPPORT to then use it on trace__bpf_sys_enter_beauty_map())
> that is ifdef'ed by HAVE_BPF_SKEL, so when building with
> BUILD_BPF_SKEL=0 we get this splat:
>
> CC /tmp/build/perf-tools-next/builtin-trace.o
> AR /tmp/build/perf-tools-next/libperf-util.a
> builtin-trace.c:930:12: error: ‘syscall_arg_fmt__cache_btf_struct’ defined but not used [-Werror=unused-function]
> 930 | static int syscall_arg_fmt__cache_btf_struct(struct syscall_arg_fmt *arg_fmt, struct btf *btf, char *type)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> GEN /tmp/build/perf-tools-next/python/perf.cpython-312-x86_64-linux-gnu.so
> cc1: all warnings being treated as errors
> make[3]: *** [/home/acme/git/perf-tools-next/tools/build/Makefile.build:105: /tmp/build/perf-tools-next/builtin-trace.o] Error 1
> make[2]: *** [Makefile.perf:762: /tmp/build/perf-tools-next/perf-in.o] Error 2
> make[1]: *** [Makefile.perf:292: sub-make] Error 2
> make: *** [Makefile:119: install-bin] Error 2
> make: Leaving directory '/home/acme/git/perf-tools-next/tools/perf'
> ⬢[acme@...lbox perf-tools-next]$
>
> I'm moving syscall_arg_fmt__cache_btf_struct() to the same block where
> trace__bpf_sys_enter_beauty_map() is.
Yes exactly, I did it in my branch as well.
Thanks,
Howard
>
> > - Arnaldo
> >
> > 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 0acbd74e8c760956..c885673f416dff39 100644
> > --- a/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
> > +++ b/tools/perf/util/bpf_skel/augmented_raw_syscalls.bpf.c
> > @@ -79,6 +79,13 @@ struct pids_filtered {
> > __uint(max_entries, 64);
> > } pids_filtered SEC(".maps");
> >
> > +struct beauty_map_enter {
> > + __uint(type, BPF_MAP_TYPE_HASH);
> > + __type(key, int);
> > + __type(value, __u32[6]);
> > + __uint(max_entries, 512);
> > +} beauty_map_enter SEC(".maps");
> > +
> > /*
> > * Desired design of maximum size and alignment (see RFC2553)
> > */
Powered by blists - more mailing lists