Linux Perf Users
 help / color / mirror / Atom feed
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, linux-perf-users@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>,
	Hao Luo <haoluo@google.com>, Yafang Shao <laoar.shao@gmail.com>,
	Quentin Monnet <qmo@kernel.org>
Subject: Re: [PATCH bpf-next 3/3] bpftool: Display ref_ctr_offset for uprobe link info
Date: Wed, 7 May 2025 10:56:35 +0200	[thread overview]
Message-ID: <aBsgQw1kzJsRzM5p@krava> (raw)
In-Reply-To: <CAEf4Bzbpn8kQV8ORoBv7iDR1VxT0uUf=qqjanFQFtFx1fSjrQQ@mail.gmail.com>

On Tue, May 06, 2025 at 03:33:33PM -0700, Andrii Nakryiko wrote:
> On Tue, May 6, 2025 at 6:58 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > Adding support to display ref_ctr_offset in link output, like:
> >
> >   # bpftool link
> >   ...
> >   42: perf_event  prog 174
> >           uprobe /proc/self/exe+0x102f13  cookie 3735928559  ref_ctr_offset 50500538
> 
> let's use hex for ref_ctr_offset?

I had that, then I saw cookie was dec ;-) either way is fine for me

> 
> and also, why do we have bpf_cookie and cookie emitted? Are they different?

hum, right.. so there's bpf_cookie retrieval from perf_link through the
task_file iterator:

  cbdaf71f7e65 bpftool: Add bpf_cookie to link output

I guess it was added before we decided to have bpf_link_info.perf_event
interface, which seems easier to me

jirka

> 
> >           bpf_cookie 3735928559
> >           pids test_progs(1820)
> >
> >   # bpftool link -j | jq
> >   [
> >     ...
> >     {
> >       "id": 42,
> >        ...
> >       "ref_ctr_offset": 50500538,
> >     }
> >   ]
> >
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> >  tools/bpf/bpftool/link.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/tools/bpf/bpftool/link.c b/tools/bpf/bpftool/link.c
> > index 52fd2c9fac56..b09aae3a191e 100644
> > --- a/tools/bpf/bpftool/link.c
> > +++ b/tools/bpf/bpftool/link.c
> > @@ -380,6 +380,7 @@ show_perf_event_uprobe_json(struct bpf_link_info *info, json_writer_t *wtr)
> >                            u64_to_ptr(info->perf_event.uprobe.file_name));
> >         jsonw_uint_field(wtr, "offset", info->perf_event.uprobe.offset);
> >         jsonw_uint_field(wtr, "cookie", info->perf_event.uprobe.cookie);
> > +       jsonw_uint_field(wtr, "ref_ctr_offset", info->perf_event.uprobe.ref_ctr_offset);
> >  }
> >
> >  static void
> > @@ -823,6 +824,8 @@ static void show_perf_event_uprobe_plain(struct bpf_link_info *info)
> >         printf("%s+%#x  ", buf, info->perf_event.uprobe.offset);
> >         if (info->perf_event.uprobe.cookie)
> >                 printf("cookie %llu  ", info->perf_event.uprobe.cookie);
> > +       if (info->perf_event.uprobe.ref_ctr_offset)
> > +               printf("ref_ctr_offset %llu  ", info->perf_event.uprobe.ref_ctr_offset);
> >  }
> >
> >  static void show_perf_event_tracepoint_plain(struct bpf_link_info *info)
> > --
> > 2.49.0
> >

  reply	other threads:[~2025-05-07  8:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-06 13:57 [PATCH bpf-next 0/3] bpf: Retrieve ref_ctr_offset from uprobe perf link Jiri Olsa
2025-05-06 13:57 ` [PATCH bpf-next 1/3] bpf: Add support to retrieve ref_ctr_offset for " Jiri Olsa
2025-05-07  2:18   ` Yafang Shao
2025-05-06 13:57 ` [PATCH bpf-next 2/3] selftests/bpf: Add link info test for ref_ctr_offset retrieval Jiri Olsa
2025-05-07  2:26   ` Yafang Shao
2025-05-06 13:57 ` [PATCH bpf-next 3/3] bpftool: Display ref_ctr_offset for uprobe link info Jiri Olsa
2025-05-06 14:28   ` Quentin Monnet
2025-05-06 22:33   ` Andrii Nakryiko
2025-05-07  8:56     ` Jiri Olsa [this message]
2025-05-07  9:40       ` Quentin Monnet
2025-05-07 18:18         ` Andrii Nakryiko
2025-05-07 19:35           ` Quentin Monnet
2025-05-09 15:30       ` Jiri Olsa
2025-05-09 15:54         ` 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=aBsgQw1kzJsRzM5p@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=laoar.shao@gmail.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=qmo@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