Skip to content

Commit 5779de8

Browse files
committed
Merge tag 'trace-tools-v6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull rtla trace tooling updates from Steven Rostedt: - Officially add Tomas Glozar as a maintainer to RTLA tool - Add for_each_monitored_cpu() helper In multiple places, RTLA tools iterate over the list of CPUs running tracer threads. Use single helper instead of repeating the for/if combination. - Remove unused variable option_index in argument parsing RTLA tools use getopt_long() for argument parsing. For its last argument, an unused variable "option_index" is passed. Remove the variable and pass NULL to getopt_long() to shorten the naturally long parsing functions, and make them more readable. - Fix unassigned nr_cpus after code consolidation In recent code consolidation, timerlat tool cleanup, previously implemented separately for each tool, was moved to a common function timerlat_free(). The cleanup relies on nr_cpus being set. This was not done in the new function, leaving the variable uninitialized. Initialize the variable properly, and remove silencing of compiler warning for uninitialized variables. - Stop tracing on user latency in BPF mode Despite the name, rtla-timerlat's -T/--thread option sets timerlat's stop_tracing_total_us option, which also stops tracing on return-from-user latency, not only on thread latency. Implement the same behavior also in BPF sample collection stop tracing handler to avoid a discrepancy and restore correspondence of behavior with the equivalent option of cyclictest. - Fix threshold actions always triggering A bug in threshold action logic caused the action to execute even if tracing did not stop because of threshold. Fix the logic to stop correctly. - Fix few minor issues in tests Extend tests that were shown to need it to 5s, fix osnoise test calling timerlat by mistake, and use new, more reliable output checking in timerlat's "top stop at failed action" test. - Do not print usage on argument parsing error RTLA prints the entire usage message on encountering errors in argument parsing, like a malformed CPU list. The usage message has gotten too long. Instead of printing it, use newly added fatal() helper function to simply exit with the error message, excluding the usage. - Fix unintuitive -C/--cgroup interface "-C cgroup" and "--cgroup cgroup" are invalid syntax, despite that being a common way to specify an option with argument. Moreover, using them fails silently and no cgroup is set. Create new helper function to unify the handling of all such options and allow all of: -Xsomething -X=something -X something as well as the equivalent for the long option. - Fix -a overriding -t argument filename Fix a bug where -a following -t custom_file.txt overrides the custom filename with the default timerlat_trace.txt. - Stop tracing correctly on multiple events at once In some race scenarios, RTLA BPF sample collection might send multiple stop tracing events via the BPF ringbuffer at once. Compare the number of events for != 0 instead of == 1 to cover for this scenario and stop tracing properly. * tag 'trace-tools-v6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: rtla/timerlat: Exit top main loop on any non-zero wait_retval rtla/tests: Don't rely on matching ^1ALL rtla: Fix -a overriding -t argument rtla: Fix -C/--cgroup interface tools/rtla: Replace osnoise_hist_usage("...") with fatal("...") tools/rtla: Replace osnoise_top_usage("...") with fatal("...") tools/rtla: Replace timerlat_hist_usage("...") with fatal("...") tools/rtla: Replace timerlat_top_usage("...") with fatal("...") tools/rtla: Add fatal() and replace error handling pattern rtla/tests: Fix osnoise test calling timerlat rtla/tests: Extend action tests to 5s tools/rtla: Fix --on-threshold always triggering rtla/timerlat_bpf: Stop tracing on user latency tools/rtla: Fix unassigned nr_cpus tools/rtla: Remove unused optional option_index tools/rtla: Add for_each_monitored_cpu() helper MAINTAINERS: Add Tomas Glozar as a maintainer to RTLA tool
2 parents ed1b409 + 3138df6 commit 5779de8

16 files changed

Lines changed: 251 additions & 373 deletions

File tree

Documentation/tools/rtla/common_options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
If not set, tracer threads keep their default priority. For rtla user threads, it is set to SCHED_FIFO with priority 95. For kernel threads, see *osnoise* and *timerlat* tracer documentation for the running kernel version.
5050

51-
**-C**, **--cgroup**\[*=cgroup*]
51+
**-C**, **--cgroup** \[*cgroup*]
5252

5353
Set a *cgroup* to the tracer's threads. If the **-C** option is passed without arguments, the tracer's thread will inherit **rtla**'s *cgroup*. Otherwise, the threads will be placed on the *cgroup* passed to the option.
5454

MAINTAINERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21802,8 +21802,12 @@ F: tools/testing/selftests/rtc/
2180221802

2180321803
Real-time Linux Analysis (RTLA) tools
2180421804
M: Steven Rostedt <rostedt@goodmis.org>
21805+
M: Tomas Glozar <tglozar@redhat.com>
2180521806
L: linux-trace-kernel@vger.kernel.org
21807+
L: linux-kernel@vger.kernel.org
2180621808
S: Maintained
21809+
Q: https://patchwork.kernel.org/project/linux-trace-kernel/list/
21810+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
2180721811
F: Documentation/tools/rtla/
2180821812
F: tools/tracing/rtla/
2180921813

tools/tracing/rtla/Makefile.rtla

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export CC AR STRIP PKG_CONFIG LD_SO_CONF_PATH LDCONFIG
1818
FOPTS := -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \
1919
-fasynchronous-unwind-tables -fstack-clash-protection
2020
WOPTS := -O -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 \
21-
-Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized
21+
-Wp,-D_GLIBCXX_ASSERTIONS
2222

2323
ifeq ($(CC),clang)
2424
FOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(FOPTS))

tools/tracing/rtla/src/common.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ int top_main_loop(struct osnoise_tool *tool)
268268
tool->ops->print_stats(tool);
269269

270270
if (osnoise_trace_is_off(tool, record)) {
271+
if (stop_tracing)
272+
/* stop tracing requested, do not perform actions */
273+
return 0;
274+
271275
actions_perform(&params->threshold_actions);
272276

273277
if (!params->threshold_actions.continue_flag)
@@ -315,20 +319,22 @@ int hist_main_loop(struct osnoise_tool *tool)
315319
}
316320

317321
if (osnoise_trace_is_off(tool, tool->record)) {
322+
if (stop_tracing)
323+
/* stop tracing requested, do not perform actions */
324+
break;
325+
318326
actions_perform(&params->threshold_actions);
319327

320-
if (!params->threshold_actions.continue_flag) {
328+
if (!params->threshold_actions.continue_flag)
321329
/* continue flag not set, break */
322330
break;
323331

324-
/* continue action reached, re-enable tracing */
325-
if (tool->record)
326-
trace_instance_start(&tool->record->trace);
327-
if (tool->aa)
328-
trace_instance_start(&tool->aa->trace);
329-
trace_instance_start(&tool->trace);
330-
}
331-
break;
332+
/* continue action reached, re-enable tracing */
333+
if (tool->record)
334+
trace_instance_start(&tool->record->trace);
335+
if (tool->aa)
336+
trace_instance_start(&tool->aa->trace);
337+
trace_instance_start(&tool->trace);
332338
}
333339

334340
/* is there still any user-threads ? */

tools/tracing/rtla/src/common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ struct common_params {
107107
struct timerlat_u_params user;
108108
};
109109

110+
#define for_each_monitored_cpu(cpu, nr_cpus, common) \
111+
for (cpu = 0; cpu < nr_cpus; cpu++) \
112+
if (!(common)->cpus || CPU_ISSET(cpu, &(common)->monitored_cpus))
113+
110114
struct tool_ops;
111115

112116
/*

0 commit comments

Comments
 (0)