diff options
author | Yonghong Song <yonghong.song@linux.dev> | 2023-07-27 18:12:50 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-07-27 18:54:16 -0700 |
commit | a5d0c26a2784890d803fca5e0dd27c590472b43d (patch) | |
tree | f59078adfeb058082bb940f839f30683838d02f1 /tools/testing/selftests/bpf/prog_tests/arg_parsing.c | |
parent | 86180493a2ef572d703ed3a486ab347b194ce4d9 (diff) |
selftests/bpf: Add a cpuv4 test runner for cpu=v4 testing
Similar to no-alu32 runner, if clang compiler supports -mcpu=v4,
a cpuv4 runner is created to test bpf programs compiled with
-mcpu=v4.
The following are some num-of-insn statistics for each newer
instructions based on existing selftests, excluding subsequent
cpuv4 insn specific tests.
insn pattern # of instructions
reg = (s8)reg 4
reg = (s16)reg 4
reg = (s32)reg 144
reg = *(s8 *)(reg + off) 13
reg = *(s16 *)(reg + off) 14
reg = *(s32 *)(reg + off) 15215
reg = bswap16 reg 142
reg = bswap32 reg 38
reg = bswap64 reg 14
reg s/= reg 0
reg s%= reg 0
gotol <offset> 58
Note that in llvm -mcpu=v4 implementation, the compiler is a little
bit conservative about generating 'gotol' insn (32-bit branch offset)
as it didn't precise count the number of insns (e.g., some insns are
debug insns, etc.). Compared to old 'goto' insn, newer 'gotol' insn
should have comparable verification states to 'goto' insn.
With current patch set, all selftests passed with -mcpu=v4
when running test_progs-cpuv4 binary. The -mcpu=v3 and -mcpu=v2 run
are also successful.
Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20230728011250.3718252-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/arg_parsing.c')
0 files changed, 0 insertions, 0 deletions