Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests/bpf: Fix timer_start_deadlock failure due to hrtimer change

Since commit f2e388a019e4 ("hrtimer: Reduce trace noise in hrtimer_start()"),
hrtimer_cancel tracepoint is no longer called when a hrtimer is re-armed. So
instead of a hrtimer_cancel followed by hrtimer_start tracepoint events, there
is now only a since hrtimer_start tracepoint event with the new was_armed field
set to 1, to indicated that the hrtimer was previously armed.

Update timer_start_deadlock accordingly so it traces hrtimer_start tracepoint
instead, with was_armed used as guard.

Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Tested-by: Mykyta Yatsenko <yatsenko@meta.com>
Acked-by: Mykyta Yatsenko <yatsenko@meta.com>
Link: https://lore.kernel.org/r/20260415120329.129192-1-shung-hsi.yu@suse.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Shung-Hsi Yu and committed by
Alexei Starovoitov
813f3362 1f5ffc67

+4 -4
+4 -4
tools/testing/selftests/bpf/progs/timer_start_deadlock.c
··· 27 27 return 0; 28 28 } 29 29 30 - SEC("tp_btf/hrtimer_cancel") 31 - int BPF_PROG(tp_hrtimer_cancel, struct hrtimer *hrtimer) 30 + SEC("tp_btf/hrtimer_start") 31 + int BPF_PROG(tp_hrtimer_start, struct hrtimer *hrtimer, enum hrtimer_mode mode, bool was_armed) 32 32 { 33 33 struct bpf_timer *timer; 34 34 int key = 0; 35 35 36 - if (!in_timer_start) 36 + if (!in_timer_start || !was_armed) 37 37 return 0; 38 38 39 39 tp_called = 1; ··· 60 60 61 61 /* 62 62 * call hrtimer_start() twice, so that 2nd call does 63 - * remove_hrtimer() and trace_hrtimer_cancel() tracepoint. 63 + * trace_hrtimer_start(was_armed=1) tracepoint. 64 64 */ 65 65 in_timer_start = 1; 66 66 bpf_timer_start(timer, 1000000000, 0);