diff options
| author | Hou Tao <[email protected]> | 2022-09-01 06:19:38 +0000 |
|---|---|---|
| committer | Martin KaFai Lau <[email protected]> | 2022-09-01 19:16:21 +0000 |
| commit | 73b97bc78b32eb739a7dd3394fa3981e8021c0ef (patch) | |
| tree | 9e9824013d4e2ac7974944f22f2f90dfab154814 /tools/testing/selftests/bpf/prog_tests/global_data_init.c | |
| parent | selftests/bpf: Move sys_pidfd_open() into task_local_storage_helpers.h (diff) | |
| download | kernel-73b97bc78b32eb739a7dd3394fa3981e8021c0ef.tar.gz kernel-73b97bc78b32eb739a7dd3394fa3981e8021c0ef.zip | |
selftests/bpf: Test concurrent updates on bpf_task_storage_busy
Under full preemptible kernel, task local storage lookup operations on
the same CPU may update per-cpu bpf_task_storage_busy concurrently. If
the update of bpf_task_storage_busy is not preemption safe, the final
value of bpf_task_storage_busy may become not-zero forever and
bpf_task_storage_trylock() will always fail. So add a test case to
ensure the update of bpf_task_storage_busy is preemption safe.
Will skip the test case when CONFIG_PREEMPT is disabled, and it can only
reproduce the problem probabilistically. By increasing
TASK_STORAGE_MAP_NR_LOOP and running it under ARM64 VM with 4-cpus, it
takes about four rounds to reproduce:
> test_maps is modified to only run test_task_storage_map_stress_lookup()
$ export TASK_STORAGE_MAP_NR_THREAD=256
$ export TASK_STORAGE_MAP_NR_LOOP=81920
$ export TASK_STORAGE_MAP_PIN_CPU=1
$ time ./test_maps
test_task_storage_map_stress_lookup(135):FAIL:bad bpf_task_storage_busy got -2
real 0m24.743s
user 0m6.772s
sys 0m17.966s
Signed-off-by: Hou Tao <[email protected]>
Acked-by: Alexei Starovoitov <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Martin KaFai Lau <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/global_data_init.c')
0 files changed, 0 insertions, 0 deletions
