Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH 1/2] rtla/timerlat_top: Trigger actions with --aa-only in BPF mode
@ 2026-11-27 11:32 Tomas Glozar
  2026-11-27 11:32 ` [PATCH 2/2] rtla/tests: Test --aa-only with actions Tomas Glozar
  0 siblings, 1 reply; 2+ messages in thread
From: Tomas Glozar @ 2026-11-27 11:32 UTC (permalink / raw)
  To: Steven Rostedt, Tomas Glozar
  Cc: John Kacur, Luis Goncalves, Crystal Wood, Costa Shulyupin,
	Wander Lairson Costa, linux-trace-kernel

The implementation of timerlat_top_bpf_main_loop() for aa-only mode is
reduced to one call of timerlat_bpf_wait(), after which the function
returns. This does not allow for any actions to be performed, including
trace output and continuation of tracing.

Modify the implementation so that --aa-only uses the same code path as
--quiet, with the exception of not calling timerlat_top_bpf_pull_data(),
as rtla does not collect any aggregated data in that mode.

This fixes a discrepancy with regards the tool's behavior in tracefs
mode, where actions are handled by the shared top_main_loop() function.

The discrepancy appeared back when actions were moved to the main loop
to allow the implementation of --on-threshold continue; --aa-only was
not taken into consideration.

Fixes: 8d933d5c89e8 ("rtla/timerlat: Add continue action")
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
---
 tools/tracing/rtla/src/timerlat_top.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src/timerlat_top.c
index 2afd619c16059..f9221c71dd1ed 100644
--- a/tools/tracing/rtla/src/timerlat_top.c
+++ b/tools/tracing/rtla/src/timerlat_top.c
@@ -515,23 +515,25 @@ static int
 timerlat_top_bpf_main_loop(struct osnoise_tool *tool)
 {
 	const struct common_params *params = tool->params;
-	int retval, wait_retval;
+	int sleep_time, retval, wait_retval;
 
-	if (params->aa_only) {
-		/* Auto-analysis only, just wait for stop tracing */
-		timerlat_bpf_wait(-1);
-		return 0;
+	if (params->quiet || params->aa_only) {
+		/* There is no data to periodically refresh */
+		sleep_time = -1;
+	} else {
+		sleep_time = params->sleep_time;
 	}
 
 	/* Pull and display data in a loop */
 	while (!stop_tracing) {
-		wait_retval = timerlat_bpf_wait(params->quiet ? -1 :
-						params->sleep_time);
+		wait_retval = timerlat_bpf_wait(sleep_time);
 
-		retval = timerlat_top_bpf_pull_data(tool);
-		if (retval) {
-			err_msg("Error pulling BPF data\n");
-			return retval;
+		if (!params->aa_only) {
+			retval = timerlat_top_bpf_pull_data(tool);
+			if (retval) {
+				err_msg("Error pulling BPF data\n");
+				return retval;
+			}
 		}
 
 		if (!params->quiet)
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] rtla/tests: Test --aa-only with actions
  2026-11-27 11:32 [PATCH 1/2] rtla/timerlat_top: Trigger actions with --aa-only in BPF mode Tomas Glozar
@ 2026-11-27 11:32 ` Tomas Glozar
  0 siblings, 0 replies; 2+ messages in thread
From: Tomas Glozar @ 2026-11-27 11:32 UTC (permalink / raw)
  To: Steven Rostedt, Tomas Glozar
  Cc: John Kacur, Luis Goncalves, Crystal Wood, Costa Shulyupin,
	Wander Lairson Costa, linux-trace-kernel

Add a runtime test that verifies that actions trigger with rtla timerlat
top --aa-only in both BPF and tracefs mode.

Signed-off-by: Tomas Glozar <tglozar@redhat.com>
---
 tools/tracing/rtla/tests/timerlat.t | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/tracing/rtla/tests/timerlat.t b/tools/tracing/rtla/tests/timerlat.t
index 1d317c851a0fa..aab026ead6c55 100644
--- a/tools/tracing/rtla/tests/timerlat.t
+++ b/tools/tracing/rtla/tests/timerlat.t
@@ -138,6 +138,8 @@ check_top_hist "with trace output at end" \
 	"timerlat TOOL -d 1s --on-end trace" 0 "^  Saving trace to timerlat_trace.txt$"
 check_top_q_hist "action with no threshold" \
 	"timerlat TOOL -d 1s --on-threshold shell,command='echo BAD'" 0 "" "BAD"
+check "action with --aa-only" \
+	"timerlat top --aa-only 1 --on-threshold shell,command='echo TestOutput'" 2 "^TestOutput$"
 
 # BPF action program tests
 if [ "$option" -eq 0 ]
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-27 11:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 11:32 [PATCH 1/2] rtla/timerlat_top: Trigger actions with --aa-only in BPF mode Tomas Glozar
2026-11-27 11:32 ` [PATCH 2/2] rtla/tests: Test --aa-only with actions Tomas Glozar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox