From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andriin@fb.com>,
Networking <netdev@vger.kernel.org>, bpf <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>,
Masami Hiramatsu <mhiramat@kernel.org>,
Alan Maguire <alan.maguire@oracle.com>
Subject: Re: [PATCHv4 bpf-next 6/8] libbpf: Add bpf_program__attach_kprobe_opts function
Date: Sun, 18 Jul 2021 14:30:20 -0700 [thread overview]
Message-ID: <CAEf4BzajXLe7Yx+r024A9bhaR6Dwy+t+n2sqA=8NXQ9m0sp1mQ@mail.gmail.com> (raw)
In-Reply-To: <YPSBs51JR5cWVuc1@krava>
On Sun, Jul 18, 2021 at 12:32 PM Jiri Olsa <jolsa@redhat.com> wrote:
>
> On Fri, Jul 16, 2021 at 06:41:59PM -0700, Andrii Nakryiko wrote:
> > On Wed, Jul 14, 2021 at 2:45 AM Jiri Olsa <jolsa@redhat.com> wrote:
> > >
> > > Adding bpf_program__attach_kprobe_opts that does the same
> > > as bpf_program__attach_kprobe, but takes opts argument.
> > >
> > > Currently opts struct holds just retprobe bool, but we will
> > > add new field in following patch.
> > >
> > > The function is not exported, so there's no need to add
> > > size to the struct bpf_program_attach_kprobe_opts for now.
> >
> > Why not exported? Please use a proper _opts struct just like others
> > (e.g., bpf_object_open_opts) and add is as a public API, it's a useful
> > addition. We are going to have a similar structure for attach_uprobe,
> > btw. Please send a follow up patch.
>
> there's no outside user.. ok
because there is no API :) I've seen people asking about the ability
to attach to kprobe+offset in some PRs.
>
> >
> > >
> > > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > > ---
> > > tools/lib/bpf/libbpf.c | 34 +++++++++++++++++++++++++---------
> > > 1 file changed, 25 insertions(+), 9 deletions(-)
> > >
> > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> > > index 88b99401040c..d93a6f9408d1 100644
> > > --- a/tools/lib/bpf/libbpf.c
> > > +++ b/tools/lib/bpf/libbpf.c
> > > @@ -10346,19 +10346,24 @@ static int perf_event_open_probe(bool uprobe, bool retprobe, const char *name,
> > > return pfd;
> > > }
> > >
> > > -struct bpf_link *bpf_program__attach_kprobe(struct bpf_program *prog,
> > > - bool retprobe,
> > > - const char *func_name)
> > > +struct bpf_program_attach_kprobe_opts {
> >
> > when you make it part of libbpf API, let's call it something shorter,
> > like bpf_kprobe_opts, maybe? And later we'll have bpf_uprobe_opts for
> > uprobes. Short and unambiguous.
>
> ok
>
> jirka
>
> >
> > > + bool retprobe;
> > > +};
> > > +
> > > +static struct bpf_link*
> > > +bpf_program__attach_kprobe_opts(struct bpf_program *prog,
> > > + const char *func_name,
> > > + struct bpf_program_attach_kprobe_opts *opts)
> > > {
> > > char errmsg[STRERR_BUFSIZE];
> > > struct bpf_link *link;
> > > int pfd, err;
> > >
> >
> > [...]
> >
>
next prev parent reply other threads:[~2021-07-18 21:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-14 9:43 [PATCHv4 bpf-next 0/8] bpf, x86: Add bpf_get_func_ip helper Jiri Olsa
2021-07-14 9:43 ` [PATCHv4 bpf-next 1/8] bpf, x86: Store caller's ip in trampoline stack Jiri Olsa
2021-07-14 9:43 ` [PATCHv4 bpf-next 2/8] bpf: Enable BPF_TRAMP_F_IP_ARG for trampolines with call_get_func_ip Jiri Olsa
2021-07-14 9:43 ` [PATCHv4 bpf-next 3/8] bpf: Add bpf_get_func_ip helper for tracing programs Jiri Olsa
2021-07-16 1:09 ` Alexei Starovoitov
2021-07-18 19:30 ` Jiri Olsa
2021-07-14 9:43 ` [PATCHv4 bpf-next 4/8] bpf: Add bpf_get_func_ip helper for kprobe programs Jiri Olsa
2021-07-14 9:43 ` [PATCHv4 bpf-next 5/8] selftests/bpf: Add test for bpf_get_func_ip helper Jiri Olsa
2021-07-14 9:43 ` [PATCHv4 bpf-next 6/8] libbpf: Add bpf_program__attach_kprobe_opts function Jiri Olsa
2021-07-17 1:41 ` Andrii Nakryiko
2021-07-18 19:32 ` Jiri Olsa
2021-07-18 21:30 ` Andrii Nakryiko [this message]
2021-07-14 9:43 ` [PATCHv4 bpf-next 7/8] libbpf: Allow specification of "kprobe/function+offset" Jiri Olsa
2021-07-17 1:42 ` Andrii Nakryiko
2021-07-18 19:32 ` Jiri Olsa
2021-07-14 9:44 ` [PATCHv4 bpf-next 8/8] selftests/bpf: Add test for bpf_get_func_ip in kprobe+offset probe 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='CAEf4BzajXLe7Yx+r024A9bhaR6Dwy+t+n2sqA=8NXQ9m0sp1mQ@mail.gmail.com' \
--to=andrii.nakryiko@gmail.com \
--cc=alan.maguire@oracle.com \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=jolsa@redhat.com \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=mhiramat@kernel.org \
--cc=netdev@vger.kernel.org \
--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).