All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tomas Glozar" <tglozar@redhat.com>
Cc: linux-trace-kernel <linux-trace-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 01/10] rtla: Support auto-analysis as an action
Date: Fri, 27 Nov 2026 16:01:36 +0000	[thread overview]
Message-ID: <sashiko-outbox-237811@kernel.org> (raw)
In-Reply-To: <20261127153206.134322-2-tglozar@redhat.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] rtla: timerlat_top_bpf_main_loop() skips aa action when
  --aa-only is set
- [Low] rtla: repeated aa action on stopped trace wipes state in
  timerlat_auto_analysis()
--

commit 3b613e42d174f9f624d5fde84c78336d0d724233
Author: Tomas Glozar <tglozar@redhat.com>

rtla: Support auto-analysis as an action

This commit adds an "aa" action for --on-threshold and --on-end so that
timerlat auto-analysis can be ordered with other actions and run multiple
times when tracing continues, while skipping the default end-of-run
auto-analysis when an aa action is configured.

> diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/common.c
> index ac4172bcc4444..e085eb6c8f13f 100644
> --- a/tools/tracing/rtla/src/common.c
> +++ b/tools/tracing/rtla/src/common.c
[ ... ]
> @@ -290,17 +296,18 @@ int run_tool(struct tool_ops *ops, int argc, char *argv[])
>  
>  	ops->print_stats(tool);
>  
> -	actions_perform(&params->end_actions);
> -
>  	return_value = PASSED;
>  
>  	stopped = osnoise_trace_is_off(tool, tool->record) && !stop_tracing;
> +
> +	actions_perform(&params->end_actions, stopped);
> +
>  	if (stopped) {
>  		printf("%s hit stop tracing\n", ops->tracer);
>  		return_value = FAILED;
>  	}
>  
> -	if (ops->analyze)
> +	if (ops->analyze && !aa_action_present(params))
>  		ops->analyze(tool, stopped);

[Severity: Medium]
Does skipping ops->analyze(tool, stopped) here break --aa-only when
combined with --on-threshold aa?

In BPF/mixed mode (the default when BPF is available),
timerlat_top_bpf_main_loop() returns immediately after
timerlat_bpf_wait(-1) when params->aa_only is set, without calling
common_threshold_handler():

tools/tracing/rtla/src/timerlat_top.c:timerlat_top_bpf_main_loop() {
	if (params->aa_only) {
		/* Auto-analysis only, just wait for stop tracing */
		timerlat_bpf_wait(-1);
		return 0;
	}
    ...
}

Because threshold_actions never run in that path and run_tool() now skips
ops->analyze() when aa_action_present(params) is true, running rtla
timerlat top --aa-only <us> --on-threshold aa [--on-threshold continue]
performs no auto-analysis at all and ignores continue.

Also, in both BPF and tracefs modes, if --aa-only is used with
--on-threshold aa and the run finishes without hitting the threshold
(stopped is false), skipping ops->analyze(tool, false) here bypasses the
tracing_max_latency fallback in timerlat_analyze().

> diff --git a/tools/tracing/rtla/src/timerlat_aa.c b/tools/tracing/rtla/src/timerlat_aa.c
> index a121ff9d2c571..11ddceab208ac 100644
> --- a/tools/tracing/rtla/src/timerlat_aa.c
> +++ b/tools/tracing/rtla/src/timerlat_aa.c
[ ... ]
> @@ -752,6 +816,9 @@ void timerlat_auto_analysis(int irq_thresh, int thread_thresh)
>  	struct tep_handle *tep;
>  	int cpu;
>  
> +	/* reset any data left over from previous run */
> +	timerlat_aa_reset(taa_ctx);
> +
>  	timerlat_auto_analysis_collect_trace(taa_ctx);

[Severity: Low]
What happens if the aa action runs more than once on the same stopped
trace without an intervening continue (for example, when both
--on-threshold aa and --on-end aa are specified and tracing stops on a
threshold)?

The first call to timerlat_auto_analysis_collect_trace() drains the
per-CPU trace_pipe_raw buffers via tracefs_iterate_raw_events().  A
second timerlat_auto_analysis() call on the same stopped trace wipes
taa_ctx in timerlat_aa_reset() and reads zero events from the already
consumed pipe, producing empty analysis output (and printing empty comms
with PID 0 for every CPU if --dump-tasks is enabled).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127153206.134322-1-tglozar@redhat.com?part=1

  reply	other threads:[~2026-11-27 16:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 15:31 [RFC PATCH 00/10] rtla/timerlat: Add auto-analysis action and report spike timestamps Tomas Glozar
2026-11-27 15:31 ` [RFC PATCH 01/10] rtla: Support auto-analysis as an action Tomas Glozar
2026-11-27 16:01   ` sashiko-bot [this message]
2026-11-27 15:31 ` [RFC PATCH 02/10] rtla/tests: Add unit tests for aa action Tomas Glozar
2026-11-27 15:31 ` [RFC PATCH 03/10] rtla/tests: Add runtime " Tomas Glozar
2026-11-27 16:16   ` sashiko-bot
2026-11-27 15:32 ` [RFC PATCH 04/10] Documentation/rtla: Document " Tomas Glozar
2026-11-27 15:32 ` [RFC PATCH 05/10] rtla/trace: Add helper to read "now ts" stats field Tomas Glozar
2026-11-27 15:32 ` [RFC PATCH 06/10] rtla/trace: Add helper to gather "now ts" over a CPU set Tomas Glozar
2026-11-27 15:32 ` [RFC PATCH 07/10] rtla/trace: Allow storing start clock value of tracefs instances Tomas Glozar
2026-11-27 15:32 ` [RFC PATCH 08/10] rtla/timerlat: Save the trace clock at measurement start Tomas Glozar
2026-11-27 15:32 ` [RFC PATCH 09/10] rtla/timerlat_aa: Print time offset and seqnum of the spike Tomas Glozar
2026-11-27 15:32 ` [RFC PATCH 10/10] Documentation/rtla: Document auto-analysis timestamps Tomas Glozar
2026-11-30 17:00 ` [RFC PATCH 00/10] rtla/timerlat: Add auto-analysis action and report spike timestamps John Kacur

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=sashiko-outbox-237811@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --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.