selftests/bpf: Strengthen timer_start_deadlock test

Strengthen timer_start_deadlock test and check for recursion now

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20260204055147.54960-5-alexei.starovoitov@gmail.com
This commit is contained in:
Alexei Starovoitov
2026-02-03 21:51:47 -08:00
committed by Andrii Nakryiko
parent 64873307e8
commit 6e65cf81ac

View File

@@ -31,7 +31,6 @@ SEC("tp_btf/hrtimer_cancel")
int BPF_PROG(tp_hrtimer_cancel, struct hrtimer *hrtimer)
{
struct bpf_timer *timer;
static bool called = false;
int key = 0;
if (!in_timer_start)
@@ -42,13 +41,9 @@ int BPF_PROG(tp_hrtimer_cancel, struct hrtimer *hrtimer)
/*
* Call bpf_timer_start() from the tracepoint within hrtimer logic
* on the same timer to make sure it doesn't deadlock,
* and do it once.
* on the same timer to make sure it doesn't deadlock.
*/
if (!called) {
called = true;
bpf_timer_start(timer, 1000000000, 0);
}
bpf_timer_start(timer, 1000000000, 0);
return 0;
}