Skip to content

Commit c3a9a3c

Browse files
committed
Merge tag 'trace-tools-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing tool updates from Steven Rostedt: - Various clean ups and fixes to rtla (Real Time Linux Analysis) * tag 'trace-tools-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: rtla: Remove procps-ng dependency rtla: Fix __set_sched_attr error message rtla: Minor grammar fix for rtla README rtla: Don't overwrite existing directory mode rtla: Avoid record NULL pointer dereference rtla/Makefile: Properly handle dependencies
2 parents 76bfd3d + dada03d commit c3a9a3c

9 files changed

Lines changed: 164 additions & 50 deletions

File tree

Documentation/tools/rtla/Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,21 @@ DOC_MAN1 = $(addprefix $(OUTPUT),$(_DOC_MAN1))
1717
RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
1818
RST2MAN_OPTS += --verbose
1919

20+
TEST_RST2MAN = $(shell sh -c "rst2man --version > /dev/null 2>&1 || echo n")
21+
2022
$(OUTPUT)%.1: %.rst
2123
ifndef RST2MAN_DEP
22-
$(error "rst2man not found, but required to generate man pages")
24+
$(info ********************************************)
25+
$(info ** NOTICE: rst2man not found)
26+
$(info **)
27+
$(info ** Consider installing the latest rst2man from your)
28+
$(info ** distribution, e.g., 'dnf install python3-docutils' on Fedora,)
29+
$(info ** or from source:)
30+
$(info **)
31+
$(info ** https://docutils.sourceforge.io/docs/dev/repository.html )
32+
$(info **)
33+
$(info ********************************************)
34+
$(error NOTICE: rst2man required to generate man pages)
2335
endif
2436
rst2man $(RST2MAN_OPTS) $< > $@
2537

tools/tracing/rtla/Makefile

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ $(call allow-override,LD_SO_CONF_PATH,/etc/ld.so.conf.d/)
2323
$(call allow-override,LDCONFIG,ldconfig)
2424

2525
INSTALL = install
26+
MKDIR = mkdir
2627
FOPTS := -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \
2728
-fasynchronous-unwind-tables -fstack-clash-protection
2829
WOPTS := -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized
@@ -31,7 +32,7 @@ TRACEFS_HEADERS := $$($(PKG_CONFIG) --cflags libtracefs)
3132

3233
CFLAGS := -O -g -DVERSION=\"$(VERSION)\" $(FOPTS) $(MOPTS) $(WOPTS) $(TRACEFS_HEADERS)
3334
LDFLAGS := -ggdb
34-
LIBS := $$($(PKG_CONFIG) --libs libtracefs) -lprocps
35+
LIBS := $$($(PKG_CONFIG) --libs libtracefs)
3536

3637
SRC := $(wildcard src/*.c)
3738
HDR := $(wildcard src/*.h)
@@ -57,6 +58,41 @@ else
5758
DOCSRC = $(SRCTREE)/../../../Documentation/tools/rtla/
5859
endif
5960

61+
LIBTRACEEVENT_MIN_VERSION = 1.5
62+
LIBTRACEFS_MIN_VERSION = 1.3
63+
64+
TEST_LIBTRACEEVENT = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEEVENT_MIN_VERSION) libtraceevent > /dev/null 2>&1 || echo n")
65+
ifeq ("$(TEST_LIBTRACEEVENT)", "n")
66+
.PHONY: warning_traceevent
67+
warning_traceevent:
68+
@echo "********************************************"
69+
@echo "** NOTICE: libtraceevent version $(LIBTRACEEVENT_MIN_VERSION) or higher not found"
70+
@echo "**"
71+
@echo "** Consider installing the latest libtraceevent from your"
72+
@echo "** distribution, e.g., 'dnf install libtraceevent' on Fedora,"
73+
@echo "** or from source:"
74+
@echo "**"
75+
@echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ "
76+
@echo "**"
77+
@echo "********************************************"
78+
endif
79+
80+
TEST_LIBTRACEFS = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEFS_MIN_VERSION) libtracefs > /dev/null 2>&1 || echo n")
81+
ifeq ("$(TEST_LIBTRACEFS)", "n")
82+
.PHONY: warning_tracefs
83+
warning_tracefs:
84+
@echo "********************************************"
85+
@echo "** NOTICE: libtracefs version $(LIBTRACEFS_MIN_VERSION) or higher not found"
86+
@echo "**"
87+
@echo "** Consider installing the latest libtracefs from your"
88+
@echo "** distribution, e.g., 'dnf install libtracefs' on Fedora,"
89+
@echo "** or from source:"
90+
@echo "**"
91+
@echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ "
92+
@echo "**"
93+
@echo "********************************************"
94+
endif
95+
6096
.PHONY: all
6197
all: rtla
6298

@@ -68,7 +104,7 @@ static: $(OBJ)
68104

69105
.PHONY: install
70106
install: doc_install
71-
$(INSTALL) -d -m 755 $(DESTDIR)$(BINDIR)
107+
$(MKDIR) -p $(DESTDIR)$(BINDIR)
72108
$(INSTALL) rtla -m 755 $(DESTDIR)$(BINDIR)
73109
$(STRIP) $(DESTDIR)$(BINDIR)/rtla
74110
@test ! -f $(DESTDIR)$(BINDIR)/osnoise || rm $(DESTDIR)$(BINDIR)/osnoise

tools/tracing/rtla/README.txt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
RTLA: Real-Time Linux Analysis tools
22

3-
The rtla is a meta-tool that includes a set of commands that
4-
aims to analyze the real-time properties of Linux. But, instead of
5-
testing Linux as a black box, rtla leverages kernel tracing
6-
capabilities to provide precise information about the properties
7-
and root causes of unexpected results.
3+
The rtla meta-tool includes a set of commands that aims to analyze
4+
the real-time properties of Linux. Instead of testing Linux as a black box,
5+
rtla leverages kernel tracing capabilities to provide precise information
6+
about the properties and root causes of unexpected results.
87

98
Installing RTLA
109

11-
RTLA depends on some libraries and tools. More precisely, it depends on the
12-
following libraries:
10+
RTLA depends on the following libraries and tools:
1311

1412
- libtracefs
1513
- libtraceevent
16-
- procps
1714

1815
It also depends on python3-docutils to compile man pages.
1916

tools/tracing/rtla/src/osnoise_hist.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ int osnoise_hist_main(int argc, char *argv[])
809809
retval = set_comm_sched_attr("osnoise/", &params->sched_param);
810810
if (retval) {
811811
err_msg("Failed to set sched parameters\n");
812-
goto out_hist;
812+
goto out_free;
813813
}
814814
}
815815

@@ -819,7 +819,7 @@ int osnoise_hist_main(int argc, char *argv[])
819819
record = osnoise_init_trace_tool("osnoise");
820820
if (!record) {
821821
err_msg("Failed to enable the trace instance\n");
822-
goto out_hist;
822+
goto out_free;
823823
}
824824

825825
if (params->events) {
@@ -869,6 +869,7 @@ int osnoise_hist_main(int argc, char *argv[])
869869
out_hist:
870870
trace_events_destroy(&record->trace, params->events);
871871
params->events = NULL;
872+
out_free:
872873
osnoise_free_histogram(tool->data);
873874
out_destroy:
874875
osnoise_destroy_tool(record);

tools/tracing/rtla/src/osnoise_top.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -572,22 +572,22 @@ int osnoise_top_main(int argc, char **argv)
572572
retval = osnoise_top_apply_config(tool, params);
573573
if (retval) {
574574
err_msg("Could not apply config\n");
575-
goto out_top;
575+
goto out_free;
576576
}
577577

578578
trace = &tool->trace;
579579

580580
retval = enable_osnoise(trace);
581581
if (retval) {
582582
err_msg("Failed to enable osnoise tracer\n");
583-
goto out_top;
583+
goto out_free;
584584
}
585585

586586
if (params->set_sched) {
587587
retval = set_comm_sched_attr("osnoise/", &params->sched_param);
588588
if (retval) {
589589
err_msg("Failed to set sched parameters\n");
590-
goto out_top;
590+
goto out_free;
591591
}
592592
}
593593

@@ -597,7 +597,7 @@ int osnoise_top_main(int argc, char **argv)
597597
record = osnoise_init_trace_tool("osnoise");
598598
if (!record) {
599599
err_msg("Failed to enable the trace instance\n");
600-
goto out_top;
600+
goto out_free;
601601
}
602602

603603
if (params->events) {
@@ -649,6 +649,7 @@ int osnoise_top_main(int argc, char **argv)
649649
out_top:
650650
trace_events_destroy(&record->trace, params->events);
651651
params->events = NULL;
652+
out_free:
652653
osnoise_free_top(tool->data);
653654
osnoise_destroy_tool(record);
654655
osnoise_destroy_tool(tool);

tools/tracing/rtla/src/timerlat_hist.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -821,30 +821,30 @@ int timerlat_hist_main(int argc, char *argv[])
821821
retval = timerlat_hist_apply_config(tool, params);
822822
if (retval) {
823823
err_msg("Could not apply config\n");
824-
goto out_hist;
824+
goto out_free;
825825
}
826826

827827
trace = &tool->trace;
828828

829829
retval = enable_timerlat(trace);
830830
if (retval) {
831831
err_msg("Failed to enable timerlat tracer\n");
832-
goto out_hist;
832+
goto out_free;
833833
}
834834

835835
if (params->set_sched) {
836836
retval = set_comm_sched_attr("timerlat/", &params->sched_param);
837837
if (retval) {
838838
err_msg("Failed to set sched parameters\n");
839-
goto out_hist;
839+
goto out_free;
840840
}
841841
}
842842

843843
if (params->dma_latency >= 0) {
844844
dma_latency_fd = set_cpu_dma_latency(params->dma_latency);
845845
if (dma_latency_fd < 0) {
846846
err_msg("Could not set /dev/cpu_dma_latency.\n");
847-
goto out_hist;
847+
goto out_free;
848848
}
849849
}
850850

@@ -854,7 +854,7 @@ int timerlat_hist_main(int argc, char *argv[])
854854
record = osnoise_init_trace_tool("timerlat");
855855
if (!record) {
856856
err_msg("Failed to enable the trace instance\n");
857-
goto out_hist;
857+
goto out_free;
858858
}
859859

860860
if (params->events) {
@@ -904,6 +904,7 @@ int timerlat_hist_main(int argc, char *argv[])
904904
close(dma_latency_fd);
905905
trace_events_destroy(&record->trace, params->events);
906906
params->events = NULL;
907+
out_free:
907908
timerlat_free_histogram(tool->data);
908909
osnoise_destroy_tool(record);
909910
osnoise_destroy_tool(tool);

tools/tracing/rtla/src/timerlat_top.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -612,30 +612,30 @@ int timerlat_top_main(int argc, char *argv[])
612612
retval = timerlat_top_apply_config(top, params);
613613
if (retval) {
614614
err_msg("Could not apply config\n");
615-
goto out_top;
615+
goto out_free;
616616
}
617617

618618
trace = &top->trace;
619619

620620
retval = enable_timerlat(trace);
621621
if (retval) {
622622
err_msg("Failed to enable timerlat tracer\n");
623-
goto out_top;
623+
goto out_free;
624624
}
625625

626626
if (params->set_sched) {
627627
retval = set_comm_sched_attr("timerlat/", &params->sched_param);
628628
if (retval) {
629629
err_msg("Failed to set sched parameters\n");
630-
goto out_top;
630+
goto out_free;
631631
}
632632
}
633633

634634
if (params->dma_latency >= 0) {
635635
dma_latency_fd = set_cpu_dma_latency(params->dma_latency);
636636
if (dma_latency_fd < 0) {
637637
err_msg("Could not set /dev/cpu_dma_latency.\n");
638-
goto out_top;
638+
goto out_free;
639639
}
640640
}
641641

@@ -645,7 +645,7 @@ int timerlat_top_main(int argc, char *argv[])
645645
record = osnoise_init_trace_tool("timerlat");
646646
if (!record) {
647647
err_msg("Failed to enable the trace instance\n");
648-
goto out_top;
648+
goto out_free;
649649
}
650650

651651
if (params->events) {
@@ -699,6 +699,7 @@ int timerlat_top_main(int argc, char *argv[])
699699
close(dma_latency_fd);
700700
trace_events_destroy(&record->trace, params->events);
701701
params->events = NULL;
702+
out_free:
702703
timerlat_free_top(top->data);
703704
osnoise_destroy_tool(record);
704705
osnoise_destroy_tool(top);

0 commit comments

Comments
 (0)