> On Wed, Feb 23, 2022 at 01:46:56PM -0800, Andrii Nakryiko wrote: > On Thu, Feb 17, 2022 at 11:51 PM Dmitrii Dolgov <9erthalion6@xxxxxxxxx> wrote: > > > > +static __always_inline __u64 get_bpf_cookie(struct bpf_link *link) > > +{ > > + struct bpf_perf_link *perf_link; > > + struct perf_event *event; > > + > > + perf_link = container_of(link, struct bpf_perf_link, link); > > + event = BPF_CORE_READ(perf_link, perf_file, private_data); > > + return BPF_CORE_READ(event, bpf_cookie); > > not every bpf_link is bpf_perf_link, you can't do it for every > instance of bpf_link. Right, thanks. I was somehow testing it only with perf links, will fix.