]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: Work-around EBUSY errors from hashmap update/delete
authorAndrii Nakryiko <andrii@kernel.org>
Wed, 23 Dec 2020 20:06:52 +0000 (12:06 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 24 Dec 2020 00:35:46 +0000 (01:35 +0100)
commit2238b32d14aa065bcb4ad4236ac1425adc6c87b4
tree91c0274f47f51b4f94bde30281d421c312b6188a
parent696d268f6b381cb8ea10300ccf8a625a41a37480
selftests/bpf: Work-around EBUSY errors from hashmap update/delete

e750e4c48365 ("bpf: Avoid hashtab deadlock with map_locked") introduced
a possibility of getting EBUSY error on lock contention, which seems to happen
very deterministically in test_maps when running 1024 threads on low-CPU
machine. In libbpf CI case, it's a 2 CPU VM and it's hitting this 100% of the
time. Work around by retrying on EBUSY (and EAGAIN, while we are at it) after
a small sleep. sched_yield() is too agressive and fails even after 20 retries,
so I went with usleep(1) for backoff.

Also log actual error returned to make it easier to see what's going on.

Fixes: e750e4c48365 ("bpf: Avoid hashtab deadlock with map_locked")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20201223200652.3417075-1-andrii@kernel.org
tools/testing/selftests/bpf/test_maps.c