linux/tools/tracing/rtla/src
Tomas Glozar 0122938a7a rtla: Always set all tracer options
rtla currently only sets tracer options that are explicitly set by the
user, with the exception of OSNOISE_WORKLOAD.

This leads to improper behavior in case rtla is run with those options
not set to the default value. rtla does reset them to the original
value upon exiting, but that does not protect it from starting with
non-default values set either by an improperly exited rtla or by another
user of the tracers.

For example, after running this command:

$ echo 1 > /sys/kernel/tracing/osnoise/stop_tracing_us

all runs of rtla will stop at the 1us threshold, even if not requested
by the user:

$ rtla osnoise hist
Index   CPU-000   CPU-001
1             8         5
2             5         9
3             1         2
4             6         1
5             2         1
6             0         1
8             1         1
12            0         1
14            1         0
15            1         0
over:         0         0
count:       25        21
min:          1         1
avg:       3.68      3.05
max:         15        12
rtla osnoise hit stop tracing

Fix the problem by setting the default value for all tracer options if
the user has not provided their own value.

For most of the options, it's enough to just drop the if clause checking
for the value being set. For cpus, "all" is used as the default value,
and for osnoise default period and runtime, default values of
the osnoise_data variable in trace_osnoise.c are used.

Cc: Luis Goncalves <lgoncalv@redhat.com>
Link: https://lore.kernel.org/20250320092500.101385-5-tglozar@redhat.com
Fixes: 1eceb2fc2c ("rtla/osnoise: Add osnoise top mode")
Fixes: 829a6c0b56 ("rtla/osnoise: Add the hist mode")
Fixes: a828cd18bc ("rtla: Add timerlat tool and timelart top mode")
Fixes: 1eeb6328e8 ("rtla/timerlat: Add timerlat hist mode")
Signed-off-by: Tomas Glozar <tglozar@redhat.com>
Reviewed-by: John Kacur <jkacur@redhat.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2025-03-26 10:36:39 -04:00
..
Build rtla/timerlat: Add BPF skeleton to collect samples 2025-03-04 12:35:18 -05:00
osnoise.c rtla: Always set all tracer options 2025-03-26 10:36:39 -04:00
osnoise.h rtla: Unify apply_config between top and hist 2025-03-26 10:36:39 -04:00
osnoise_hist.c rtla: Unify apply_config between top and hist 2025-03-26 10:36:39 -04:00
osnoise_top.c rtla: Unify apply_config between top and hist 2025-03-26 10:36:39 -04:00
rtla.c rtla: Add hwnoise tool 2023-02-13 23:56:46 -05:00
timerlat.bpf.c rtla/timerlat: Add BPF skeleton to collect samples 2025-03-04 12:35:18 -05:00
timerlat.c rtla: Always set all tracer options 2025-03-26 10:36:39 -04:00
timerlat.h rtla: Unify apply_config between top and hist 2025-03-26 10:36:39 -04:00
timerlat_aa.c rtla/timerlat: Unify params struct 2025-03-04 12:35:17 -05:00
timerlat_aa.h rtla/timerlat: Give timerlat auto analysis its own instance 2023-06-13 16:31:35 -04:00
timerlat_bpf.c rtla/timerlat: Add BPF skeleton to collect samples 2025-03-04 12:35:18 -05:00
timerlat_bpf.h rtla/timerlat: Add BPF skeleton to collect samples 2025-03-04 12:35:18 -05:00
timerlat_hist.c rtla: Unify apply_config between top and hist 2025-03-26 10:36:39 -04:00
timerlat_top.c rtla: Unify apply_config between top and hist 2025-03-26 10:36:39 -04:00
timerlat_u.c rtla/timerlat: Do not stop user-space if a cpu is offline 2023-09-22 14:43:46 +02:00
timerlat_u.h rtla/timerlat_top: Add timerlat user-space support 2023-06-13 16:38:51 -04:00
trace.c rtla: Fix segfault in save_trace_to_file call 2025-03-26 10:35:20 -04:00
trace.h rtla: Count all processed events 2025-01-24 13:46:24 -05:00
utils.c rtla/utils: Add idle state disabling via libcpupower 2024-10-17 17:13:15 -04:00
utils.h rtla/utils: Add idle state disabling via libcpupower 2024-10-17 17:13:15 -04:00