mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rtla: reject -e, --filter and --trigger without --trace
@ 2026-11-02  7:01 Chaosheng Qu
  2026-11-23 14:58 ` Tomas Glozar
  0 siblings, 1 reply; 3+ messages in thread
From: Chaosheng Qu @ 2026-11-02  7:01 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Tomas Glozar, linux-trace-kernel, linux-kernel

From: Chaosheng Qu <quchaosheng000406@163.com>
Subject: [PATCH] rtla: reject -e, --filter and --trigger without --trace
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Tomas Glozar <tglozar@redhat.com>,
    linux-trace-kernel@vger.kernel.org,
    linux-kernel@vger.kernel.org

-e, --filter and --trigger configure events of the trace instance that
--trace creates, and trace_events_enable() is only called from inside the
block that --trace or --on-end trace enters.  Without either of them the
options are parsed, stored in params->events and then never looked at
again: rtla runs to completion and exits 0, so the user is left believing
the events were enabled.

  # rtla osnoise top -e sched:sched_switch -d 1s
  ... runs for a second, exit 0, no trace file, event never enabled

  # rtla osnoise top -e nosuchsys:nosuchevent -d 1s
  ... exit 0, the typo goes unnoticed

Reject the combination instead.  This does not change what happens when
--trace is given: an invalid event still fails with "Error enabling
event", and a valid one still works.

Signed-off-by: Chaosheng Qu <quchaosheng000406@163.com>
---
diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/common.c
--- a/tools/tracing/rtla/src/common.c
+++ b/tools/tracing/rtla/src/common.c
@@ -203,6 +203,19 @@
 	}
 
 
+	/*
+	 * -e, --filter and --trigger configure events of the trace instance
+	 * that --trace creates.  Without it there is no instance to put them
+	 * in, and they used to be dropped without a word.
+	 */
+	if (params->events &&
+	    !params->threshold_actions.present[ACTION_TRACE_OUTPUT] &&
+	    !params->end_actions.present[ACTION_TRACE_OUTPUT]) {
+		err_msg("-e, --filter and --trigger need --trace or --on-end trace\n");
+		retval = 1;
+		goto out_free;
+	}
+
 	if (params->threshold_actions.present[ACTION_TRACE_OUTPUT] ||
 	    params->end_actions.present[ACTION_TRACE_OUTPUT]) {
 		tool->record = osnoise_init_trace_tool(ops->tracer);


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

end of thread, other threads:[~2026-11-28  5:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02  7:01 [PATCH] rtla: reject -e, --filter and --trigger without --trace Chaosheng Qu
2026-11-23 14:58 ` Tomas Glozar
2026-11-28  5:30   ` Chaosheng Qu

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

all inboxes | Powered by JetHome®