From: Alexei Starovoitov Commit a14f9ba080c1 ("selftests/bpf: Run arena tests serially") made arena_htab, arena_list, arena_strsearch and the other arena tests serial. With KASAN every arena takes 512 MB of shadow memory while it lives, and several arenas at a time exhaust the memory of a small CI VM. The plain C forms of these tests make the same arenas. Their names are next to each other, so test_progs -j gives them to its workers at the same time. In a KASAN VM with 4 cpus and 5G ./test_progs -j -t plain_c leaves 0.4G of memory available at its lowest point. Make the five tests whose prog file has an arena map serial: 2.4G stay available. plain_c_arena_race has no arena. It stays parallel. Fixes: b5ae07f77d27 ("selftests/bpf: Test progs without bpf_for(), zero, can_loop and such") Signed-off-by: Alexei Starovoitov --- tools/testing/selftests/bpf/prog_tests/plain_c.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/plain_c.c b/tools/testing/selftests/bpf/prog_tests/plain_c.c index ebdcf2275dbe..6d165afd38f6 100644 --- a/tools/testing/selftests/bpf/prog_tests/plain_c.c +++ b/tools/testing/selftests/bpf/prog_tests/plain_c.c @@ -109,10 +109,11 @@ static void dynptr_run(void) plain_c_dynptr_success__destroy(skel); } -void test_plain_c_arena_htab(void) { RUN(arena_htab); } -void test_plain_c_arena_htab_asm(void) { RUN(arena_htab_asm); } +/* Files with an arena map are serial, as prog_tests/arena_*.c: 512 MB of KASAN shadow per arena */ +void serial_test_plain_c_arena_htab(void) { RUN(arena_htab); } +void serial_test_plain_c_arena_htab_asm(void) { RUN(arena_htab_asm); } -void test_plain_c_arena_list(void) +void serial_test_plain_c_arena_list(void) { RUN(arena_list); if (test__start_subtest("run")) @@ -129,7 +130,7 @@ void test_plain_c_arena_race(void) RUN(arena_race); } -void test_plain_c_arena_strsearch(void) { RUN(arena_strsearch); } +void serial_test_plain_c_arena_strsearch(void) { RUN(arena_strsearch); } void test_plain_c_bpf_ma_ttrace(void) { @@ -173,7 +174,7 @@ void test_plain_c_test_wakeup_source(void) } void test_plain_c_tracing_stack_arg_tailcall_tgt(void) { RUN(tracing_stack_arg_tailcall_tgt); } -void test_plain_c_verifier_arena_large(void) { RUN(verifier_arena_large); } +void serial_test_plain_c_verifier_arena_large(void) { RUN(verifier_arena_large); } void test_plain_c_verifier_iterating_callbacks(void) { RUN(verifier_iterating_callbacks); } void test_plain_c_verifier_loop_as_is(void) { RUN(verifier_loop_as_is); } void test_plain_c_xdp_lb_bench(void) { RUN(xdp_lb_bench); }