bpf: Add bpf_guard_preempt() convenience macro
authorAlexei Starovoitov <ast@kernel.org>
Wed, 24 Apr 2024 22:55:29 +0000 (15:55 -0700)
committerMartin KaFai Lau <martin.lau@kernel.org>
Thu, 25 Apr 2024 17:48:40 +0000 (10:48 -0700)
commit8ec3bf5c31d2a59c320ff59397f6ac362341d9d7
treebf3311fccbe189adc9b5c517807599e111d9da8f
parent52578f7f53ff8fe3a8f6f3bc8b5956615c07a16e
bpf: Add bpf_guard_preempt() convenience macro

Add bpf_guard_preempt() macro that uses newly introduced
bpf_preempt_disable/enable() kfuncs to guard a critical section.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20240424225529.16782-1-alexei.starovoitov@gmail.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
tools/testing/selftests/bpf/bpf_experimental.h
tools/testing/selftests/bpf/progs/preempt_lock.c