Re: [PATCH bpf-next 3/3] bpftool: Display ref_ctr_offset for uprobe link info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx> 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@xxxxxxxxxx>
> > ---
> >  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
> >




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux