rtla: Updates for 5.20/6.0
Steven Rostedt
maintainerLinus,
Real Time Analysis Tool updates for 5.20 / 6.0
Changes to RTLA:
- Fix a double free
- Define syscall numbers for RISCV
- Fix Makefile when called from -C tools
- Use calloc() to check for memory allocation failures
Please pull the latest trace-rtla-v5.20 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-rtla-v5.20
Tag SHA1: ae546e8855f305db853d17a6509e267286dc5b2d Head SHA1: dd0b15bda48f59eb7dee17fab91eda8389f0e98d
Andreas Schwab (2):
rtla: Fix double free
rtla: Define syscall numbers for riscv
Daniel Bristot de Oliveira (1):
rtla: Fix Makefile when called from -C tools/
jianchunfu (1):
rtla/utils: Use calloc and check the potential memory allocation failure
----
tools/tracing/rtla/Makefile | 2 +- tools/tracing/rtla/src/trace.c | 9 +++++++-- tools/tracing/rtla/src/utils.c | 7 ++++--- 3 files changed, 12 insertions(+), 6 deletions(-)
---------------------------
tools/tracing/rtla/Makefile +1 -1
@@ -1,6 +1,6 @@ NAME := rtla # Follow the kernel version -VERSION := $(shell cat VERSION 2> /dev/null || make -sC ../../.. kernelversion) +VERSION := $(shell cat VERSION 2> /dev/null || make -sC ../../.. kernelversion | grep -v make) # From libtracefs: # Makefiles suck: This macro sets a default value of $(2) for the
tools/tracing/rtla/src/trace.c +7 -2
@@ -134,13 +134,18 @@ void trace_instance_destroy(struct trace_instance *trace)if (trace->inst) {disable_tracer (trace->inst);destroy_instance (trace->inst); + trace->inst =NULL ; } -if (trace->seq) +if (trace->seq) {free (trace->seq); + trace->seq =NULL ; + } -if (trace->tep) +if (trace->tep) {tep_free (trace->tep); + trace->tep =NULL ; + } }/*
tools/tracing/rtla/src/utils.c +4 -3
@@ -106,8 +106,9 @@ int parse_cpu_list(char *cpu_list, char **monitored_cpus) nr_cpus =sysconf (_SC_NPROCESSORS_CONF); - mon_cpus =malloc (nr_cpus *sizeof (char )); -memset (mon_cpus,0 , (nr_cpus *sizeof (char ))); + mon_cpus =calloc (nr_cpus,sizeof (char )); +if (!mon_cpus) + goto err;for (p = cpu_list; *p; ) { cpu =atoi (p);
@@ -224,7 +225,7 @@ long parse_ns_duration(char *val)#elif __arm__# define __NR_sched_setattr 380# define __NR_sched_getattr 381 -#elif __aarch64__ +#elif __aarch64__ || __riscv# define __NR_sched_setattr 274# define __NR_sched_getattr 275#elif __powerpc__
Quoted 2 lines · Steven Rostedt
Changes to RTLA:
Btw, I note that the error messages for missing libraries got fixed (already some time ago, not this pull), but didn't get around to actually building until now.
It says to do
e.g., 'dnf install libtraceevent' on Fedora
but it's actually the devel packages that are needed for building, not the bare libraries.
So it should be libtraceevent-devel, and libtracefs-devel.
Linus
Steven Rostedt
maintainerQuoted 8 lines · On Fri, 5 Aug 2022 09:40:25 -0700 Linus Torvalds…
Quoted 2 lines · Steven Rostedt
Changes to RTLA:
Btw, I note that the error messages for missing libraries got fixed (already some time ago, not this pull), but didn't get around to actually building until now.
Quoted 8 lines
It says to do
e.g., 'dnf install libtraceevent' on Fedora
but it's actually the devel packages that are needed for building, not the bare libraries.
So it should be libtraceevent-devel, and libtracefs-devel.
Thanks for the report (I obviously have them installed, and thus didn't see this :-/). Not to mention, I always forget to add the -dev/-devel appendix to my packages.
Daniel,
Can you send a fix?
Thanks!
-- Steve
Quoted 11 lines · Steven Rostedt
Quoted 8 lines · On Fri, 5 Aug 2022 09:40:25 -0700 Linus Torvalds…
Quoted 2 lines · Steven Rostedt
Changes to RTLA:
Btw, I note that the error messages for missing libraries got fixed (already some time ago, not this pull), but didn't get around to actually building until now.
Quoted 6 lines
Quoted 6 lines
It says to do
e.g., 'dnf install libtraceevent' on Fedora
but it's actually the devel packages that are needed for building, not the bare libraries.
right!
Quoted 9 lines
Quoted 1 line
So it should be libtraceevent-devel, and libtracefs-devel.
Thanks for the report (I obviously have them installed, and thus didn't see this :-/). Not to mention, I always forget to add the -dev/-devel appendix to my packages.
Daniel,
Can you send a fix?
Yes, I will do that. I will also do minimal fedora install and cross-check this further.
Thanks!
-- Daniel
Quoted 2 lines · Daniel Bristot de Oliveira
Yes, I will do that. I will also do minimal fedora install and cross-check this further.
For extra bonus points, if you can state all missing packages in one go (instead of "oops you don't have Xyz" followed by install of Xyz, followed by "Oops, now you don't have Abc") that would be nice too.
But at this point the fundamental problem with incomprehensible error messages is long gone, so it's not a big deal and not worth lots of effort. More of a "if it's easy enough.."
Linus
Quoted 9 lines · Linus Torvalds
Quoted 2 lines · Daniel Bristot de Oliveira
Yes, I will do that. I will also do minimal fedora install and cross-check this further.
For extra bonus points, if you can state all missing packages in one go (instead of "oops you don't have Xyz" followed by install of Xyz, followed by "Oops, now you don't have Abc") that would be nice too.
Quoted 6 lines
But at this point the fundamental problem with incomprehensible error messages is long gone, so it's not a big deal and not worth lots of effort. More of a "if it's easy enough.."
Linus
Daniel, if it helps,
for Fedora I've got
Build Time Requires
-------------------
BuildRequires: gcc
BuildRequires: python3-docutils
BuildRequires: procps-ng-devel
BuildRequires: libtraceevent-devel
BuildRequires: libtracefs-devel
Run Time Requires
----------------
Requires: procps-ng
Requires: libtraceevent
Requires: libtracefs
John Kacur
Steven Rostedt
maintainerQuoted 7 lines · On Sat, 6 Aug 2022 08:52:29 -0700 Linus Torvalds…
For extra bonus points, if you can state all missing packages in one go (instead of "oops you don't have Xyz" followed by install of Xyz, followed by "Oops, now you don't have Abc") that would be nice too.
But at this point the fundamental problem with incomprehensible error messages is long gone, so it's not a big deal and not worth lots of effort. More of a "if it's easy enough.."
With the below patch, it will show the warnings for both libtraceevent and libtracefs if they are not installed:
$ make ******************************************** ** NOTICE: libtraceevent version 1.5 or higher not found ** ** Consider installing the latest libtraceevent from your ** distribution, e.g., 'dnf install libtraceevent-devel' on Fedora, ** or from source: ** ** https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ ** ******************************************** ******************************************** ** NOTICE: libtracefs version 1.3 or higher not found ** ** Consider installing the latest libtracefs from your ** distribution, e.g., 'dnf install libtracefs-devel' on Fedora, ** or from source: ** ** https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ ** ******************************************** Makefile:106: *** Please add the necessary dependencies. Stop.
-- Steve
tools/tracing/rtla/Makefile +13 -4
@@ -61,15 +61,19 @@ endif LIBTRACEEVENT_MIN_VERSION = 1.5 LIBTRACEFS_MIN_VERSION = 1.3 +.PHONY: all warnings +all: warnings rtla + TEST_LIBTRACEEVENT = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEEVENT_MIN_VERSION) libtraceevent > /dev/null 2>&1 || echo n") ifeq ("$(TEST_LIBTRACEEVENT)", "n") +WARNINGS += warning_traceevent .PHONY: warning_traceevent warning_traceevent: @echo "********************************************" @echo "** NOTICE: libtraceevent version $(LIBTRACEEVENT_MIN_VERSION) or higher not found" @echo "**" @echo "** Consider installing the latest libtraceevent from your" - @echo "** distribution, e.g., 'dnf install libtraceevent' on Fedora," + @echo "** distribution, e.g., 'dnf install libtraceevent-devel' on Fedora," @echo "** or from source:" @echo "**" @echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ "
@@ -80,12 +84,13 @@ endif TEST_LIBTRACEFS = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEFS_MIN_VERSION) libtracefs > /dev/null 2>&1 || echo n") ifeq ("$(TEST_LIBTRACEFS)", "n") .PHONY: warning_tracefs +WARNINGS += warning_tracefs warning_tracefs: @echo "********************************************" @echo "** NOTICE: libtracefs version $(LIBTRACEFS_MIN_VERSION) or higher not found" @echo "**" @echo "** Consider installing the latest libtracefs from your" - @echo "** distribution, e.g., 'dnf install libtracefs' on Fedora," + @echo "** distribution, e.g., 'dnf install libtracefs-devel' on Fedora," @echo "** or from source:" @echo "**" @echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ "
@@ -93,8 +98,12 @@ warning_tracefs: @echo "********************************************" endif -.PHONY: all -all: rtla +ifneq ("$(WARNINGS)", "") +ERROR_OUT = $(error Please add the necessary dependencies) +endif + +warnings: $(WARNINGS) + $(ERROR_OUT) rtla: $(OBJ) $(CC) -o rtla $(LDFLAGS) $(OBJ) $(LIBS)
Quoted 4 lines · Steven Rostedt
With the below patch, it will show the warnings for both libtraceevent and libtracefs if they are not installed:
Remove some of the unnecessary asterisk noise, and I'll be happy.
It's not like that really adds anything.
Linus
Steven Rostedt
maintainerQuoted 6 lines · On Sat, 6 Aug 2022 11:24:28 -0700 Linus Torvalds…
Quoted 2 lines
With the below patch, it will show the warnings for both libtraceevent and libtracefs if they are not installed:
Remove some of the unnecessary asterisk noise, and I'll be happy.
It's not like that really adds anything.
Is the second one I sent better? The consolidated version.
The asterisks do at least highlight the reason of failure.
-- Steve
Quoted 4 lines · Steven Rostedt
Is the second one I sent better? The consolidated version.
The asterisks do at least highlight the reason of failure.
Better. But I think you could remove even more. It's not like we need the whole ascii framing etc.
It looks very 90s to me. "cowsay" and all that..
But it's not like I care deeply about the retro look.
Linus
Steven Rostedt
maintainerQuoted 3 lines · On Sat, 6 Aug 2022 12:05:52 -0700 Linus Torvalds…
It looks very 90s to me. "cowsay" and all that..
But it's not like I care deeply about the retro look.
I thought it would bring back some nostalgia. ;-)
As I'm pretty much the same age as you, it's probably why I tend to like it.
-- Steve
Steven Rostedt
maintainerQuoted 17 lines · On Sat, 6 Aug 2022 14:22:03 -0400 Steven Rostedt <[email protected]> wrote:
With the below patch, it will show the warnings for both libtraceevent and libtracefs if they are not installed:
$ make ******************************************** ** NOTICE: libtraceevent version 1.5 or higher not found ** ** Consider installing the latest libtraceevent from your ** distribution, e.g., 'dnf install libtraceevent-devel' on Fedora, ** or from source: ** ** https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ ** ******************************************** ******************************************** ** NOTICE: libtracefs version 1.3 or higher not found **
Quoted 8 lines
** Consider installing the latest libtracefs from your ** distribution, e.g., 'dnf install libtracefs-devel' on Fedora, ** or from source: ** ** https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ ** ******************************************** Makefile:106: *** Please add the necessary dependencies. Stop.
Or to even make it less noisy:
$ make ******************************************** ** NOTICE: Failed build dependencies ** ** Required Libraries: ** libtraceevent version 1.5 or higher ** libtracefs version 1.3 or higher ** ** Consider installing the latest libtracefs from your ** distribution, e.g., 'dnf install libtraceevent-devel libtracefs-devel' on Fedora, ** or from source: ** ** https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ ** https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ ** ******************************************** Makefile:106: *** Please add the necessary dependencies. Stop.
-- Steve
tools/tracing/rtla/Makefile +36 -26
@@ -61,40 +61,50 @@ endif LIBTRACEEVENT_MIN_VERSION = 1.5 LIBTRACEFS_MIN_VERSION = 1.3 +.PHONY: all warnings show_warnings +all: warnings rtla + TEST_LIBTRACEEVENT = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEEVENT_MIN_VERSION) libtraceevent > /dev/null 2>&1 || echo n") ifeq ("$(TEST_LIBTRACEEVENT)", "n") -.PHONY: warning_traceevent -warning_traceevent: - @echo "********************************************" - @echo "** NOTICE: libtraceevent version $(LIBTRACEEVENT_MIN_VERSION) or higher not found" - @echo "**" - @echo "** Consider installing the latest libtraceevent from your" - @echo "** distribution, e.g., 'dnf install libtraceevent' on Fedora," - @echo "** or from source:" - @echo "**" - @echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ " - @echo "**" - @echo "********************************************" +WARNINGS = show_warnings +MISSING_LIBS += echo "** libtraceevent version $(LIBTRACEEVENT_MIN_VERSION) or higher"; +MISSING_PACKAGES += "libtraceevent-devel" +MISSING_SOURCE += echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ "; endif TEST_LIBTRACEFS = $(shell sh -c "$(PKG_CONFIG) --atleast-version $(LIBTRACEFS_MIN_VERSION) libtracefs > /dev/null 2>&1 || echo n") ifeq ("$(TEST_LIBTRACEFS)", "n") -.PHONY: warning_tracefs -warning_tracefs: - @echo "********************************************" - @echo "** NOTICE: libtracefs version $(LIBTRACEFS_MIN_VERSION) or higher not found" - @echo "**" - @echo "** Consider installing the latest libtracefs from your" - @echo "** distribution, e.g., 'dnf install libtracefs' on Fedora," - @echo "** or from source:" - @echo "**" - @echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ " - @echo "**" - @echo "********************************************" +WARNINGS = show_warnings +MISSING_LIBS += echo "** libtracefs version $(LIBTRACEFS_MIN_VERSION) or higher"; +MISSING_PACKAGES += "libtracefs-devel" +MISSING_SOURCE += echo "** https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ "; endif -.PHONY: all -all: rtla +define show_dependencies + @echo "********************************************"; \ + echo "** NOTICE: Failed build dependencies"; \ + echo "**"; \ + echo "** Required Libraries:"; \ + $(MISSING_LIBS) \ + echo "**"; \ + echo "** Consider installing the latest libtracefs from your"; \ + echo "** distribution, e.g., 'dnf install $(MISSING_PACKAGES)' on Fedora,"; \ + echo "** or from source:"; \ + echo "**"; \ + $(MISSING_SOURCE) \ + echo "**"; \ + echo "********************************************" +endef + +show_warnings: + $(call show_dependencies); + +ifneq ("$(WARNINGS)", "") +ERROR_OUT = $(error Please add the necessary dependencies) + +warnings: $(WARNINGS) + $(ERROR_OUT) +endif rtla: $(OBJ) $(CC) -o rtla $(LDFLAGS) $(OBJ) $(LIBS)
Steven Rostedt
maintainertools/tracing/rtla/Makefile endif · line 103
Quoted 2 lines · On Sat, 6 Aug 2022 14:45:17 -0400 Steven Rostedt <[email protected]> wrote:
tools/tracing/rtla/Makefile +2
-0+ifneq ("$(WARNINGS)", "") +ERROR_OUT = $(error Please add the necessary dependencies)
add +endif
tools/tracing/rtla/Makefile endif · line 106
Quoted 3 lines
tools/tracing/rtla/Makefile +3
-0+ +warnings: $(WARNINGS) + $(ERROR_OUT)
remove +endif
The pull request you sent on Wed, 3 Aug 2022 10:49:36 -0400:
The pull request you sent on Wed, 3 Aug 2022 10:49:36 -0400:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.gittrace-rtla-v5.20
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/29b1d469f3f6842ee4115f0b21f018fc44176468
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html