Linux Trace Kernel
 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

* Re: [PATCH] rtla: reject -e, --filter and --trigger without --trace
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Tomas Glozar @ 2026-11-23 14:58 UTC (permalink / raw)
  To: Chaosheng Qu; +Cc: Steven Rostedt, linux-trace-kernel, linux-kernel

On Mon, Nov 2, 2026 at 8:03 AM Chaosheng Qu <quchaosheng000406@163.com> wrote:
>
> 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.
>

This behavior is already documented, see
Documentation/tools/rtla/common_options.txt:

    **-e**, **--event** *sys:event*

            Enable an event in the trace (**-t**) session. The argument can
            be a specific event, e.g., **-e** *sched:sched_switch*, or
all events
            of a system group, e.g., **-e** *sched*. Multiple **-e**
are allowed.
            It is only active when **-t** or **-a** are set.

            This option cannot be unset.

Currently, the trace is the only consumer of the events, so nothing
really breaks when the user requests the events without -t/--trace or
equivalent.

>   # 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>
> ---

Any reason for not just keeping the current behavior? It has been
there ever since rtla implemented events. Changing it will break
existing uses that might always pass -e but only pass -t when needed.
I get that the behavior might be a bit counter-intuitive, but that
should be covered by the manpage.

(If anyone else has a different opinion, feel free to chime in.)

> [cut]

Tomas


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

* Re: [PATCH] rtla: reject -e, --filter and --trigger without --trace
  2026-11-23 14:58 ` Tomas Glozar
@ 2026-11-28  5:30   ` Chaosheng Qu
  0 siblings, 0 replies; 3+ messages in thread
From: Chaosheng Qu @ 2026-11-28  5:30 UTC (permalink / raw)
  To: Tomas Glozar; +Cc: Steven Rostedt, linux-trace-kernel, linux-kernel

No, and the compatibility argument settles it.  common_options.txt already
says the option is only active with -t/-a, so the silent no-op I objected to
is documented behaviour, and rejecting the combination would break
invocations that always pass -e and only add -t when they want a trace.

I am withdrawing the patch; there will be no v2.

Thanks,
Chaosheng


^ 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