selftests/bpf: Tracing prog can still do lookup under busy lock
authorMartin KaFai Lau <martin.lau@kernel.org>
Tue, 25 Oct 2022 18:45:24 +0000 (11:45 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 26 Oct 2022 06:11:47 +0000 (23:11 -0700)
commit387b532138eed5b12e1afa68cafb6a389507310f
treefdf22af5765c1f3c2e0c31b61f25e4e249459a20
parent0334b4d8822a22b3593aec7361c50e9ebc31ee88
selftests/bpf: Tracing prog can still do lookup under busy lock

This patch modifies the task_ls_recursion test to check that
the first bpf_task_storage_get(&map_a, ...) in BPF_PROG(on_update)
can still do the lockless lookup even it cannot acquire the percpu
busy lock.  If the lookup succeeds, it will increment the value
by 1 and the value in the task storage map_a will become 200+1=201.
After that, BPF_PROG(on_update) tries to delete from map_a and
should get -EBUSY because it cannot acquire the percpu busy lock
after finding the data.

Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/r/20221025184524.3526117-10-martin.lau@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/task_local_storage.c
tools/testing/selftests/bpf/progs/task_ls_recursion.c