Re: [PATCH v2 bpf-next 5/7] bpf: Count the number of times recursion was prevented

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

 



On Sat, Feb 6, 2021 at 9:06 AM Alexei Starovoitov
<alexei.starovoitov@xxxxxxxxx> wrote:
>
> From: Alexei Starovoitov <ast@xxxxxxxxxx>
>
> Add per-program counter for number of times recursion prevention mechanism
> was triggered and expose it via show_fdinfo and bpf_prog_info.
> Teach bpftool to print it.
>
> Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
> ---

Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx>

>  include/linux/filter.h         |  1 +
>  include/uapi/linux/bpf.h       |  1 +
>  kernel/bpf/syscall.c           | 14 ++++++++++----
>  kernel/bpf/trampoline.c        | 18 ++++++++++++++++--
>  tools/bpf/bpftool/prog.c       |  5 +++++
>  tools/include/uapi/linux/bpf.h |  1 +
>  6 files changed, 34 insertions(+), 6 deletions(-)
>

[...]

>  static void print_prog_json(struct bpf_prog_info *info, int fd)
> @@ -446,6 +448,9 @@ static void print_prog_header_plain(struct bpf_prog_info *info)
>         if (info->run_time_ns)
>                 printf(" run_time_ns %lld run_cnt %lld",
>                        info->run_time_ns, info->run_cnt);
> +       if (info->recursion_misses)
> +               printf(" recursion_misses %lld",
> +                      info->recursion_misses);

no need for wrapping the line

>         printf("\n");
>  }
>
> diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
> index c001766adcbc..c547ad1ffe43 100644
> --- a/tools/include/uapi/linux/bpf.h
> +++ b/tools/include/uapi/linux/bpf.h
> @@ -4501,6 +4501,7 @@ struct bpf_prog_info {
>         __aligned_u64 prog_tags;
>         __u64 run_time_ns;
>         __u64 run_cnt;
> +       __u64 recursion_misses;
>  } __attribute__((aligned(8)));
>
>  struct bpf_map_info {
> --
> 2.24.1
>



[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