summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/recvmsg_unix_prog.c
diff options
context:
space:
mode:
authorKumar Kartikeya Dwivedi <memxor@gmail.com>2024-11-09 15:14:29 -0800
committerAndrii Nakryiko <andrii@kernel.org>2024-11-11 08:18:51 -0800
commitf6b9a69a9e56b2083aca8a925fc1a28eb698e3ed (patch)
tree8b2ca0fbb9af8bf263c9a161715643cf81e4b0b2 /tools/testing/selftests/bpf/progs/recvmsg_unix_prog.c
parent937a1c29a287e8f48c4cea714c76a13e14d989ac (diff)
bpf: Refactor active lock management
When bpf_spin_lock was introduced originally, there was deliberation on whether to use an array of lock IDs, but since bpf_spin_lock is limited to holding a single lock at any given time, we've been using a single ID to identify the held lock. In preparation for introducing spin locks that can be taken multiple times, introduce support for acquiring multiple lock IDs. For this purpose, reuse the acquired_refs array and store both lock and pointer references. We tag the entry with REF_TYPE_PTR or REF_TYPE_LOCK to disambiguate and find the relevant entry. The ptr field is used to track the map_ptr or btf (for bpf_obj_new allocations) to ensure locks can be matched with protected fields within the same "allocation", i.e. bpf_obj_new object or map value. The struct active_lock is changed to an int as the state is part of the acquired_refs array, and we only need active_lock as a cheap way of detecting lock presence. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20241109231430.2475236-2-memxor@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/recvmsg_unix_prog.c')
0 files changed, 0 insertions, 0 deletions