tools/tracing: Use tools/build makefiles like perf
cover tools/tracing: Use tools/build makefiles like perf
tools/tracing and tools/verification/rv are using standalone Makefiles. However, This approach has some drawbacks. For example, code duplication and lack of proper dependency handling, making things harder for users.
Linus suggested using perf's build system, and it is indeed the best way to go.
This series replaces tools/tracing and tools/verification/rv makefiles with makefiles inspired by perf and objtool that use tools/build/ infrastructure.
Thanks, Arnaldo, for the pointers via chat.
Daniel Bristot de Oliveira (3):
tools/tracing: Use tools/build makefiles on latency-collector tools/verification: Use tools/build makefiles on rv tools/rtla: Use tools/build makefiles to build rtla
tools/tracing/latency/.gitignore | 1 + tools/tracing/latency/Build | 1 + tools/tracing/latency/Makefile | 48 ++++--- tools/tracing/latency/Makefile.config | 28 ++++ tools/tracing/rtla/.gitignore | 4 +- tools/tracing/rtla/Build | 1 + tools/tracing/rtla/Makefile | 177 +++++-------------------- tools/tracing/rtla/Makefile.config | 44 ++++++ tools/tracing/rtla/Makefile.rtla | 77 +++++++++++ tools/tracing/rtla/Makefile.standalone | 24 ++++ tools/tracing/rtla/src/Build | 11 ++ tools/verification/rv/.gitignore | 2 + tools/verification/rv/Build | 1 + tools/verification/rv/Makefile | 166 +++++------------------ tools/verification/rv/Makefile.config | 44 ++++++ tools/verification/rv/Makefile.rv | 49 +++++++ tools/verification/rv/src/Build | 4 + 17 files changed, 387 insertions(+), 295 deletions(-) create mode 100644 tools/tracing/latency/Build create mode 100644 tools/tracing/latency/Makefile.config create mode 100644 tools/tracing/rtla/Build create mode 100644 tools/tracing/rtla/Makefile.config create mode 100644 tools/tracing/rtla/Makefile.rtla create mode 100644 tools/tracing/rtla/Makefile.standalone create mode 100644 tools/tracing/rtla/src/Build create mode 100644 tools/verification/rv/.gitignore create mode 100644 tools/verification/rv/Build create mode 100644 tools/verification/rv/Makefile.config create mode 100644 tools/verification/rv/Makefile.rv create mode 100644 tools/verification/rv/src/Build
Signature · 1 line
2.44.0
PATCH 1/3 tools/tracing: Use tools/build makefiles on latency-collector
Use tools/build/ makefiles to build latency-collector, inheriting the benefits of it. For example, having a proper way to handle dependencies.
Inspired on perf and objtool.
--- tools/tracing/latency/.gitignore | 1 + tools/tracing/latency/Build | 1 + tools/tracing/latency/Makefile | 48 +++++++++++++++++---------- tools/tracing/latency/Makefile.config | 28 ++++++++++++++++ 4 files changed, 61 insertions(+), 17 deletions(-) create mode 100644 tools/tracing/latency/Build create mode 100644 tools/tracing/latency/Makefile.config
tools/tracing/latency/.gitignore +1 -0
@@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0 latency-collector +FEATURE-DUMP
tools/tracing/latency/Build new file +1 -0
@@ -0,0 +1 @@ +latency-collector-y += latency-collector.o
tools/tracing/latency/Makefile +31 -17
55 lines not on this page · raw message
tools/tracing/latency/Makefile.config new file +28 -0
@@ -0,0 +1,28 @@ +STOP_ERROR := + +define lib_setup + $(eval EXTLIBS += -l$(1)) + $(eval LIB_INCLUDES += $(shell sh -c "$(PKG_CONFIG) --cflags lib$(1)")) +endef + +$(call feature_check,libtraceevent) +ifeq ($(feature-libtraceevent), 1) + $(call detected,CONFIG_LIBTRACEEVENT) + $(call lib_setup,traceevent) +else + STOP_ERROR := 1 + $(info libtraceevent is missing. Please install libtraceevent-dev/libtraceevent-devel) +endif + +$(call feature_check,libtracefs) +ifeq ($(feature-libtracefs), 1) + $(call detected,CONFIG_LIBTRACEFS) + $(call lib_setup,tracefs) +else + STOP_ERROR := 1 + $(info libtracefs is missing. Please install libtracefs-dev/libtracefs-devel) +endif + +ifeq ($(STOP_ERROR),1) + $(error Please, check the errors above.) +endif
Signature · 1 line
2.44.0
PATCH 2/3 tools/verification: Use tools/build makefiles on rv
In reply to Daniel Bristot de OliveiraUse tools/build/ makefiles to build rv, inheriting the benefits of it. For example, having a proper way to handle dependencies.
--- tools/verification/rv/.gitignore | 2 + tools/verification/rv/Build | 1 + tools/verification/rv/Makefile | 166 +++++--------------------- tools/verification/rv/Makefile.config | 44 +++++++ tools/verification/rv/Makefile.rv | 49 ++++++++ tools/verification/rv/src/Build | 4 + 6 files changed, 133 insertions(+), 133 deletions(-) create mode 100644 tools/verification/rv/.gitignore create mode 100644 tools/verification/rv/Build create mode 100644 tools/verification/rv/Makefile.config create mode 100644 tools/verification/rv/Makefile.rv create mode 100644 tools/verification/rv/src/Build
tools/verification/rv/.gitignore new file +2 -0
@@ -0,0 +1,2 @@ +rv +FEATURE-DUMP
tools/verification/rv/Build new file +1 -0
@@ -0,0 +1 @@ +rv-y += src/
tools/verification/rv/Makefile +33 -133
179 lines not on this page · raw message
tools/verification/rv/Makefile.config new file +44 -0
44 lines not on this page · raw message
tools/verification/rv/Makefile.rv new file +49 -0
49 lines not on this page · raw message
tools/verification/rv/src/Build new file +4 -0
@@ -0,0 +1,4 @@ +rv-y += trace.o +rv-y += utils.o +rv-y += in_kernel.o +rv-y += rv.o
Signature · 1 line
2.44.0
PATCH 3/3 tools/rtla: Use tools/build makefiles to build rtla
In reply to Daniel Bristot de OliveiraUse tools/build/ makefiles to build rtla, inheriting the benefits of it. For example, having a proper way to handle dependencies.
rtla is built using perf infra-structure when building inside the kernel tree.
At this point, rtla diverges from perf in two points: Documentation and tarball generation/build.
At the documentation level, rtla is one step ahead, placing the documentation at Documentation/tools/rtla/, using the same build tools as kernel documentation. The idea is to move perf documentation to the same scheme and then share the same makefiles.
rtla has a tarball target that the (old) RHEL8 uses. The tarball was kept using a simple standalone makefile for compatibility. The standalone makefile shares most of the code, e.g., flags, with regular buildings.
The tarball method was set as deprecated. If necessary, we can make a rtla tarball like perf, which includes the entire tools/build. But this would also require changes in the user side (the directory structure changes, and probably the deps to build the package).
Inspired on perf and objtool.
--- tools/tracing/rtla/.gitignore | 4 +- tools/tracing/rtla/Build | 1 + tools/tracing/rtla/Makefile | 177 +++++-------------------- tools/tracing/rtla/Makefile.config | 44 ++++++ tools/tracing/rtla/Makefile.rtla | 77 +++++++++++ tools/tracing/rtla/Makefile.standalone | 24 ++++ tools/tracing/rtla/src/Build | 11 ++ 7 files changed, 193 insertions(+), 145 deletions(-) create mode 100644 tools/tracing/rtla/Build create mode 100644 tools/tracing/rtla/Makefile.config create mode 100644 tools/tracing/rtla/Makefile.rtla create mode 100644 tools/tracing/rtla/Makefile.standalone create mode 100644 tools/tracing/rtla/src/Build
tools/tracing/rtla/.gitignore +3 -1
@@ -1 +1,3 @@ -/rtla +rtla +rtla-static +FEATURE-DUMP
tools/tracing/rtla/Build new file +1 -0
@@ -0,0 +1 @@ +rtla-y += src/
tools/tracing/rtla/Makefile +33 -144
190 lines not on this page · raw message
tools/tracing/rtla/Makefile.config new file +44 -0
44 lines not on this page · raw message
tools/tracing/rtla/Makefile.rtla new file +77 -0
77 lines not on this page · raw message
tools/tracing/rtla/Makefile.standalone new file +24 -0
@@ -0,0 +1,24 @@ +VERSION := $(shell cat VERSION) +CFLAGS += $$($(PKG_CONFIG) --cflags libtracefs) +EXTLIBS += $$($(PKG_CONFIG) --libs libtracefs) + +rtla: + +include Makefile.rtla + +SRC := $(wildcard src/*.c) +HDR := $(wildcard src/*.h) +OBJ := $(SRC:.c=.o) +DOCSRC := Documentation/ + +rtla: $(OBJ) + $(CC) -o rtla $(LDFLAGS) $(OBJ) $(LIBS) $(EXTLIBS) + $(info This is a deprecated method to compile RTLA, please compile from Linux kernel source) + +.PHONY: clean tarball +clean: doc_clean + @test ! -f rtla || rm rtla + @test ! -f rtla-static || rm rtla-static + @test ! -f src/rtla.o || rm src/rtla.o + @test ! -f $(TARBALL) || rm -f $(TARBALL) + @rm -rf *~ $(OBJ) *.tar.$(CEXT)
tools/tracing/rtla/src/Build new file +11 -0
@@ -0,0 +1,11 @@ +rtla-y += trace.o +rtla-y += utils.o +rtla-y += osnoise.o +rtla-y += osnoise_top.o +rtla-y += osnoise_hist.o +rtla-y += timerlat.o +rtla-y += timerlat_top.o +rtla-y += timerlat_hist.o +rtla-y += timerlat_u.o +rtla-y += timerlat_aa.o +rtla-y += rtla.o
Signature · 1 line
2.44.0