diff options
author | Alexei Starovoitov | 2019-04-02 06:27:48 +0200 |
---|---|---|
committer | Daniel Borkmann | 2019-04-04 01:27:38 +0200 |
commit | e5e7a8f2d858a91b79c4afc51a3f15edcbf9cb60 (patch) | |
tree | af71adf7cb55049a8f60f76a4acc3cc330cea4e0 /tools/testing/selftests/bpf/test_progs.c | |
parent | libbpf: teach libbpf about log_level bit 2 (diff) | |
download | kernel-qcow2-linux-e5e7a8f2d858a91b79c4afc51a3f15edcbf9cb60.tar.gz kernel-qcow2-linux-e5e7a8f2d858a91b79c4afc51a3f15edcbf9cb60.tar.xz kernel-qcow2-linux-e5e7a8f2d858a91b79c4afc51a3f15edcbf9cb60.zip |
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>
Diffstat (limited to 'tools/testing/selftests/bpf/test_progs.c')
-rw-r--r-- | tools/testing/selftests/bpf/test_progs.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c index 5d10aee9e277..bf5c90998916 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c @@ -9,6 +9,7 @@ int error_cnt, pass_cnt; bool jit_enabled; +bool verifier_stats = false; struct ipv4_packet pkt_v4 = { .eth.h_proto = __bpf_constant_htons(ETH_P_IP), @@ -162,12 +163,15 @@ void *spin_lock_thread(void *arg) #include <prog_tests/tests.h> #undef DECLARE -int main(void) +int main(int ac, char **av) { srand(time(NULL)); jit_enabled = is_jit_enabled(); + if (ac == 2 && strcmp(av[1], "-s") == 0) + verifier_stats = true; + #define CALL #include <prog_tests/tests.h> #undef CALL |