From: Wander Lairson Costa <wander@redhat.com>
To: Tomas Glozar <tglozar@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
John Kacur <jkacur@redhat.com>,
Luis Goncalves <lgoncalv@redhat.com>,
Crystal Wood <crwood@redhat.com>,
Costa Shulyupin <costa.shul@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-trace-kernel <linux-trace-kernel@vger.kernel.org>,
Attila Fazekas <afazekas@redhat.com>
Subject: Re: [PATCH] rtla/timerlat_top: Fix on-threshold actions firing on signal
Date: Wed, 15 Jul 2026 11:37:43 -0300 [thread overview]
Message-ID: <alebJDUA5lxhJFTa@wcosta-defaultstring.rmtbr.csb> (raw)
In-Reply-To: <20260713141047.687877-1-tglozar@redhat.com>
On Mon, Jul 13, 2026 at 04:10:47PM +0200, Tomas Glozar wrote:
> A bug was reported when rtla-timerlat-top tool performs on-threshold
> actions, even though no threshold was hit. This is reproduced even if no
> threshold is set at all:
>
> $ rtla timerlat top -q -c 0 --on-threshold shell,command='echo BAD'
> BAD
> Timer Latency
> ...
>
> The bug is due to incorrect logic in timerlat_top_bpf_main_loop().
> The loop uses timerlat_bpf_wait(), the return values of which are:
>
> - > 0 (number of ringbuffer entries): at least 1 CPU hit threshold
> - = 0: time out
> - < 0: wait was interrupted by a signal
>
> Commit 3138df6f0cd0 ("rtla/timerlat: Exit top main loop on any non-zero
> wait_retval") changed the condition for "threshold hit" from
> "wait_reval == 1" (exactly 1 CPU hit threshold) to "wait_retval != 0",
> to fix a race where multiple CPUs hit the threshold at the same time.
>
> That also made it incorrectly include a signal (< 0), coming from either
> duration expired (SIGALRM) or user interrupt (SIGINT).
>
> Check for wait_retval greater than zero in the if condition to cover all
> return values correctly.
>
> Fixes: 3138df6f0cd0 ("rtla/timerlat: Exit top main loop on any non-zero wait_retval")
> Reported-by: Attila Fazekas <afazekas@redhat.com>
> Signed-off-by: Tomas Glozar <tglozar@redhat.com>
> ---
> tools/tracing/rtla/src/timerlat_top.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
> index 18e1071a2e242..6206a0a565ad3 100644
> --- a/tools/tracing/rtla/src/timerlat_top.c
> +++ b/tools/tracing/rtla/src/timerlat_top.c
> @@ -536,7 +536,7 @@ timerlat_top_bpf_main_loop(struct osnoise_tool *tool)
> if (!params->quiet)
> timerlat_print_stats(tool);
>
> - if (wait_retval != 0) {
> + if (wait_retval > 0) {
> /* Stopping requested by tracer */
> retval = common_threshold_handler(tool);
> if (retval)
> --
> 2.55.0
>
Reviewed-by: Wander Lairson Costa <wander@redhat.com>
prev parent reply other threads:[~2026-07-15 14:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 14:10 [PATCH] rtla/timerlat_top: Fix on-threshold actions firing on signal Tomas Glozar
2026-07-15 14:37 ` Wander Lairson Costa [this message]
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=alebJDUA5lxhJFTa@wcosta-defaultstring.rmtbr.csb \
--to=wander@redhat.com \
--cc=afazekas@redhat.com \
--cc=costa.shul@redhat.com \
--cc=crwood@redhat.com \
--cc=jkacur@redhat.com \
--cc=lgoncalv@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglozar@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.