Re: [PATCH bpf-next 3/5] bpf: support BPF cookie in raw tracepoint (raw_tp, tp_btf) programs

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

 



On Sun, Mar 17, 2024 at 3:30 PM Jiri Olsa <olsajiri@xxxxxxxxx> wrote:
>
> On Fri, Mar 15, 2024 at 01:45:22PM -0700, Andrii Nakryiko wrote:
> > Wire up BPF cookie for raw tracepoint programs (both BTF and non-BTF
> > aware variants). This brings them up to part w.r.t. BPF cookie usage
> > with classic tracepoint and fentry/fexit programs.
> >
> > Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
> > ---
> >  include/linux/bpf.h            |  1 +
> >  include/uapi/linux/bpf.h       |  1 +
> >  kernel/bpf/syscall.c           | 13 +++++++++----
> >  kernel/trace/bpf_trace.c       | 13 +++++++++++++
> >  tools/include/uapi/linux/bpf.h |  1 +
> >  5 files changed, 25 insertions(+), 4 deletions(-)
> >
> > diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> > index f8a09a742e38..32dde6ce7e92 100644
> > --- a/include/linux/bpf.h
> > +++ b/include/linux/bpf.h
> > @@ -1611,6 +1611,7 @@ struct bpf_tracing_link {
> >  struct bpf_raw_tp_link {
> >       struct bpf_link link;
> >       struct bpf_raw_event_map *btp;
> > +     u64 cookie;
> >  };
> >
> >  struct bpf_link_primer {
> > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> > index 3c42b9f1bada..bf80b614c4db 100644
> > --- a/include/uapi/linux/bpf.h
> > +++ b/include/uapi/linux/bpf.h
> > @@ -1664,6 +1664,7 @@ union bpf_attr {
> >       struct { /* anonymous struct used by BPF_RAW_TRACEPOINT_OPEN command */
> >               __u64 name;
> >               __u32 prog_fd;
>
> should we add __u32 :32; in here ?
>

I thought that's why we have __aligned_u64? But I'll look around in
bpf_attr if we do that elsewhere. I'll need to respin to fix config
without CONFIG_BPF anyways, so will incorporate this as well.

> jirka
>
> > +             __aligned_u64 cookie;
> >       } raw_tracepoint;
> >
> >       struct { /* anonymous struct for BPF_BTF_LOAD */

[...]





[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