A later commit will apply a filter to events recorded to the trace
output. To prevent any user confusion, remove pre-existing filters when
enabling an event provided via the '-e' command line argument.

Suggested-by: Tomas Glozar <[email protected]>
Signed-off-by: Valentin Schneider <[email protected]>
---
 Documentation/tools/rtla/common_options.txt | 9 ++++++++-
 tools/tracing/rtla/src/trace.c              | 4 ++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/Documentation/tools/rtla/common_options.txt 
b/Documentation/tools/rtla/common_options.txt
index 38da1cf443a48..6bf0f86393333 100644
--- a/Documentation/tools/rtla/common_options.txt
+++ b/Documentation/tools/rtla/common_options.txt
@@ -26,12 +26,19 @@
 
 **--filter** *<filter>*
 
-        Filter the previous **-e** *sys:event* event with *<filter>*. For 
further information about event filtering see 
https://www.kernel.org/doc/html/latest/trace/events.html#event-filtering.
+        Filter the previous **-e** *sys:event* event with *<filter>*.
+
+        If the same event is specified more than once but with different 
filters, the last specified filter will be the only one applied.
+
+       For further information about event filtering see 
https://www.kernel.org/doc/html/latest/trace/events.html#event-filtering.
 
         This option cannot be unset.
 
 **--trigger** *<trigger>*
         Enable a trace event trigger to the previous **-e** *sys:event*.
+
+        If the same event is specified more than once but with different 
triggers, the last specified trigger will be the only one applied.
+
         If the *hist:* trigger is activated, the output histogram will be 
automatically saved to a file named *system_event_hist.txt*.
         For example, the command:
 
diff --git a/tools/tracing/rtla/src/trace.c b/tools/tracing/rtla/src/trace.c
index 17d148f7d5d6e..06204d339f967 100644
--- a/tools/tracing/rtla/src/trace.c
+++ b/tools/tracing/rtla/src/trace.c
@@ -487,6 +487,10 @@ static int trace_event_enable_filter(struct trace_instance 
*instance,
        char filter[MAX_PATH];
        int retval;
 
+       /* Unconditionally clean any pre-existing filters */
+       tracefs_event_file_write(instance->inst, tevent->system,
+                                tevent->event, "filter", "0");
+
        if (!tevent->filter)
                return 0;
 
-- 
2.55.0


Reply via email to