Re: [PATCH bpf-next] bpf: Introduce BPF_TRACE_x helper for the tracing tests

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

 



On Sat, Nov 23, 2019 at 12:25 PM Martin KaFai Lau <kafai@xxxxxx> wrote:
>
> For BPF_PROG_TYPE_TRACING, the bpf_prog's ctx is an array of u64.
> This patch borrows the idea from BPF_CALL_x in filter.h to
> convert a u64 to the arg type of the traced function.
>
> The new BPF_TRACE_x has an arg to specify the return type of a bpf_prog.
> It will be used in the future TCP-ops bpf_prog that may return "void".
>
> The new macros are defined in the new header file "bpf_trace_helpers.h".
> It is under selftests/bpf/ for now.  It could be moved to libbpf later
> after seeing more upcoming non-tracing use cases.
>
> The tests are changed to use these new macros also.  Hence,
> the k[s]u8/16/32/64 are no longer needed and they are removed
> from the bpf_helpers.h.
>
> Signed-off-by: Martin KaFai Lau <kafai@xxxxxx>
> ---
>  tools/lib/bpf/bpf_helpers.h                   | 13 ---
>  .../testing/selftests/bpf/bpf_trace_helpers.h | 58 +++++++++++++
>  .../testing/selftests/bpf/progs/fentry_test.c | 72 ++++------------
>  .../selftests/bpf/progs/fexit_bpf2bpf.c       | 27 ++----
>  .../testing/selftests/bpf/progs/fexit_test.c  | 83 +++++--------------
>  tools/testing/selftests/bpf/progs/kfree_skb.c | 43 +++-------
>  .../selftests/bpf/progs/test_overhead.c       | 16 ++--
>  7 files changed, 125 insertions(+), 187 deletions(-)

Very nice cleanup!
Applied. Thanks!



[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