From: Jiri Olsa <olsajiri@gmail.com>
To: Viktor Malik <vmalik@redhat.com>
Cc: Jiri Olsa <olsajiri@gmail.com>,
Andrii Nakryiko <andrii.nakryiko@gmail.com>,
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>,
"Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Subject: Re: [PATCH RFC bpf-next 0/4] bpf: Add support to attach return prog in kprobe multi
Date: Mon, 19 Feb 2024 13:43:05 +0100 [thread overview]
Message-ID: <ZdNM2VhcOZBEc9K3@krava> (raw)
In-Reply-To: <f00c784f-527b-4389-b301-b20ded02c5b4@redhat.com>
On Mon, Feb 19, 2024 at 12:20:08PM +0100, Viktor Malik wrote:
> On 2/13/24 22:09, Jiri Olsa wrote:
> > On Tue, Feb 13, 2024 at 10:20:46AM -0800, Andrii Nakryiko wrote:
> >> On Tue, Feb 13, 2024 at 4:09 AM Jiri Olsa <olsajiri@gmail.com> wrote:
> >>>
> >>> On Mon, Feb 12, 2024 at 08:06:06PM -0800, Andrii Nakryiko wrote:
> >>>
> >>> SNIP
> >>>
> >>>>>> But the way you implement it with extra flag and extra fd parameter
> >>>>>> makes it harder to have a nice high-level support in libbpf (and
> >>>>>> presumably other BPF loader libraries) for this.
> >>>>>>
> >>>>>> When I was thinking about doing something like this, I was considering
> >>>>>> adding a new program type, actually. That way it's possible to define
> >>>>>> this "let's skip return probe" protocol without backwards
> >>>>>> compatibility concerns. It's easier to use it declaratively in libbpf.
> >>>>>
> >>>>> ok, that seems cleaner.. but we need to use current kprobe programs,
> >>>>> so not sure at the moment how would that fit in.. did you mean new
> >>>>> link type?
> >>>>
> >>>> It's kind of a less important detail, actually. New program type would
> >>>> allow us to have an entirely different context type, but I think we
> >>>> can make do with the existing kprobe program type. We can have a
> >>>> separate attach_type and link type, just like multi-kprobe and
> >>>> multi-uprobe are still kprobe programs.
> >>>
> >>> ok, having new attach type on top of kprobe_multi link makes sense
> >>>
> >>>>
> >>>>>
> >>>>>> You just declare SEC("kprobe.wrap/...") (or whatever the name,
> >>>>>> something to designate that it's both entry and exit probe) as one
> >>>>>> program and in the code there would be some way to determine whether
> >>>>>> we are in entry mode or exit mode (helper or field in the custom
> >>>>>> context type, the latter being faster and more usable, but it's
> >>>>>> probably not critical).
> >>>>>
> >>>>> hum, so the single program would be for both entry and exit probe,
> >>>>> I'll need to check how bad it'd be for us, but it'd probably mean
> >>>>> just one extra tail call, so it's likely ok
> >>>>
> >>>> I guess, I don't know what you are doing there :) I'd recommend
> >>>> looking at utilizing BPF global subprogs instead of tail calls, if
> >>>> your kernel allows for that, as that's a saner way to scale BPF
> >>>> verification.
> >>>
> >>> ok, we should probably do that.. given this enhancement will be
> >>> available on latest kernel anyway, we could use global subprogs
> >>> as well
> >>>
> >>> the related bpftrace might be bit more challenging.. will have to
> >>> generate program calling entry or return program now, but seems
> >>> doable of course
> >>
> >> So you want users to still have separate kprobe and kretprobe in
> >> bpftrace, but combine them into this kwrapper transparently? It does
> >
> > no I meant I'd need to generate the wrapper program for the new
> > interface.. which is extra compared to current bpftrace changes
>
> If you end up introducing this new kwrapper program type in libbpf, I
> think that it'll make sense to have something similar in bpftrace, too.
> Allowing users to write separate kprobe and kretprobe programs and
> transparently combining them into kwrapper doesn't seem to bring much
> value to me.
I kind of liked the idea of not introducing new probe type and silently
making things faster ;-) but having wrapper probe type makes also sense
>
> Jirka, if you need help with implementing bpftrace support for this, let
> me know. I'm very interested in having this capability there.
that'd be great, I'll send new version of kernel changes soon
thanks,
jirka
next prev parent reply other threads:[~2024-02-19 12:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-07 15:35 [PATCH RFC bpf-next 0/4] bpf: Add support to attach return prog in kprobe multi Jiri Olsa
2024-02-07 15:35 ` [PATCH RFC bpf-next 1/4] fprobe: Add entry/exit callbacks types Jiri Olsa
2024-02-13 15:35 ` Masami Hiramatsu
2024-02-15 9:08 ` Jiri Olsa
2024-02-07 15:35 ` [PATCH RFC bpf-next 2/4] bpf: Add return prog to kprobe multi Jiri Olsa
2024-02-08 19:05 ` Alexei Starovoitov
2024-02-10 15:29 ` Jiri Olsa
2024-02-07 15:35 ` [PATCH RFC bpf-next 3/4] libbpf: Add return_prog_fd to kprobe multi opts Jiri Olsa
2024-02-07 15:35 ` [PATCH RFC bpf-next 4/4] selftests/bpf: Add kprobe multi return prog test Jiri Olsa
2024-02-08 19:35 ` [PATCH RFC bpf-next 0/4] bpf: Add support to attach return prog in kprobe multi Andrii Nakryiko
2024-02-10 15:31 ` Jiri Olsa
2024-02-13 4:06 ` Andrii Nakryiko
2024-02-13 12:09 ` Jiri Olsa
2024-02-13 18:20 ` Andrii Nakryiko
2024-02-13 21:09 ` Jiri Olsa
2024-02-14 20:55 ` Jiri Olsa
2024-02-15 16:27 ` Steven Rostedt
2024-02-16 15:03 ` Jiri Olsa
2024-02-19 11:20 ` Viktor Malik
2024-02-19 12:43 ` Jiri Olsa [this message]
2024-02-23 9:32 ` Jiri Olsa
2024-02-29 0:43 ` Andrii Nakryiko
2024-02-29 1:25 ` Andrii Nakryiko
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=ZdNM2VhcOZBEc9K3@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox