From: Jiri Olsa <olsajiri@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
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@fomichev.me>, Hao Luo <haoluo@google.com>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCHv5 bpf-next 02/13] uprobe: Add support for session consumer
Date: Tue, 1 Oct 2024 15:17:44 +0200 [thread overview]
Message-ID: <Zvv2eM2YNuiv7C8-@krava> (raw)
In-Reply-To: <CAEf4BzZ+1=YU=61mVup8pAc80SOvNuYtMzNdz4miH+Sm4qV4ig@mail.gmail.com>
On Mon, Sep 30, 2024 at 02:36:03PM -0700, Andrii Nakryiko wrote:
> On Sun, Sep 29, 2024 at 1:57 PM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > This change allows the uprobe consumer to behave as session which
> > means that 'handler' and 'ret_handler' callbacks are connected in
> > a way that allows to:
> >
> > - control execution of 'ret_handler' from 'handler' callback
> > - share data between 'handler' and 'ret_handler' callbacks
> >
> > The session concept fits to our common use case where we do filtering
> > on entry uprobe and based on the result we decide to run the return
> > uprobe (or not).
> >
> > It's also convenient to share the data between session callbacks.
> >
> > To achive this we are adding new return value the uprobe consumer
> > can return from 'handler' callback:
> >
> > UPROBE_HANDLER_IGNORE
> > - Ignore 'ret_handler' callback for this consumer.
> >
> > And store cookie and pass it to 'ret_handler' when consumer has both
> > 'handler' and 'ret_handler' callbacks defined.
> >
> > We store shared data in the return_consumer object array as part of
> > the return_instance object. This way the handle_uretprobe_chain can
> > find related return_consumer and its shared data.
> >
> > We also store entry handler return value, for cases when there are
> > multiple consumers on single uprobe and some of them are ignored and
> > some of them not, in which case the return probe gets installed and
> > we need to have a way to find out which consumer needs to be ignored.
> >
> > The tricky part is when consumer is registered 'after' the uprobe
> > entry handler is hit. In such case this consumer's 'ret_handler' gets
> > executed as well, but it won't have the proper data pointer set,
> > so we can filter it out.
> >
> > Suggested-by: Oleg Nesterov <oleg@redhat.com>
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > include/linux/uprobes.h | 21 +++++-
> > kernel/events/uprobes.c | 148 +++++++++++++++++++++++++++++++---------
> > 2 files changed, 137 insertions(+), 32 deletions(-)
> >
>
> LGTM,
>
> Acked-by: Andrii Nakryiko <andrii@kernel.org>
>
>
> Note also that I just resent the last patch from my patch set ([0]),
> hopefully it will get applied, in which case you'd need to do a tiny
> rebase.
>
> [0] https://lore.kernel.org/linux-trace-kernel/20240930212246.1829395-1-andrii@kernel.org/
the rebase is fine, but what I'm not clear about is that after yours and
Oleg's changes get in, my kernel changes will depend on peter's perf/core,
but bpf selftests changes will need bpf-next/master
jirka
next prev parent reply other threads:[~2024-10-01 13:17 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-29 20:57 [PATCHv5 bpf-next 00/13] uprobe, bpf: Add session support Jiri Olsa
2024-09-29 20:57 ` [PATCHv5 bpf-next 01/13] uprobe: Add data pointer to consumer handlers Jiri Olsa
2024-09-30 9:34 ` Oleg Nesterov
2024-09-30 21:35 ` Andrii Nakryiko
2024-09-29 20:57 ` [PATCHv5 bpf-next 02/13] uprobe: Add support for session consumer Jiri Olsa
2024-09-30 9:40 ` Oleg Nesterov
2024-09-30 11:42 ` Jiri Olsa
2024-09-30 21:36 ` Andrii Nakryiko
2024-10-01 13:17 ` Jiri Olsa [this message]
2024-10-01 17:09 ` Andrii Nakryiko
2024-09-29 20:57 ` [PATCHv5 bpf-next 03/13] bpf: Add support for uprobe multi session attach Jiri Olsa
2024-09-30 21:36 ` Andrii Nakryiko
2024-10-01 13:17 ` Jiri Olsa
2024-10-01 17:11 ` Andrii Nakryiko
2024-10-02 13:07 ` Jiri Olsa
2024-09-29 20:57 ` [PATCHv5 bpf-next 04/13] bpf: Add support for uprobe multi session context Jiri Olsa
2024-09-29 20:57 ` [PATCHv5 bpf-next 05/13] bpf: Allow return values 0 and 1 for uprobe/kprobe session Jiri Olsa
2024-09-30 21:36 ` Andrii Nakryiko
2024-10-01 13:18 ` Jiri Olsa
2024-09-29 20:57 ` [PATCHv5 bpf-next 06/13] libbpf: Add support for uprobe multi session attach Jiri Olsa
2024-09-30 21:36 ` Andrii Nakryiko
2024-10-01 13:18 ` Jiri Olsa
2024-09-29 20:57 ` [PATCHv5 bpf-next 07/13] selftests/bpf: Add uprobe session test Jiri Olsa
2024-09-29 20:57 ` [PATCHv5 bpf-next 08/13] selftests/bpf: Add uprobe session cookie test Jiri Olsa
2024-09-29 20:57 ` [PATCHv5 bpf-next 09/13] selftests/bpf: Add uprobe session recursive test Jiri Olsa
2024-09-29 20:57 ` [PATCHv5 bpf-next 10/13] selftests/bpf: Add uprobe session verifier test for return value Jiri Olsa
2024-09-29 20:57 ` [PATCHv5 bpf-next 11/13] selftests/bpf: Add kprobe " Jiri Olsa
2024-09-29 20:57 ` [PATCHv5 bpf-next 12/13] selftests/bpf: Add uprobe session single consumer test Jiri Olsa
2024-09-29 20:57 ` [PATCHv5 bpf-next 13/13] selftests/bpf: Add uprobe sessions to " 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=Zvv2eM2YNuiv7C8-@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=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sdf@fomichev.me \
--cc=songliubraving@fb.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).