OSDN Git Service

selftests/bpf: add few verifier scale tests
authorAlexei Starovoitov <ast@kernel.org>
Tue, 2 Apr 2019 04:27:48 +0000 (21:27 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 3 Apr 2019 23:27:38 +0000 (01:27 +0200)
commite5e7a8f2d858a91b79c4afc51a3f15edcbf9cb60
treeaf71adf7cb55049a8f60f76a4acc3cc330cea4e0
parentda11b417583ece875f862d84578259a2ab27ad86
selftests/bpf: add few verifier scale tests

Add 3 basic tests that stress verifier scalability.

test_verif_scale1.c calls non-inlined jhash() function 90 times on
different position in the packet.
This test simulates network packet parsing.
jhash function is ~140 instructions and main program is ~1200 insns.

test_verif_scale2.c force inlines jhash() function 90 times.
This program is ~15k instructions long.

test_verif_scale3.c calls non-inlined jhash() function 90 times on
But this time jhash has to process 32-bytes from the packet
instead of 14-bytes in tests 1 and 2.
jhash function is ~230 insns and main program is ~1200 insns.

$ test_progs -s
can be used to see verifier stats.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/testing/selftests/bpf/prog_tests/bpf_verif_scale.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_jhash.h [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_verif_scale1.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_verif_scale2.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_verif_scale3.c [new file with mode: 0644]
tools/testing/selftests/bpf/test_progs.c
tools/testing/selftests/bpf/test_progs.h