]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests/bpf: Strengthen timer_start_deadlock test
authorAlexei Starovoitov <ast@kernel.org>
Wed, 4 Feb 2026 05:51:47 +0000 (21:51 -0800)
committerAndrii Nakryiko <andrii@kernel.org>
Wed, 4 Feb 2026 21:12:50 +0000 (13:12 -0800)
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
tools/testing/selftests/bpf/progs/timer_start_deadlock.c

index 368563747a469eaabc38e4c07007a76356cf4d74..019518ee18cd5610657fc8509c33d45438890628 100644 (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;
 }