Re: [External] Re: [PATCH bpf-next 0/5] bpf: make tracing program support multi-attach

2024-02-20 Thread
Hello, On Wed, Feb 21, 2024 at 9:24 AM Alexei Starovoitov wrote: > > On Mon, Feb 19, 2024 at 7:51 PM Menglong Dong > wrote: > > > > For now, the BPF program of type BPF_PROG_TYPE_TRACING is not allowed to > > be attached to multiple hooks, and we have to create a BPF program for > > each kernel

Re: [External] Re: [PATCH bpf-next 0/5] bpf: make tracing program support multi-attach

2024-02-20 Thread
On Wed, Feb 21, 2024 at 10:35 AM 梦龙董 wrote: > > Hello, > > On Wed, Feb 21, 2024 at 9:24 AM Alexei Starovoitov > wrote: > > > > On Mon, Feb 19, 2024 at 7:51 PM Menglong Dong > > wrote: > > > > > > For now, the BPF program of type BPF_PROG_

Re: [External] Re: [PATCH bpf-next 1/5] bpf: tracing: add support to record and check the accessed args

2024-02-20 Thread
On Wed, Feb 21, 2024 at 1:18 AM Jiri Olsa wrote: > > On Tue, Feb 20, 2024 at 11:51:01AM +0800, Menglong Dong wrote: > > SNIP > > > +static int get_ctx_arg_idx_aligned(struct btf *btf, const struct btf_type > > *t, > > +int off) > > +{ > > + const struct btf_par

Re: [External] Re: [PATCH bpf-next 0/5] bpf: make tracing program support multi-attach

2024-02-20 Thread
On Wed, Feb 21, 2024 at 11:02 AM Alexei Starovoitov wrote: > > On Tue, Feb 20, 2024 at 6:45 PM 梦龙董 wrote: > > > > On Wed, Feb 21, 2024 at 10:35 AM 梦龙董 wrote: > > > > > > Hello, > > > > > > On Wed, Feb 21, 2024 at 9:24 AM Alexei Starovoitov &

Re: [External] Re: [PATCH bpf-next 1/5] bpf: tracing: add support to record and check the accessed args

2024-02-20 Thread
On Wed, Feb 21, 2024 at 2:22 AM Kui-Feng Lee wrote: > > > > On 2/19/24 19:51, Menglong Dong wrote: > > In this commit, we add the 'accessed_args' field to struct bpf_prog_aux, > > which is used to record the accessed index of the function args in > > btf_ctx_access(). > > > > Meanwhile, we add the

Re: [External] Re: [PATCH bpf-next 0/5] bpf: make tracing program support multi-attach

2024-02-20 Thread
On Wed, Feb 21, 2024 at 11:18 AM Alexei Starovoitov wrote: > > On Tue, Feb 20, 2024 at 7:06 PM 梦龙董 wrote: > > > > On Wed, Feb 21, 2024 at 11:02 AM Alexei Starovoitov > > wrote: > > > > > > On Tue, Feb 20, 2024 at 6:45 PM 梦龙董 wrote: > >

Re: [External] Re: [PATCH bpf-next v2 8/9] libbpf: add support for the multi-link of tracing

2024-03-11 Thread
On Mon, Mar 11, 2024 at 11:29 PM Quentin Monnet wrote: > > 2024-03-11 09:35 UTC+ ~ Menglong Dong > > Add support for the attach types of: > > > > BPF_TRACE_FENTRY_MULTI > > BPF_TRACE_FEXIT_MULTI > > BPF_MODIFY_RETURN_MULTI > > > > Signed-off-by: Menglong Dong > > --- > > tools/bpf/bpftool/c

Re: [External] Re: [PATCH bpf-next v2 2/9] bpf: refactor the modules_array to ptr_array

2024-03-11 Thread
On Tue, Mar 12, 2024 at 9:49 AM Alexei Starovoitov wrote: > > On Mon, Mar 11, 2024 at 2:34 AM Menglong Dong > wrote: > > > > Refactor the struct modules_array to more general struct ptr_array, which > > is used to store the pointers. > > > > Meanwhiles, introduce the bpf_try_add_ptr(), which chec

Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args

2024-03-11 Thread
On Tue, Mar 12, 2024 at 9:46 AM Alexei Starovoitov wrote: > > On Mon, Mar 11, 2024 at 2:34 AM Menglong Dong > wrote: > > > > In this commit, we add the 'accessed_args' field to struct bpf_prog_aux, > > which is used to record the accessed index of the function args in > > btf_ctx_access(). > > >

Re: [External] Re: [PATCH bpf-next v2 7/9] libbpf: don't free btf if program of multi-link tracing existing

2024-03-11 Thread
On Tue, Mar 12, 2024 at 9:55 AM Alexei Starovoitov wrote: > > On Mon, Mar 11, 2024 at 2:35 AM Menglong Dong > wrote: > > > > By default, the kernel btf that we load during loading program will be > > freed after the programs are loaded in bpf_object_load(). However, we > > still need to use these

Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args

2024-03-11 Thread
On Tue, Mar 12, 2024 at 10:09 AM Alexei Starovoitov wrote: > > On Mon, Mar 11, 2024 at 7:01 PM 梦龙董 wrote: > > > > On Tue, Mar 12, 2024 at 9:46 AM Alexei Starovoitov > > wrote: > > > > > > On Mon, Mar 11, 2024 at 2:34 AM Menglong Dong > > >

Re: [External] Re: [PATCH bpf-next v2 8/9] libbpf: add support for the multi-link of tracing

2024-03-11 Thread
On Tue, Mar 12, 2024 at 9:56 AM Alexei Starovoitov wrote: > > On Mon, Mar 11, 2024 at 2:35 AM Menglong Dong > wrote: > > > > > > - err = libbpf_find_attach_btf_id(prog, attach_name, > > &btf_obj_fd, &btf_type_id); > > + name_end = strchr(attach_name, ','); > > +

Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args

2024-03-11 Thread
On Tue, Mar 12, 2024 at 10:42 AM 梦龙董 wrote: > > On Tue, Mar 12, 2024 at 10:09 AM Alexei Starovoitov > wrote: > > > > On Mon, Mar 11, 2024 at 7:01 PM 梦龙董 wrote: > > > > > > On Tue, Mar 12, 2024 at 9:46 AM Alexei Starovoitov > > > wrote: > >

Re: [External] Re: [PATCH bpf-next v2 7/9] libbpf: don't free btf if program of multi-link tracing existing

2024-03-11 Thread
On Tue, Mar 12, 2024 at 10:13 AM Alexei Starovoitov wrote: > > On Mon, Mar 11, 2024 at 7:05 PM 梦龙董 wrote: > > > > > > > > > > +LIBBPF_API void bpf_object__free_btfs(struct bpf_object *obj); > > > > + > > > > > > It shouldn'

Re: [External] Re: [PATCH bpf-next v2 5/9] bpf: verifier: add btf to the function args of bpf_check_attach_target

2024-03-11 Thread
On Tue, Mar 12, 2024 at 9:51 AM Alexei Starovoitov wrote: > > On Mon, Mar 11, 2024 at 2:35 AM Menglong Dong > wrote: > > > > Add target btf to the function args of bpf_check_attach_target(), then > > the caller can specify the btf to check. > > > > Signed-off-by: Menglong Dong > > --- > > inclu

Re: [External] Re: [PATCH bpf-next v2 8/9] libbpf: add support for the multi-link of tracing

2024-03-12 Thread
On Wed, Mar 13, 2024 at 12:12 AM Alexei Starovoitov wrote: > > On Mon, Mar 11, 2024 at 7:44 PM 梦龙董 wrote: > > > > On Tue, Mar 12, 2024 at 9:56 AM Alexei Starovoitov > > wrote: > > > > > > On Mon, Mar 11, 2024 at 2:35 AM Menglong Dong > > >

Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args

2024-03-12 Thread
On Wed, Mar 13, 2024 at 12:42 AM Alexei Starovoitov wrote: > > On Mon, Mar 11, 2024 at 7:42 PM 梦龙董 wrote: > > [..] > > I see. > I thought you're sharing the trampoline across attachments. > (since bpf prog is the same). That seems to be a good idea, which I

Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args

2024-03-15 Thread
On Thu, Mar 14, 2024 at 8:27 AM Alexei Starovoitov wrote: > > On Tue, Mar 12, 2024 at 6:53 PM 梦龙董 wrote: [..] > > What does "a hundred attachments max" means? Can't I > > trace thousands of kernel functions with a bpf program of > > tracing multi-lin

Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args

2024-03-15 Thread
On Thu, Mar 14, 2024 at 2:29 PM Jiri Olsa wrote: > > On Wed, Mar 13, 2024 at 05:25:35PM -0700, Alexei Starovoitov wrote: > > On Tue, Mar 12, 2024 at 6:53 PM 梦龙董 wrote: > > > > > > On Wed, Mar 13, 2024 at 12:42 AM Alexei Starovoitov > > > wrote: > > &

Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args

2024-03-28 Thread
On Fri, Mar 15, 2024 at 4:00 PM 梦龙董 wrote: > > On Thu, Mar 14, 2024 at 8:27 AM Alexei Starovoitov > wrote: > > > > On Tue, Mar 12, 2024 at 6:53 PM 梦龙董 wrote: > [..] > > > What does "a hundred attachments max" means? Can't I > > >

Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args

2024-03-29 Thread
On Thu, Mar 28, 2024 at 11:11 PM Steven Rostedt wrote: > > On Thu, 28 Mar 2024 22:43:46 +0800 > 梦龙董 wrote: > > > I have done a simple benchmark on creating 1000 > > trampolines. It is slow, quite slow, which consume up to > > 60s. We can't do it this way.

Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args

2024-03-29 Thread
On Fri, Mar 29, 2024 at 7:17 AM Alexei Starovoitov wrote: > > On Thu, Mar 28, 2024 at 8:10 AM Steven Rostedt wrote: > > > > On Thu, 28 Mar 2024 22:43:46 +0800 > > 梦龙董 wrote: > > > > > I have done a simple benchmark on creating 1000 > > > trampoli

Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args

2024-03-29 Thread
On Sat, Mar 30, 2024 at 7:28 AM Andrii Nakryiko wrote: > > On Thu, Mar 28, 2024 at 8:10 AM Steven Rostedt wrote: > > > > On Thu, 28 Mar 2024 22:43:46 +0800 > > 梦龙董 wrote: > > > > > I have done a simple benchmark on creating 1000 > > > trampoli

Re: [External] Re: [PATCH bpf-next v2 1/9] bpf: tracing: add support to record and check the accessed args

2024-03-31 Thread
On Sun, Mar 31, 2024 at 3:34 AM Steven Rostedt wrote: > > On Sat, 30 Mar 2024 11:18:29 +0800 > 梦龙董 wrote: > > > > If you really want to have thousands of functions, why not just register > > > it > > > with ftrace itself. It will give you the arguments via