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>
This commit is contained in:

committed by
Daniel Borkmann

parent
da11b41758
commit
e5e7a8f2d8
@@ -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
|
||||
|
Reference in New Issue
Block a user