public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>
To: Shung-Hsi Yu <shung-hsi.yu@suse.com>, bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	Jiri Olsa <jolsa@kernel.org>, Thomas Gleixner <tglx@kernel.org>,
	Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next] selftests/bpf: Fix timer_start_deadlock failure due to hrtimer change
Date: Wed, 15 Apr 2026 15:33:20 +0100	[thread overview]
Message-ID: <3afdf4fa-7e4e-4e56-8aaa-c8a04085432d@gmail.com> (raw)
In-Reply-To: <20260415120329.129192-1-shung-hsi.yu@suse.com>

On 4/15/26 1:03 PM, Shung-Hsi Yu wrote:
> 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>
> ---
> Currently only fails on Linus' tree since hrtimer changes haven't made
> its way into bpf-next yet.
> ---

This patch fixes the failing test.

Tested-by: Mykyta Yatsenko <yatsenko@meta.com>

The logic is also looks correct, tracepoint used to run on timer_cancel, 
which was called due to the second timer_start, now it's running on 
timer_start with was_armed=true, so the logic is kept the same.

Acked-by: Mykyta Yatsenko <yatsenko@meta.com>

>   tools/testing/selftests/bpf/progs/timer_start_deadlock.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/progs/timer_start_deadlock.c b/tools/testing/selftests/bpf/progs/timer_start_deadlock.c
> index 019518ee18cd..afabd15bdac4 100644
> --- a/tools/testing/selftests/bpf/progs/timer_start_deadlock.c
> +++ b/tools/testing/selftests/bpf/progs/timer_start_deadlock.c
> @@ -27,13 +27,13 @@ static int timer_cb(void *map, int *key, struct elem *value)
>   	return 0;
>   }
>   
> -SEC("tp_btf/hrtimer_cancel")
> -int BPF_PROG(tp_hrtimer_cancel, struct hrtimer *hrtimer)
> +SEC("tp_btf/hrtimer_start")
> +int BPF_PROG(tp_hrtimer_start, struct hrtimer *hrtimer, enum hrtimer_mode mode, bool was_armed)
>   {
>   	struct bpf_timer *timer;
>   	int key = 0;
>   
> -	if (!in_timer_start)
> +	if (!in_timer_start || !was_armed)
>   		return 0;
>   
>   	tp_called = 1;
> @@ -60,7 +60,7 @@ int start_timer(void *ctx)
>   
>   	/*
>   	 * call hrtimer_start() twice, so that 2nd call does
> -	 * remove_hrtimer() and trace_hrtimer_cancel() tracepoint.
> +	 * trace_hrtimer_start(was_armed=1) tracepoint.
>   	 */
>   	in_timer_start = 1;
>   	bpf_timer_start(timer, 1000000000, 0);


  reply	other threads:[~2026-04-15 14:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-15 12:03 [PATCH bpf-next] selftests/bpf: Fix timer_start_deadlock failure due to hrtimer change Shung-Hsi Yu
2026-04-15 14:33 ` Mykyta Yatsenko [this message]
2026-04-15 15:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3afdf4fa-7e4e-4e56-8aaa-c8a04085432d@gmail.com \
    --to=mykyta.yatsenko5@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=shuah@kernel.org \
    --cc=shung-hsi.yu@suse.com \
    --cc=song@kernel.org \
    --cc=tglx@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox