From: Jiri Olsa <olsajiri@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
bpf@vger.kernel.org, Martin KaFai Lau <kafai@fb.com>,
Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@chromium.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Viktor Malik <vmalik@redhat.com>,
"Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Subject: Re: [PATCH bpf-next 1/7] bpf: Add support for kprobe multi session attach
Date: Wed, 24 Apr 2024 13:46:15 +0200 [thread overview]
Message-ID: <ZijxB_pe6DiNuy-f@krava> (raw)
In-Reply-To: <CAEf4BzayRpyFu_UAR4aNvvpq8hzOWFgbcRSWTUgAM81OGcQGoQ@mail.gmail.com>
On Tue, Apr 23, 2024 at 05:26:39PM -0700, Andrii Nakryiko wrote:
> On Mon, Apr 22, 2024 at 5:12 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > Adding support to attach bpf program for entry and return probe
> > of the same function. This is common use case which at the moment
> > requires to create two kprobe multi links.
> >
> > Adding new BPF_TRACE_KPROBE_MULTI_SESSION attach type that instructs
> > kernel to attach single link program to both entry and exit probe.
> >
> > It's possible to control execution of the bpf program on return
> > probe simply by returning zero or non zero from the entry bpf
> > program execution to execute or not the bpf program on return
> > probe respectively.
> >
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > include/uapi/linux/bpf.h | 1 +
> > kernel/bpf/syscall.c | 7 ++++++-
> > kernel/trace/bpf_trace.c | 28 ++++++++++++++++++++--------
> > tools/include/uapi/linux/bpf.h | 1 +
> > 4 files changed, 28 insertions(+), 9 deletions(-)
> >
> > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> > index cee0a7915c08..fb8ecb199273 100644
> > --- a/include/uapi/linux/bpf.h
> > +++ b/include/uapi/linux/bpf.h
> > @@ -1115,6 +1115,7 @@ enum bpf_attach_type {
> > BPF_CGROUP_UNIX_GETSOCKNAME,
> > BPF_NETKIT_PRIMARY,
> > BPF_NETKIT_PEER,
> > + BPF_TRACE_KPROBE_MULTI_SESSION,
>
> let's use a shorter BPF_TRACE_KPROBE_SESSION? we'll just know that
> it's multi-variant (there is no point in adding non-multi kprobes
> going forward anyways, it's a new default)
>
> > __MAX_BPF_ATTACH_TYPE
> > };
> >
>
> [...]
>
> > diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> > index afb232b1d7c2..3b15a40f425f 100644
> > --- a/kernel/trace/bpf_trace.c
> > +++ b/kernel/trace/bpf_trace.c
> > @@ -1631,6 +1631,17 @@ bpf_tracing_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
> > }
> > }
> >
> > +static bool is_kprobe_multi(const struct bpf_prog *prog)
> > +{
> > + return prog->expected_attach_type == BPF_TRACE_KPROBE_MULTI ||
> > + prog->expected_attach_type == BPF_TRACE_KPROBE_MULTI_SESSION;
> > +}
> > +
> > +static inline bool is_kprobe_multi_session(const struct bpf_prog *prog)
>
> ditto, this multi is just a distraction at this point, IMO
ok, sounds good, will drop multi for session stuff
jirka
>
> > +{
> > + return prog->expected_attach_type == BPF_TRACE_KPROBE_MULTI_SESSION;
> > +}
> > +
> > static const struct bpf_func_proto *
> > kprobe_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
> > {
>
> [...]
next prev parent reply other threads:[~2024-04-24 11:46 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-22 12:12 [PATCH bpf-next 0/7] bpf: Introduce kprobe_multi session attach Jiri Olsa
2024-04-22 12:12 ` [PATCH bpf-next 1/7] bpf: Add support for kprobe multi " Jiri Olsa
2024-04-24 0:26 ` Andrii Nakryiko
2024-04-24 11:46 ` Jiri Olsa [this message]
2024-04-22 12:12 ` [PATCH bpf-next 2/7] bpf: Add support for kprobe multi session context Jiri Olsa
2024-04-24 0:26 ` Andrii Nakryiko
2024-04-24 11:45 ` Jiri Olsa
2024-04-22 12:12 ` [PATCH bpf-next 3/7] bpf: Add support for kprobe multi session cookie Jiri Olsa
2024-04-22 17:48 ` Alexei Starovoitov
2024-04-22 20:55 ` Jiri Olsa
2024-04-24 0:26 ` Andrii Nakryiko
2024-04-24 11:45 ` Jiri Olsa
2024-04-22 12:12 ` [PATCH bpf-next 4/7] libbpf: Add support for kprobe multi session attach Jiri Olsa
2024-04-24 0:26 ` Andrii Nakryiko
2024-04-24 11:45 ` Jiri Olsa
2024-04-22 12:12 ` [PATCH bpf-next 5/7] libbpf: Add kprobe session attach type name to attach_type_name Jiri Olsa
2024-04-24 0:27 ` Andrii Nakryiko
2024-04-24 11:44 ` Jiri Olsa
2024-04-22 12:12 ` [PATCH bpf-next 6/7] selftests/bpf: Add kprobe multi session test Jiri Olsa
2024-04-24 0:27 ` Andrii Nakryiko
2024-04-24 11:44 ` Jiri Olsa
2024-04-30 8:10 ` Jiri Olsa
2024-04-22 12:12 ` [PATCH bpf-next 7/7] selftests/bpf: Add kprobe multi wrapper cookie test Jiri Olsa
2024-04-24 0:27 ` Andrii Nakryiko
2024-04-24 11:44 ` Jiri Olsa
2024-04-24 0:27 ` [PATCH bpf-next 0/7] bpf: Introduce kprobe_multi session attach Andrii Nakryiko
2024-04-24 5:12 ` John Fastabend
2024-04-24 11:43 ` Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZijxB_pe6DiNuy-f@krava \
--to=olsajiri@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=mhiramat@kernel.org \
--cc=sdf@google.com \
--cc=songliubraving@fb.com \
--cc=vmalik@redhat.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.