Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'trace-tools-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull trace tool updates from Steven Rostedt:
"Tracing:

- Update makefiles for latency-collector and RTLA, using tools/build/
makefiles like perf does, inheriting its benefits. For example,
having a proper way to handle library dependencies.

- The timerlat tracer has an interface for any tool to use. rtla
timerlat tool uses this interface dispatching its own threads as
workload. But, rtla timerlat could also be used for any other
process. So, add 'rtla timerlat -U' option, allowing the timerlat
tool to measure the latency of any task using the timerlat tracer
interface.

Verification:

- Update makefiles for verification/rv, using tools/build/ makefiles
like perf does, inheriting its benefits. For example, having a
proper way to handle dependencies"

* tag 'trace-tools-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
tools/rtla: Add -U/--user-load option to timerlat
tools/verification: Use tools/build makefiles on rv
tools/rtla: Use tools/build makefiles to build rtla
tools/tracing: Use tools/build makefiles on latency-collector

+630 -286
+6
Documentation/tools/rtla/common_timerlat_options.rst
··· 33 33 to wait on the timerlat_fd. Once the workload is awakes, it goes to sleep again 34 34 adding so the measurement for the kernel-to-user and user-to-kernel to the tracer 35 35 output. 36 + 37 + **-U**, **--user-load** 38 + 39 + Set timerlat to run without workload, waiting for the user to dispatch a per-cpu 40 + task that waits for a new period on the tracing/osnoise/per_cpu/cpu$ID/timerlat_fd. 41 + See linux/tools/rtla/sample/timerlat_load.py for an example of user-load code.
+4 -1
tools/tracing/latency/.gitignore
··· 1 - # SPDX-License-Identifier: GPL-2.0 1 + # SPDX-License-Identifier: GPL-2.0-only 2 2 latency-collector 3 + fixdep 4 + feature 5 + FEATURE-DUMP
+1
tools/tracing/latency/Build
··· 1 + latency-collector-y += latency-collector.o
+88 -19
tools/tracing/latency/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - # Makefile for vm tools 3 - # 4 - VAR_CFLAGS := $(shell pkg-config --cflags libtracefs 2>/dev/null) 5 - VAR_LDLIBS := $(shell pkg-config --libs libtracefs 2>/dev/null) 1 + # SPDX-License-Identifier: GPL-2.0-only 6 2 7 - TARGETS = latency-collector 8 - CFLAGS = -Wall -Wextra -g -O2 $(VAR_CFLAGS) 9 - LDFLAGS = -lpthread $(VAR_LDLIBS) 3 + ifeq ($(srctree),) 4 + srctree := $(patsubst %/,%,$(dir $(CURDIR))) 5 + srctree := $(patsubst %/,%,$(dir $(srctree))) 6 + srctree := $(patsubst %/,%,$(dir $(srctree))) 7 + endif 10 8 11 - all: $(TARGETS) 9 + include $(srctree)/tools/scripts/Makefile.include 12 10 13 - %: %.c 14 - $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) 11 + # O is an alias for OUTPUT 12 + OUTPUT := $(O) 13 + 14 + ifeq ($(OUTPUT),) 15 + OUTPUT := $(CURDIR) 16 + else 17 + # subdir is used by the ../Makefile in $(call descend,) 18 + ifneq ($(subdir),) 19 + OUTPUT := $(OUTPUT)/$(subdir) 20 + endif 21 + endif 22 + 23 + ifneq ($(patsubst %/,,$(lastword $(OUTPUT))),) 24 + OUTPUT := $(OUTPUT)/ 25 + endif 26 + 27 + LATENCY-COLLECTOR := $(OUTPUT)latency-collector 28 + LATENCY-COLLECTOR_IN := $(LATENCY-COLLECTOR)-in.o 29 + 30 + export CC := gcc 31 + export LD := ld 32 + export AR := ar 33 + export PKG_CONFIG := pkg-config 34 + 35 + FEATURE_TESTS := libtraceevent 36 + FEATURE_TESTS += libtracefs 37 + FEATURE_DISPLAY := libtraceevent 38 + FEATURE_DISPLAY += libtracefs 39 + 40 + ifeq ($(V),1) 41 + Q = 42 + else 43 + Q = @ 44 + endif 45 + 46 + all: $(LATENCY-COLLECTOR) 47 + 48 + include $(srctree)/tools/build/Makefile.include 49 + 50 + # check for dependencies only on required targets 51 + NON_CONFIG_TARGETS := clean install 52 + 53 + config := 1 54 + ifdef MAKECMDGOALS 55 + ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),) 56 + config := 0 57 + endif 58 + endif 59 + 60 + ifeq ($(config),1) 61 + include $(srctree)/tools/build/Makefile.feature 62 + include Makefile.config 63 + endif 64 + 65 + CFLAGS += $(INCLUDES) $(LIB_INCLUDES) 66 + 67 + export CFLAGS OUTPUT srctree 68 + 69 + $(LATENCY-COLLECTOR): $(LATENCY-COLLECTOR_IN) 70 + $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(LATENCY-COLLECTOR) $(LATENCY-COLLECTOR_IN) $(EXTLIBS) 71 + 72 + latency-collector.%: fixdep FORCE 73 + make -f $(srctree)/tools/build/Makefile.build dir=. $@ 74 + 75 + $(LATENCY-COLLECTOR_IN): fixdep FORCE 76 + make $(build)=latency-collector 77 + 78 + INSTALL := install 79 + MKDIR := mkdir 80 + STRIP := strip 81 + BINDIR := /usr/bin 82 + 83 + install: 84 + @$(MKDIR) -p $(DESTDIR)$(BINDIR) 85 + $(call QUIET_INSTALL,latency-collector)$(INSTALL) $(LATENCY-COLLECTOR) -m 755 $(DESTDIR)$(BINDIR) 86 + @$(STRIP) $(DESTDIR)$(BINDIR)/latency-collector 15 87 16 88 clean: 17 - $(RM) latency-collector 18 - 19 - prefix ?= /usr/local 20 - sbindir ?= ${prefix}/sbin 21 - 22 - install: all 23 - install -d $(DESTDIR)$(sbindir) 24 - install -m 755 -p $(TARGETS) $(DESTDIR)$(sbindir) 89 + $(call QUIET_CLEAN, latency-collector) 90 + $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete 91 + $(Q)@rm -f latency-collector fixdep FEATURE-DUMP 92 + $(Q)rm -rf feature 93 + .PHONY: FORCE clean install
+30
tools/tracing/latency/Makefile.config
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + 3 + STOP_ERROR := 4 + 5 + define lib_setup 6 + $(eval EXTLIBS += -l$(1)) 7 + $(eval LIB_INCLUDES += $(shell sh -c "$(PKG_CONFIG) --cflags lib$(1)")) 8 + endef 9 + 10 + $(call feature_check,libtraceevent) 11 + ifeq ($(feature-libtraceevent), 1) 12 + $(call detected,CONFIG_LIBTRACEEVENT) 13 + $(call lib_setup,traceevent) 14 + else 15 + STOP_ERROR := 1 16 + $(info libtraceevent is missing. Please install libtraceevent-dev/libtraceevent-devel) 17 + endif 18 + 19 + $(call feature_check,libtracefs) 20 + ifeq ($(feature-libtracefs), 1) 21 + $(call detected,CONFIG_LIBTRACEFS) 22 + $(call lib_setup,tracefs) 23 + else 24 + STOP_ERROR := 1 25 + $(info libtracefs is missing. Please install libtracefs-dev/libtracefs-devel) 26 + endif 27 + 28 + ifeq ($(STOP_ERROR),1) 29 + $(error Please, check the errors above.) 30 + endif
+6 -1
tools/tracing/rtla/.gitignore
··· 1 - /rtla 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + rtla 3 + rtla-static 4 + fixdep 5 + feature 6 + FEATURE-DUMP
+1
tools/tracing/rtla/Build
··· 1 + rtla-y += src/
+62 -133
tools/tracing/rtla/Makefile
··· 1 - NAME := rtla 2 - # Follow the kernel version 3 - VERSION := $(shell cat VERSION 2> /dev/null || make -sC ../../.. kernelversion | grep -v make) 1 + # SPDX-License-Identifier: GPL-2.0-only 4 2 5 - # From libtracefs: 6 - # Makefiles suck: This macro sets a default value of $(2) for the 7 - # variable named by $(1), unless the variable has been set by 8 - # environment or command line. This is necessary for CC and AR 9 - # because make sets default values, so the simpler ?= approach 10 - # won't work as expected. 11 - define allow-override 12 - $(if $(or $(findstring environment,$(origin $(1))),\ 13 - $(findstring command line,$(origin $(1)))),,\ 14 - $(eval $(1) = $(2))) 15 - endef 16 - 17 - # Allow setting CC and AR, or setting CROSS_COMPILE as a prefix. 18 - $(call allow-override,CC,$(CROSS_COMPILE)gcc) 19 - $(call allow-override,AR,$(CROSS_COMPILE)ar) 20 - $(call allow-override,STRIP,$(CROSS_COMPILE)strip) 21 - $(call allow-override,PKG_CONFIG,pkg-config) 22 - $(call allow-override,LD_SO_CONF_PATH,/etc/ld.so.conf.d/) 23 - $(call allow-override,LDCONFIG,ldconfig) 24 - 25 - INSTALL = install 26 - MKDIR = mkdir 27 - FOPTS := -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \ 28 - -fasynchronous-unwind-tables -fstack-clash-protection 29 - WOPTS := -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized 30 - 31 - ifeq ($(CC),clang) 32 - FOPTS := $(filter-out -ffat-lto-objects, $(FOPTS)) 33 - WOPTS := $(filter-out -Wno-maybe-uninitialized, $(WOPTS)) 3 + ifeq ($(srctree),) 4 + srctree := $(patsubst %/,%,$(dir $(CURDIR))) 5 + srctree := $(patsubst %/,%,$(dir $(srctree))) 6 + srctree := $(patsubst %/,%,$(dir $(srctree))) 34 7 endif 35 8 36 - TRACEFS_HEADERS := $$($(PKG_CONFIG) --cflags libtracefs) 9 + include $(srctree)/tools/scripts/Makefile.include 37 10 38 - CFLAGS := -O -g -DVERSION=\"$(VERSION)\" $(FOPTS) $(MOPTS) $(WOPTS) $(TRACEFS_HEADERS) $(EXTRA_CFLAGS) 39 - LDFLAGS := -flto=auto -ggdb $(EXTRA_LDFLAGS) 40 - LIBS := $$($(PKG_CONFIG) --libs libtracefs) 11 + # O is an alias for OUTPUT 12 + OUTPUT := $(O) 41 13 42 - SRC := $(wildcard src/*.c) 43 - HDR := $(wildcard src/*.h) 44 - OBJ := $(SRC:.c=.o) 45 - DIRS := src 46 - FILES := Makefile README.txt 47 - CEXT := bz2 48 - TARBALL := $(NAME)-$(VERSION).tar.$(CEXT) 49 - TAROPTS := -cvjf $(TARBALL) 50 - BINDIR := /usr/bin 51 - DATADIR := /usr/share 52 - DOCDIR := $(DATADIR)/doc 53 - MANDIR := $(DATADIR)/man 54 - LICDIR := $(DATADIR)/licenses 55 - SRCTREE := $(or $(BUILD_SRC),$(CURDIR)) 56 - 57 - # If running from the tarball, man pages are stored in the Documentation 58 - # dir. If running from the kernel source, man pages are stored in 59 - # Documentation/tools/rtla/. 60 - ifneq ($(wildcard Documentation/.*),) 61 - DOCSRC = Documentation/ 14 + ifeq ($(OUTPUT),) 15 + OUTPUT := $(CURDIR) 62 16 else 63 - DOCSRC = $(SRCTREE)/../../../Documentation/tools/rtla/ 17 + # subdir is used by the ../Makefile in $(call descend,) 18 + ifneq ($(subdir),) 19 + OUTPUT := $(OUTPUT)/$(subdir) 20 + endif 64 21 endif 65 22 66 - LIBTRACEEVENT_MIN_VERSION = 1.5 67 - LIBTRACEFS_MIN_VERSION = 1.3 68 - 69 - .PHONY: all warnings show_warnings 70 - all: warnings rtla 71 - 72 - TEST_LIBTRACEEVENT = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEEVENT_MIN_VERSION) libtraceevent > /dev/null 2>&1 || echo n") 73 - ifeq ("$(TEST_LIBTRACEEVENT)", "n") 74 - WARNINGS = show_warnings 75 - MISSING_LIBS += echo "** libtraceevent version $(LIBTRACEEVENT_MIN_VERSION) or higher"; 76 - MISSING_PACKAGES += "libtraceevent-devel" 77 - MISSING_SOURCE += echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ "; 23 + ifneq ($(patsubst %/,,$(lastword $(OUTPUT))),) 24 + OUTPUT := $(OUTPUT)/ 78 25 endif 79 26 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 - WARNINGS = show_warnings 83 - MISSING_LIBS += echo "** libtracefs version $(LIBTRACEFS_MIN_VERSION) or higher"; 84 - MISSING_PACKAGES += "libtracefs-devel" 85 - MISSING_SOURCE += echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ "; 27 + RTLA := $(OUTPUT)rtla 28 + RTLA_IN := $(RTLA)-in.o 29 + 30 + VERSION := $(shell sh -c "make -sC ../../.. kernelversion | grep -v make") 31 + DOCSRC := ../../../Documentation/tools/rtla/ 32 + 33 + FEATURE_TESTS := libtraceevent 34 + FEATURE_TESTS += libtracefs 35 + FEATURE_DISPLAY := libtraceevent 36 + FEATURE_DISPLAY += libtracefs 37 + 38 + ifeq ($(V),1) 39 + Q = 40 + else 41 + Q = @ 86 42 endif 87 43 88 - define show_dependencies 89 - @echo "********************************************"; \ 90 - echo "** NOTICE: Failed build dependencies"; \ 91 - echo "**"; \ 92 - echo "** Required Libraries:"; \ 93 - $(MISSING_LIBS) \ 94 - echo "**"; \ 95 - echo "** Consider installing the latest libtracefs from your"; \ 96 - echo "** distribution, e.g., 'dnf install $(MISSING_PACKAGES)' on Fedora,"; \ 97 - echo "** or from source:"; \ 98 - echo "**"; \ 99 - $(MISSING_SOURCE) \ 100 - echo "**"; \ 101 - echo "********************************************" 102 - endef 44 + all: $(RTLA) 103 45 104 - show_warnings: 105 - $(call show_dependencies); 46 + include $(srctree)/tools/build/Makefile.include 47 + include Makefile.rtla 106 48 107 - ifneq ("$(WARNINGS)", "") 108 - ERROR_OUT = $(error Please add the necessary dependencies) 49 + # check for dependencies only on required targets 50 + NON_CONFIG_TARGETS := clean install tarball doc doc_clean doc_install 109 51 110 - warnings: $(WARNINGS) 111 - $(ERROR_OUT) 52 + config := 1 53 + ifdef MAKECMDGOALS 54 + ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),) 55 + config := 0 56 + endif 112 57 endif 113 58 114 - rtla: $(OBJ) 115 - $(CC) -o rtla $(LDFLAGS) $(OBJ) $(LIBS) 59 + ifeq ($(config),1) 60 + include $(srctree)/tools/build/Makefile.feature 61 + include Makefile.config 62 + endif 116 63 117 - static: $(OBJ) 118 - $(CC) -o rtla-static $(LDFLAGS) --static $(OBJ) $(LIBS) -lpthread -ldl 64 + CFLAGS += $(INCLUDES) $(LIB_INCLUDES) 119 65 120 - .PHONY: install 121 - install: doc_install 122 - $(MKDIR) -p $(DESTDIR)$(BINDIR) 123 - $(INSTALL) rtla -m 755 $(DESTDIR)$(BINDIR) 124 - $(STRIP) $(DESTDIR)$(BINDIR)/rtla 125 - @test ! -f $(DESTDIR)$(BINDIR)/osnoise || rm $(DESTDIR)$(BINDIR)/osnoise 126 - ln -s rtla $(DESTDIR)$(BINDIR)/osnoise 127 - @test ! -f $(DESTDIR)$(BINDIR)/hwnoise || rm $(DESTDIR)$(BINDIR)/hwnoise 128 - ln -s rtla $(DESTDIR)$(BINDIR)/hwnoise 129 - @test ! -f $(DESTDIR)$(BINDIR)/timerlat || rm $(DESTDIR)$(BINDIR)/timerlat 130 - ln -s rtla $(DESTDIR)$(BINDIR)/timerlat 66 + export CFLAGS OUTPUT srctree 131 67 132 - .PHONY: clean tarball 133 - clean: doc_clean 134 - @test ! -f rtla || rm rtla 135 - @test ! -f rtla-static || rm rtla-static 136 - @test ! -f src/rtla.o || rm src/rtla.o 137 - @test ! -f $(TARBALL) || rm -f $(TARBALL) 138 - @rm -rf *~ $(OBJ) *.tar.$(CEXT) 68 + $(RTLA): $(RTLA_IN) 69 + $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RTLA) $(RTLA_IN) $(EXTLIBS) 139 70 140 - tarball: clean 141 - rm -rf $(NAME)-$(VERSION) && mkdir $(NAME)-$(VERSION) 142 - echo $(VERSION) > $(NAME)-$(VERSION)/VERSION 143 - cp -r $(DIRS) $(FILES) $(NAME)-$(VERSION) 144 - mkdir $(NAME)-$(VERSION)/Documentation/ 145 - cp -rp $(SRCTREE)/../../../Documentation/tools/rtla/* $(NAME)-$(VERSION)/Documentation/ 146 - tar $(TAROPTS) --exclude='*~' $(NAME)-$(VERSION) 147 - rm -rf $(NAME)-$(VERSION) 71 + static: $(RTLA_IN) 72 + $(eval LDFLAGS += -static) 73 + $(QUIET_LINK)$(CC) -static $(LDFLAGS) -o $(RTLA)-static $(RTLA_IN) $(EXTLIBS) 148 74 149 - .PHONY: doc doc_clean doc_install 150 - doc: 151 - $(MAKE) -C $(DOCSRC) 75 + rtla.%: fixdep FORCE 76 + make -f $(srctree)/tools/build/Makefile.build dir=. $@ 152 77 153 - doc_clean: 154 - $(MAKE) -C $(DOCSRC) clean 78 + $(RTLA_IN): fixdep FORCE 79 + make $(build)=rtla 155 80 156 - doc_install: 157 - $(MAKE) -C $(DOCSRC) install 81 + clean: doc_clean fixdep-clean 82 + $(call QUIET_CLEAN, rtla) 83 + $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete 84 + $(Q)rm -f rtla rtla-static fixdep FEATURE-DUMP rtla-* 85 + $(Q)rm -rf feature 86 + .PHONY: FORCE clean
+47
tools/tracing/rtla/Makefile.config
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + 3 + STOP_ERROR := 4 + 5 + LIBTRACEEVENT_MIN_VERSION = 1.5 6 + LIBTRACEFS_MIN_VERSION = 1.3 7 + 8 + define lib_setup 9 + $(eval LIB_INCLUDES += $(shell sh -c "$(PKG_CONFIG) --cflags lib$(1)")) 10 + $(eval EXTLIBS += -l$(1)) 11 + endef 12 + 13 + $(call feature_check,libtraceevent) 14 + ifeq ($(feature-libtraceevent), 1) 15 + $(call detected,CONFIG_LIBTRACEEVENT) 16 + 17 + TEST = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEEVENT_MIN_VERSION) libtraceevent > /dev/null 2>&1 && echo y || echo n") 18 + ifeq ($(TEST),n) 19 + $(info libtraceevent version is too low, it must be at least $(LIBTRACEEVENT_MIN_VERSION)) 20 + STOP_ERROR := 1 21 + endif 22 + 23 + $(call lib_setup,traceevent) 24 + else 25 + STOP_ERROR := 1 26 + $(info libtraceevent is missing. Please install libtraceevent-dev/libtraceevent-devel) 27 + endif 28 + 29 + $(call feature_check,libtracefs) 30 + ifeq ($(feature-libtracefs), 1) 31 + $(call detected,CONFIG_LIBTRACEFS) 32 + 33 + TEST = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEFS_MIN_VERSION) libtracefs > /dev/null 2>&1 && echo y || echo n") 34 + ifeq ($(TEST),n) 35 + $(info libtracefs version is too low, it must be at least $(LIBTRACEFS_MIN_VERSION)) 36 + STOP_ERROR := 1 37 + endif 38 + 39 + $(call lib_setup,tracefs) 40 + else 41 + STOP_ERROR := 1 42 + $(info libtracefs is missing. Please install libtracefs-dev/libtracefs-devel) 43 + endif 44 + 45 + ifeq ($(STOP_ERROR),1) 46 + $(error Please, check the errors above.) 47 + endif
+80
tools/tracing/rtla/Makefile.rtla
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + 3 + define allow-override 4 + $(if $(or $(findstring environment,$(origin $(1))),\ 5 + $(findstring command line,$(origin $(1)))),,\ 6 + $(eval $(1) = $(2))) 7 + endef 8 + 9 + # Allow setting CC and AR, or setting CROSS_COMPILE as a prefix. 10 + $(call allow-override,CC,$(CROSS_COMPILE)gcc) 11 + $(call allow-override,AR,$(CROSS_COMPILE)ar) 12 + $(call allow-override,STRIP,$(CROSS_COMPILE)strip) 13 + $(call allow-override,PKG_CONFIG,pkg-config) 14 + $(call allow-override,LD_SO_CONF_PATH,/etc/ld.so.conf.d/) 15 + $(call allow-override,LDCONFIG,ldconfig) 16 + export CC AR STRIP PKG_CONFIG LD_SO_CONF_PATH LDCONFIG 17 + 18 + FOPTS := -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \ 19 + -fasynchronous-unwind-tables -fstack-clash-protection 20 + WOPTS := -O -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 \ 21 + -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized 22 + 23 + ifeq ($(CC),clang) 24 + FOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(FOPTS)) 25 + WOPTS := $(filter-out -Wno-maybe-uninitialized, $(WOPTS)) 26 + endif 27 + 28 + CFLAGS := -g -DVERSION=\"$(VERSION)\" $(FOPTS) $(WOPTS) $(CFLAGS) 29 + LDFLAGS := -ggdb $(LDFLAGS) 30 + 31 + RM := rm -rf 32 + LN := ln -s 33 + INSTALL := install 34 + MKDIR := mkdir 35 + STRIP := strip 36 + BINDIR := /usr/bin 37 + 38 + .PHONY: install 39 + install: doc_install 40 + @$(MKDIR) -p $(DESTDIR)$(BINDIR) 41 + $(call QUIET_INSTALL,rtla)$(INSTALL) rtla -m 755 $(DESTDIR)$(BINDIR) 42 + @$(STRIP) $(DESTDIR)$(BINDIR)/rtla 43 + @test ! -f $(DESTDIR)$(BINDIR)/osnoise || $(RM) $(DESTDIR)$(BINDIR)/osnoise 44 + @$(LN) rtla $(DESTDIR)$(BINDIR)/osnoise 45 + @test ! -f $(DESTDIR)$(BINDIR)/hwnoise || $(RM) $(DESTDIR)$(BINDIR)/hwnoise 46 + @$(LN) -s rtla $(DESTDIR)$(BINDIR)/hwnoise 47 + @test ! -f $(DESTDIR)$(BINDIR)/timerlat || $(RM) $(DESTDIR)$(BINDIR)/timerlat 48 + @$(LN) -s rtla $(DESTDIR)$(BINDIR)/timerlat 49 + 50 + .PHONY: doc doc_clean doc_install 51 + doc: 52 + $(MAKE) -C $(DOCSRC) 53 + 54 + doc_clean: 55 + $(MAKE) -C $(DOCSRC) clean 56 + 57 + doc_install: 58 + $(MAKE) -C $(DOCSRC) install 59 + 60 + # This section is neesary for the tarball, when the tarball 61 + # support is removed, we can delete these entries. 62 + NAME := rtla 63 + DIRS := src 64 + FILES := Makefile README.txt 65 + CEXT := bz2 66 + TARBALL := $(NAME)-$(VERSION).tar.$(CEXT) 67 + TAROPTS := -cvjf $(TARBALL) 68 + SRCTREE := $(or $(BUILD_SRC),$(CURDIR)) 69 + 70 + tarball: clean 71 + $(RM) $(NAME)-$(VERSION) && $(MKDIR) $(NAME)-$(VERSION) 72 + echo $(VERSION) > $(NAME)-$(VERSION)/VERSION 73 + cp -r $(DIRS) $(FILES) $(NAME)-$(VERSION) 74 + $(MKDIR) $(NAME)-$(VERSION)/Documentation/ 75 + cp -rp $(SRCTREE)/../../../Documentation/tools/$(NAME)/* $(NAME)-$(VERSION)/Documentation/ 76 + cp Makefile.standalone $(NAME)-$(VERSION)/Makefile 77 + cp Makefile.$(NAME) $(NAME)-$(VERSION)/ 78 + tar $(TAROPTS) --exclude='*~' $(NAME)-$(VERSION) 79 + $(RM) $(NAME)-$(VERSION) 80 + .PHONY: tarball
+26
tools/tracing/rtla/Makefile.standalone
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + 3 + VERSION := $(shell cat VERSION) 4 + CFLAGS += $$($(PKG_CONFIG) --cflags libtracefs) 5 + EXTLIBS += $$($(PKG_CONFIG) --libs libtracefs) 6 + 7 + rtla: 8 + 9 + include Makefile.rtla 10 + 11 + SRC := $(wildcard src/*.c) 12 + HDR := $(wildcard src/*.h) 13 + OBJ := $(SRC:.c=.o) 14 + DOCSRC := Documentation/ 15 + 16 + rtla: $(OBJ) 17 + $(CC) -o rtla $(LDFLAGS) $(OBJ) $(LIBS) $(EXTLIBS) 18 + $(info This is a deprecated method to compile RTLA, please compile from Linux kernel source) 19 + 20 + .PHONY: clean tarball 21 + clean: doc_clean 22 + @test ! -f rtla || rm rtla 23 + @test ! -f rtla-static || rm rtla-static 24 + @test ! -f src/rtla.o || rm src/rtla.o 25 + @test ! -f $(TARBALL) || rm -f $(TARBALL) 26 + @rm -rf *~ $(OBJ) *.tar.$(CEXT)
+74
tools/tracing/rtla/sample/timerlat_load.py
··· 1 + #!/usr/bin/env python3 2 + # SPDX-License-Identifier: GPL-2.0-only 3 + # 4 + # Copyright (C) 2024 Red Hat, Inc. Daniel Bristot de Oliveira <bristot@kernel.org> 5 + # 6 + # This is a sample code about how to use timerlat's timer by any workload 7 + # so rtla can measure and provide auto-analysis for the overall latency (IOW 8 + # the response time) for a task. 9 + # 10 + # Before running it, you need to dispatch timerlat with -U option in a terminal. 11 + # Then # run this script pinned to a CPU on another terminal. For example: 12 + # 13 + # timerlat_load.py 1 -p 95 14 + # 15 + # The "Timerlat IRQ" is the IRQ latency, The thread latency is the latency 16 + # for the python process to get the CPU. The Ret from user Timer Latency is 17 + # the overall latency. In other words, it is the response time for that 18 + # activation. 19 + # 20 + # This is just an example, the load is reading 20MB of data from /dev/full 21 + # It is in python because it is easy to read :-) 22 + 23 + import argparse 24 + import sys 25 + import os 26 + 27 + parser = argparse.ArgumentParser(description='user-space timerlat thread in Python') 28 + parser.add_argument("cpu", help='CPU to run timerlat thread') 29 + parser.add_argument("-p", "--prio", help='FIFO priority') 30 + 31 + args = parser.parse_args() 32 + 33 + try: 34 + affinity_mask = { int(args.cpu) } 35 + except: 36 + print("Invalid cpu: " + args.cpu) 37 + exit(1) 38 + 39 + try: 40 + os.sched_setaffinity(0, affinity_mask); 41 + except: 42 + print("Error setting affinity") 43 + exit(1) 44 + 45 + if (args.prio): 46 + try: 47 + param = os.sched_param(int(args.prio)) 48 + os.sched_setscheduler(0, os.SCHED_FIFO, param) 49 + except: 50 + print("Error setting priority") 51 + exit(1) 52 + 53 + try: 54 + timerlat_path = "/sys/kernel/tracing/osnoise/per_cpu/cpu" + args.cpu + "/timerlat_fd" 55 + timerlat_fd = open(timerlat_path, 'r') 56 + except: 57 + print("Error opening timerlat fd, did you run timerlat -U?") 58 + exit(1) 59 + 60 + try: 61 + data_fd = open("/dev/full", 'r'); 62 + except: 63 + print("Error opening data fd") 64 + 65 + while True: 66 + try: 67 + timerlat_fd.read(1) 68 + data_fd.read(20*1024*1024) 69 + except: 70 + print("Leaving") 71 + break 72 + 73 + timerlat_fd.close() 74 + data_fd.close()
+11
tools/tracing/rtla/src/Build
··· 1 + rtla-y += trace.o 2 + rtla-y += utils.o 3 + rtla-y += osnoise.o 4 + rtla-y += osnoise_top.o 5 + rtla-y += osnoise_hist.o 6 + rtla-y += timerlat.o 7 + rtla-y += timerlat_top.o 8 + rtla-y += timerlat_hist.o 9 + rtla-y += timerlat_u.o 10 + rtla-y += timerlat_aa.o 11 + rtla-y += rtla.o
+11 -5
tools/tracing/rtla/src/timerlat_hist.c
··· 39 39 int hk_cpus; 40 40 int no_aa; 41 41 int dump_tasks; 42 + int user_workload; 42 43 int user_hist; 43 44 cpu_set_t hk_cpu_set; 44 45 struct sched_attr sched_param; ··· 535 534 " d:runtime[us|ms|s]:period[us|ms|s] - use SCHED_DEADLINE with runtime and period", 536 535 " in nanoseconds", 537 536 " -u/--user-threads: use rtla user-space threads instead of in-kernel timerlat threads", 537 + " -U/--user-load: enable timerlat for user-defined user-space workload", 538 538 NULL, 539 539 }; 540 540 ··· 597 595 {"thread", required_argument, 0, 'T'}, 598 596 {"trace", optional_argument, 0, 't'}, 599 597 {"user-threads", no_argument, 0, 'u'}, 598 + {"user-load", no_argument, 0, 'U'}, 600 599 {"event", required_argument, 0, 'e'}, 601 600 {"no-irq", no_argument, 0, '0'}, 602 601 {"no-thread", no_argument, 0, '1'}, ··· 616 613 /* getopt_long stores the option index here. */ 617 614 int option_index = 0; 618 615 619 - c = getopt_long(argc, argv, "a:c:C::b:d:e:E:DhH:i:np:P:s:t::T:u0123456:7:8:9\1", 616 + c = getopt_long(argc, argv, "a:c:C::b:d:e:E:DhH:i:np:P:s:t::T:uU0123456:7:8:9\1", 620 617 long_options, &option_index); 621 618 622 619 /* detect the end of the options. */ ··· 727 724 params->trace_output = "timerlat_trace.txt"; 728 725 break; 729 726 case 'u': 727 + params->user_workload = 1; 728 + /* fallback: -u implies in -U */ 729 + case 'U': 730 730 params->user_hist = 1; 731 731 break; 732 732 case '0': /* no irq */ ··· 991 985 } 992 986 } 993 987 994 - if (params->cgroup && !params->user_hist) { 988 + if (params->cgroup && !params->user_workload) { 995 989 retval = set_comm_cgroup("timerlat/", params->cgroup_name); 996 990 if (!retval) { 997 991 err_msg("Failed to move threads to cgroup\n"); ··· 1055 1049 tool->start_time = time(NULL); 1056 1050 timerlat_hist_set_signals(params); 1057 1051 1058 - if (params->user_hist) { 1052 + if (params->user_workload) { 1059 1053 /* rtla asked to stop */ 1060 1054 params_u.should_run = 1; 1061 1055 /* all threads left */ ··· 1092 1086 break; 1093 1087 1094 1088 /* is there still any user-threads ? */ 1095 - if (params->user_hist) { 1089 + if (params->user_workload) { 1096 1090 if (params_u.stopped_running) { 1097 1091 debug_msg("timerlat user-space threads stopped!\n"); 1098 1092 break; 1099 1093 } 1100 1094 } 1101 1095 } 1102 - if (params->user_hist && !params_u.stopped_running) { 1096 + if (params->user_workload && !params_u.stopped_running) { 1103 1097 params_u.should_run = 0; 1104 1098 sleep(1); 1105 1099 }
+10 -4
tools/tracing/rtla/src/timerlat_top.c
··· 43 43 int cgroup; 44 44 int hk_cpus; 45 45 int user_top; 46 + int user_workload; 46 47 cpu_set_t hk_cpu_set; 47 48 struct sched_attr sched_param; 48 49 struct trace_events *events; ··· 365 364 " d:runtime[us|ms|s]:period[us|ms|s] - use SCHED_DEADLINE with runtime and period", 366 365 " in nanoseconds", 367 366 " -u/--user-threads: use rtla user-space threads instead of in-kernel timerlat threads", 367 + " -U/--user-load: enable timerlat for user-defined user-space workload", 368 368 NULL, 369 369 }; 370 370 ··· 425 423 {"thread", required_argument, 0, 'T'}, 426 424 {"trace", optional_argument, 0, 't'}, 427 425 {"user-threads", no_argument, 0, 'u'}, 426 + {"user-load", no_argument, 0, 'U'}, 428 427 {"trigger", required_argument, 0, '0'}, 429 428 {"filter", required_argument, 0, '1'}, 430 429 {"dma-latency", required_argument, 0, '2'}, ··· 438 435 /* getopt_long stores the option index here. */ 439 436 int option_index = 0; 440 437 441 - c = getopt_long(argc, argv, "a:c:C::d:De:hH:i:np:P:qs:t::T:u0:1:2:345:", 438 + c = getopt_long(argc, argv, "a:c:C::d:De:hH:i:np:P:qs:t::T:uU0:1:2:345:", 442 439 long_options, &option_index); 443 440 444 441 /* detect the end of the options. */ ··· 555 552 556 553 break; 557 554 case 'u': 555 + params->user_workload = true; 556 + /* fallback: -u implies -U */ 557 + case 'U': 558 558 params->user_top = true; 559 559 break; 560 560 case '0': /* trigger */ ··· 875 869 top->start_time = time(NULL); 876 870 timerlat_top_set_signals(params); 877 871 878 - if (params->user_top) { 872 + if (params->user_workload) { 879 873 /* rtla asked to stop */ 880 874 params_u.should_run = 1; 881 875 /* all threads left */ ··· 918 912 break; 919 913 920 914 /* is there still any user-threads ? */ 921 - if (params->user_top) { 915 + if (params->user_workload) { 922 916 if (params_u.stopped_running) { 923 917 debug_msg("timerlat user space threads stopped!\n"); 924 918 break; ··· 926 920 } 927 921 } 928 922 929 - if (params->user_top && !params_u.stopped_running) { 923 + if (params->user_workload && !params_u.stopped_running) { 930 924 params_u.should_run = 0; 931 925 sleep(1); 932 926 }
+6
tools/verification/rv/.gitignore
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + rv 3 + rv-static 4 + fixdep 5 + feature 6 + FEATURE-DUMP
+1
tools/verification/rv/Build
··· 1 + rv-y += src/
+64 -123
tools/verification/rv/Makefile
··· 1 - NAME := rv 2 - # Follow the kernel version 3 - VERSION := $(shell cat VERSION 2> /dev/null || make -sC ../../.. kernelversion | grep -v make) 1 + # SPDX-License-Identifier: GPL-2.0-only 4 2 5 - # From libtracefs: 6 - # Makefiles suck: This macro sets a default value of $(2) for the 7 - # variable named by $(1), unless the variable has been set by 8 - # environment or command line. This is necessary for CC and AR 9 - # because make sets default values, so the simpler ?= approach 10 - # won't work as expected. 11 - define allow-override 12 - $(if $(or $(findstring environment,$(origin $(1))),\ 13 - $(findstring command line,$(origin $(1)))),,\ 14 - $(eval $(1) = $(2))) 15 - endef 16 - 17 - # Allow setting CC and AR, or setting CROSS_COMPILE as a prefix. 18 - $(call allow-override,CC,$(CROSS_COMPILE)gcc) 19 - $(call allow-override,AR,$(CROSS_COMPILE)ar) 20 - $(call allow-override,STRIP,$(CROSS_COMPILE)strip) 21 - $(call allow-override,PKG_CONFIG,pkg-config) 22 - $(call allow-override,LD_SO_CONF_PATH,/etc/ld.so.conf.d/) 23 - $(call allow-override,LDCONFIG,ldconfig) 24 - 25 - INSTALL = install 26 - MKDIR = mkdir 27 - FOPTS := -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \ 28 - -fasynchronous-unwind-tables -fstack-clash-protection 29 - WOPTS := -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized 30 - 31 - ifeq ($(CC),clang) 32 - FOPTS := $(filter-out -ffat-lto-objects, $(FOPTS)) 33 - WOPTS := $(filter-out -Wno-maybe-uninitialized, $(WOPTS)) 3 + ifeq ($(srctree),) 4 + srctree := $(patsubst %/,%,$(dir $(CURDIR))) 5 + srctree := $(patsubst %/,%,$(dir $(srctree))) 6 + srctree := $(patsubst %/,%,$(dir $(srctree))) 34 7 endif 35 8 36 - TRACEFS_HEADERS := $$($(PKG_CONFIG) --cflags libtracefs) 9 + include $(srctree)/tools/scripts/Makefile.include 37 10 38 - CFLAGS := -O -g -DVERSION=\"$(VERSION)\" $(FOPTS) $(MOPTS) $(WOPTS) $(TRACEFS_HEADERS) $(EXTRA_CFLAGS) -I include 39 - LDFLAGS := -flto=auto -ggdb $(EXTRA_LDFLAGS) 40 - LIBS := $$($(PKG_CONFIG) --libs libtracefs) 11 + # O is an alias for OUTPUT 12 + OUTPUT := $(O) 41 13 42 - SRC := $(wildcard src/*.c) 43 - HDR := $(wildcard src/*.h) 44 - OBJ := $(SRC:.c=.o) 45 - DIRS := src 46 - FILES := Makefile README.txt 47 - CEXT := bz2 48 - TARBALL := $(NAME)-$(VERSION).tar.$(CEXT) 49 - TAROPTS := -cvjf $(TARBALL) 50 - BINDIR := /usr/bin 51 - DATADIR := /usr/share 52 - DOCDIR := $(DATADIR)/doc 53 - MANDIR := $(DATADIR)/man 54 - LICDIR := $(DATADIR)/licenses 55 - SRCTREE := $(or $(BUILD_SRC),$(CURDIR)) 56 - 57 - # If running from the tarball, man pages are stored in the Documentation 58 - # dir. If running from the kernel source, man pages are stored in 59 - # Documentation/tools/rv/. 60 - ifneq ($(wildcard Documentation/.*),) 61 - DOCSRC = Documentation/ 14 + ifeq ($(OUTPUT),) 15 + OUTPUT := $(CURDIR)/ 62 16 else 63 - DOCSRC = $(SRCTREE)/../../../Documentation/tools/rv/ 17 + # subdir is used by the ../Makefile in $(call descend,) 18 + ifneq ($(subdir),) 19 + OUTPUT := $(OUTPUT)/$(subdir) 20 + endif 64 21 endif 65 22 66 - LIBTRACEEVENT_MIN_VERSION = 1.5 67 - LIBTRACEFS_MIN_VERSION = 1.3 68 - 69 - .PHONY: all warnings show_warnings 70 - all: warnings rv 71 - 72 - TEST_LIBTRACEEVENT = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEEVENT_MIN_VERSION) libtraceevent > /dev/null 2>&1 || echo n") 73 - ifeq ("$(TEST_LIBTRACEEVENT)", "n") 74 - WARNINGS = show_warnings 75 - MISSING_LIBS += echo "** libtraceevent version $(LIBTRACEEVENT_MIN_VERSION) or higher"; 76 - MISSING_PACKAGES += "libtraceevent-devel" 77 - MISSING_SOURCE += echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ "; 23 + ifneq ($(patsubst %/,,$(lastword $(OUTPUT))),) 24 + OUTPUT := $(OUTPUT)/ 78 25 endif 79 26 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 - WARNINGS = show_warnings 83 - MISSING_LIBS += echo "** libtracefs version $(LIBTRACEFS_MIN_VERSION) or higher"; 84 - MISSING_PACKAGES += "libtracefs-devel" 85 - MISSING_SOURCE += echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ "; 27 + RV := $(OUTPUT)rv 28 + RV_IN := $(RV)-in.o 29 + 30 + VERSION := $(shell sh -c "make -sC ../../.. kernelversion | grep -v make") 31 + DOCSRC := ../../../Documentation/tools/rv/ 32 + 33 + FEATURE_TESTS := libtraceevent 34 + FEATURE_TESTS += libtracefs 35 + FEATURE_DISPLAY := libtraceevent 36 + FEATURE_DISPLAY += libtracefs 37 + 38 + ifeq ($(V),1) 39 + Q = 40 + else 41 + Q = @ 86 42 endif 87 43 88 - define show_dependencies 89 - @echo "********************************************"; \ 90 - echo "** NOTICE: Failed build dependencies"; \ 91 - echo "**"; \ 92 - echo "** Required Libraries:"; \ 93 - $(MISSING_LIBS) \ 94 - echo "**"; \ 95 - echo "** Consider installing the latest libtracefs from your"; \ 96 - echo "** distribution, e.g., 'dnf install $(MISSING_PACKAGES)' on Fedora,"; \ 97 - echo "** or from source:"; \ 98 - echo "**"; \ 99 - $(MISSING_SOURCE) \ 100 - echo "**"; \ 101 - echo "********************************************" 102 - endef 44 + all: $(RV) 103 45 104 - show_warnings: 105 - $(call show_dependencies); 46 + include $(srctree)/tools/build/Makefile.include 47 + include Makefile.rv 106 48 107 - ifneq ("$(WARNINGS)", "") 108 - ERROR_OUT = $(error Please add the necessary dependencies) 49 + # check for dependencies only on required targets 50 + NON_CONFIG_TARGETS := clean install doc doc_clean doc_install 109 51 110 - warnings: $(WARNINGS) 111 - $(ERROR_OUT) 52 + config := 1 53 + ifdef MAKECMDGOALS 54 + ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),) 55 + config := 0 56 + endif 112 57 endif 113 58 114 - rv: $(OBJ) 115 - $(CC) -o rv $(LDFLAGS) $(OBJ) $(LIBS) 59 + ifeq ($(config),1) 60 + include $(srctree)/tools/build/Makefile.feature 61 + include Makefile.config 62 + endif 116 63 117 - .PHONY: install 118 - install: doc_install 119 - $(MKDIR) -p $(DESTDIR)$(BINDIR) 120 - $(INSTALL) rv -m 755 $(DESTDIR)$(BINDIR) 121 - $(STRIP) $(DESTDIR)$(BINDIR)/rv 64 + CFLAGS += $(INCLUDES) $(LIB_INCLUDES) 122 65 123 - .PHONY: clean tarball 124 - clean: doc_clean 125 - @test ! -f rv || rm rv 126 - @test ! -f $(TARBALL) || rm -f $(TARBALL) 127 - @rm -rf *~ $(OBJ) *.tar.$(CEXT) 66 + export CFLAGS OUTPUT srctree 128 67 129 - tarball: clean 130 - rm -rf $(NAME)-$(VERSION) && mkdir $(NAME)-$(VERSION) 131 - echo $(VERSION) > $(NAME)-$(VERSION)/VERSION 132 - cp -r $(DIRS) $(FILES) $(NAME)-$(VERSION) 133 - mkdir $(NAME)-$(VERSION)/Documentation/ 134 - cp -rp $(SRCTREE)/../../../Documentation/tools/rv/* $(NAME)-$(VERSION)/Documentation/ 135 - tar $(TAROPTS) --exclude='*~' $(NAME)-$(VERSION) 136 - rm -rf $(NAME)-$(VERSION) 68 + $(RV): $(RV_IN) 69 + $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RV) $(RV_IN) $(EXTLIBS) 137 70 138 - .PHONY: doc doc_clean doc_install 139 - doc: 140 - $(MAKE) -C $(DOCSRC) 71 + static: $(RV_IN) 72 + $(eval LDFLAGS += -static) 73 + $(QUIET_LINK)$(CC) $(LDFLAGS) -o $(RV)-static $(RV_IN) $(EXTLIBS) 141 74 142 - doc_clean: 143 - $(MAKE) -C $(DOCSRC) clean 75 + rv.%: fixdep FORCE 76 + make -f $(srctree)/tools/build/Makefile.build dir=. $@ 144 77 145 - doc_install: 146 - $(MAKE) -C $(DOCSRC) install 78 + $(RV_IN): fixdep FORCE 79 + make $(build)=rv 80 + 81 + clean: doc_clean fixdep-clean 82 + $(call QUIET_CLEAN, rv) 83 + $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete 84 + $(Q)rm -f rv rv-static fixdep FEATURE-DUMP rv-* 85 + $(Q)rm -rf feature 86 + 87 + .PHONY: FORCE clean
+47
tools/verification/rv/Makefile.config
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + 3 + STOP_ERROR := 4 + 5 + LIBTRACEEVENT_MIN_VERSION = 1.5 6 + LIBTRACEFS_MIN_VERSION = 1.3 7 + 8 + define lib_setup 9 + $(eval LIB_INCLUDES += $(shell sh -c "$(PKG_CONFIG) --cflags lib$(1)")) 10 + $(eval EXTLIBS += -l$(1)) 11 + endef 12 + 13 + $(call feature_check,libtraceevent) 14 + ifeq ($(feature-libtraceevent), 1) 15 + $(call detected,CONFIG_LIBTRACEEVENT) 16 + 17 + TEST = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEEVENT_MIN_VERSION) libtraceevent > /dev/null 2>&1 && echo y || echo n") 18 + ifeq ($(TEST),n) 19 + $(info libtraceevent version is too low, it must be at least $(LIBTRACEEVENT_MIN_VERSION)) 20 + STOP_ERROR := 1 21 + endif 22 + 23 + $(call lib_setup,traceevent) 24 + else 25 + STOP_ERROR := 1 26 + $(info libtraceevent is missing. Please install libtraceevent-dev/libtraceevent-devel) 27 + endif 28 + 29 + $(call feature_check,libtracefs) 30 + ifeq ($(feature-libtracefs), 1) 31 + $(call detected,CONFIG_LIBTRACEFS) 32 + 33 + TEST = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEFS_MIN_VERSION) libtracefs > /dev/null 2>&1 && echo y || echo n") 34 + ifeq ($(TEST),n) 35 + $(info libtracefs version is too low, it must be at least $(LIBTRACEFS_MIN_VERSION)) 36 + STOP_ERROR := 1 37 + endif 38 + 39 + $(call lib_setup,tracefs) 40 + else 41 + STOP_ERROR := 1 42 + $(info libtracefs is missing. Please install libtracefs-dev/libtracefs-devel) 43 + endif 44 + 45 + ifeq ($(STOP_ERROR),1) 46 + $(error Please, check the errors above.) 47 + endif
+51
tools/verification/rv/Makefile.rv
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + 3 + define allow-override 4 + $(if $(or $(findstring environment,$(origin $(1))),\ 5 + $(findstring command line,$(origin $(1)))),,\ 6 + $(eval $(1) = $(2))) 7 + endef 8 + 9 + # Allow setting CC and AR, or setting CROSS_COMPILE as a prefix. 10 + $(call allow-override,CC,$(CROSS_COMPILE)gcc) 11 + $(call allow-override,AR,$(CROSS_COMPILE)ar) 12 + $(call allow-override,STRIP,$(CROSS_COMPILE)strip) 13 + $(call allow-override,PKG_CONFIG,pkg-config) 14 + $(call allow-override,LD_SO_CONF_PATH,/etc/ld.so.conf.d/) 15 + $(call allow-override,LDCONFIG,ldconfig) 16 + export CC AR STRIP PKG_CONFIG LD_SO_CONF_PATH LDCONFIG 17 + 18 + FOPTS :=-flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \ 19 + -fasynchronous-unwind-tables -fstack-clash-protection 20 + WOPTS := -O -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 \ 21 + -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized 22 + 23 + ifeq ($(CC),clang) 24 + FOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(FOPTS)) 25 + WOPTS := $(filter-out -Wno-maybe-uninitialized, $(WOPTS)) 26 + endif 27 + 28 + INCLUDE := -Iinclude/ 29 + CFLAGS := -g -DVERSION=\"$(VERSION)\" $(FOPTS) $(WOPTS) $(EXTRA_CFLAGS) $(INCLUDE) 30 + LDFLAGS := -ggdb $(EXTRA_LDFLAGS) 31 + 32 + INSTALL := install 33 + MKDIR := mkdir 34 + STRIP := strip 35 + BINDIR := /usr/bin 36 + 37 + .PHONY: install 38 + install: doc_install 39 + $(Q)$(MKDIR) -p $(DESTDIR)$(BINDIR) 40 + $(call QUIET_INSTALL,rv)$(INSTALL) $(OUTPUT)rv -m 755 $(DESTDIR)$(BINDIR) 41 + $(Q)@$(STRIP) $(DESTDIR)$(BINDIR)/rv 42 + 43 + .PHONY: doc doc_clean doc_install 44 + doc: 45 + $(MAKE) -C $(DOCSRC) 46 + 47 + doc_clean: 48 + $(MAKE) -C $(DOCSRC) clean 49 + 50 + doc_install: 51 + $(MAKE) -C $(DOCSRC) install
+4
tools/verification/rv/src/Build
··· 1 + rv-y += trace.o 2 + rv-y += utils.o 3 + rv-y += in_kernel.o 4 + rv-y += rv.o