Re: [PATCH bpf-next 8/9] selftests/bpf: add a test with a bpf program with btf_tag attributes

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

 



On Tue, Sep 7, 2021 at 4:01 PM Yonghong Song <yhs@xxxxxx> wrote:
>
> Add a bpf program with btf_tag attributes. The program is
> loaded successfully with the kernel. With the command
>   bpftool btf dump file ./tag.o
> the following dump shows that tags are properly encoded:
>   [8] STRUCT 'key_t' size=12 vlen=3
>           'a' type_id=2 bits_offset=0
>           'b' type_id=2 bits_offset=32
>           'c' type_id=2 bits_offset=64
>   [9] TAG 'tag1' type_id=8, comp_id=-1
>   [10] TAG 'tag2' type_id=8, comp_id=-1
>   [11] TAG 'tag1' type_id=8, comp_id=1
>   [12] TAG 'tag2' type_id=8, comp_id=1
>   ...
>   [21] FUNC_PROTO '(anon)' ret_type_id=2 vlen=1
>           'x' type_id=2
>   [22] FUNC 'foo' type_id=21 linkage=static
>   [23] TAG 'tag1' type_id=22, comp_id=0
>   [24] TAG 'tag2' type_id=22, comp_id=0
>   [25] TAG 'tag1' type_id=22, comp_id=-1
>   [26] TAG 'tag2' type_id=22, comp_id=-1
>   ...
>   [29] VAR 'total' type_id=27, linkage=global
>   [30] TAG 'tag1' type_id=29, comp_id=-1
>   [31] TAG 'tag2' type_id=29, comp_id=-1
>
> If an old clang compiler, which does not support btf_tag attribute,
> is used, these btf_tag attributes will be silently ignored.
>
> Signed-off-by: Yonghong Song <yhs@xxxxxx>
> ---

LGTM.

Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx>

>  .../selftests/bpf/prog_tests/btf_tag.c        | 14 +++++++
>  tools/testing/selftests/bpf/progs/tag.c       | 39 +++++++++++++++++++
>  2 files changed, 53 insertions(+)
>  create mode 100644 tools/testing/selftests/bpf/prog_tests/btf_tag.c
>  create mode 100644 tools/testing/selftests/bpf/progs/tag.c
>

[...]



[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