Re: [PATCHv3 bpf-next 2/9] bpf: Add missed value to kprobe_multi link info

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

 



On Thu, Sep 21, 2023 at 11:52:16AM -0700, Song Liu wrote:
> On Wed, Sep 20, 2023 at 2:32 PM Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
> >
> > Add missed value to kprobe_multi link info to hold the stats of missed
> > kprobe_multi probe.
> >
> > The missed counter gets incremented when fprobe fails the recursion
> > check or there's no rethook available for return probe. In either
> > case the attached bpf program is not executed.
> >
> > Acked-by: Hou Tao <houtao1@xxxxxxxxxx>
> > Reviewed-and-tested-by: Song Liu <song@xxxxxxxxxx>
> > Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> > ---
> >  include/uapi/linux/bpf.h       | 1 +
> >  kernel/trace/bpf_trace.c       | 1 +
> >  tools/include/uapi/linux/bpf.h | 1 +
> >  3 files changed, 3 insertions(+)
> >
> > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> > index 73b155e52204..e5216420ec73 100644
> > --- a/include/uapi/linux/bpf.h
> > +++ b/include/uapi/linux/bpf.h
> > @@ -6530,6 +6530,7 @@ struct bpf_link_info {
> >                         __aligned_u64 addrs;
> >                         __u32 count; /* in/out: kprobe_multi function count */
> >                         __u32 flags;
> > +                       __u64 missed;
> 
> This does not make bpf_link_info bigger. So if we use newer user space
> on older kernel, the user space cannot tell whether missed == 0 or the
> kernel doesn't support "missed". Right?

hum, I think that's right.. but I think that would be the case
even if it did make bpf_link_info bigger, because we'd need to
pass zeroed value in 'missed' field and it'd not be changed by
older kernel

user space could maybe check if there's 'missed field in
bpf_link_info.perf_event.kprobe.missed ?

jirka

> 
> Thanks,
> Song
> 
> >                 } kprobe_multi;
> >                 struct {
> >                         __u32 type; /* enum bpf_perf_event_type */
> > diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> > index 279a3d370812..aec52938c703 100644
> > --- a/kernel/trace/bpf_trace.c
> > +++ b/kernel/trace/bpf_trace.c
> > @@ -2614,6 +2614,7 @@ static int bpf_kprobe_multi_link_fill_link_info(const struct bpf_link *link,
> >         kmulti_link = container_of(link, struct bpf_kprobe_multi_link, link);
> >         info->kprobe_multi.count = kmulti_link->cnt;
> >         info->kprobe_multi.flags = kmulti_link->flags;
> > +       info->kprobe_multi.missed = kmulti_link->fp.nmissed;
> >
> >         if (!uaddrs)
> >                 return 0;
> > diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
> > index 73b155e52204..e5216420ec73 100644
> > --- a/tools/include/uapi/linux/bpf.h
> > +++ b/tools/include/uapi/linux/bpf.h
> > @@ -6530,6 +6530,7 @@ struct bpf_link_info {
> >                         __aligned_u64 addrs;
> >                         __u32 count; /* in/out: kprobe_multi function count */
> >                         __u32 flags;
> > +                       __u64 missed;
> >                 } kprobe_multi;
> >                 struct {
> >                         __u32 type; /* enum bpf_perf_event_type */
> > --
> > 2.41.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