tools/rtla: Fix unassigned nr_cpus
Subsystems (2)
PATCH 1/1 tools/rtla: Fix unassigned nr_cpus
In recently introduced timerlat_free(),
the variable 'nr_cpus' is not assigned.
Assign it with sysconf(_SC_NPROCESSORS_CONF) as done elsewhere. Remove the culprit: -Wno-maybe-uninitialized. The rest of the code is clean.
--- tools/tracing/rtla/Makefile.rtla | 2 +- tools/tracing/rtla/src/timerlat.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
tools/tracing/rtla/Makefile.rtla +1 -1
@@ -18,7 +18,7 @@ export CC AR STRIP PKG_CONFIG LD_SO_CONF_PATH LDCONFIG FOPTS := -flto=auto -ffat-lto-objects -fexceptions -fstack-protector-strong \ -fasynchronous-unwind-tables -fstack-clash-protection WOPTS := -O -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 \ - -Wp,-D_GLIBCXX_ASSERTIONS -Wno-maybe-uninitialized + -Wp,-D_GLIBCXX_ASSERTIONS ifeq ($(CC),clang) FOPTS := $(filter-out -flto=auto -ffat-lto-objects, $(FOPTS))
tools/tracing/rtla/src/timerlat.c +2 -1
@@ -213,7 +213,8 @@ void timerlat_analyze(struct osnoise_tool *tool, bool stopped)void timerlat_free (struct osnoise_tool *tool) {struct timerlat_params *params =to_timerlat_params (tool->params); -int nr_cpus, i; +int nr_cpus =sysconf (_SC_NPROCESSORS_CONF); +int i;timerlat_aa_destroy ();if (dma_latency_fd >=0 )
Signature · 1 line
2.51.0
čt 2. 10. 2025 v 19:09 odesílatel Costa Shulyupin
<[email protected]> napsal:
Quoted 7 lines
In recently introduced
timerlat_free(),
the variable 'nr_cpus' is not assigned.Assign it with
sysconf(_SC_NPROCESSORS_CONF)as done elsewhere. Remove the culprit: -Wno-maybe-uninitialized. The rest of the code is clean.
I suspected that the warning was disabled because of issues with an old version of GCC, but that is not the case: I tried building RTLA on RHEL 7 with GCC 4.8, and got no warnings, beside the real bug that you fix here.
Therefore, it can be removed, so that such bugs are caught in the future.
Quoted 7 lines
Signed-off-by Costa Shulyupin <[email protected]>--- tools/tracing/rtla/Makefile.rtla | 2 +- tools/tracing/rtla/src/timerlat.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
Tomas
Tomas Glozar
maintainerHi Steven,
čt 2. 10. 2025 v 19:09 odesílatel Costa Shulyupin
<[email protected]> napsal:
Quoted 8 lines
In recently introduced
timerlat_free(),
the variable 'nr_cpus' is not assigned.Assign it with
sysconf(_SC_NPROCESSORS_CONF)as done elsewhere. Remove the culprit: -Wno-maybe-uninitialized. The rest of the code is clean.
Quoted 6 lines
Signed-off-by Costa Shulyupin <[email protected]>--- tools/tracing/rtla/Makefile.rtla | 2 +- tools/tracing/rtla/src/timerlat.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)
This is another fix of a bug introduced in the 6.18-v1 RTLA code consolidation [1], this time affecting the resetting of idle states set through --deepest-idle-state. Could you please also add it to your RTLA fix queue?
Also, this should have:
osnoise/timerlat and hist/top")
[1] https://lore.kernel.org/linux-trace-kernel/[email protected]/T/
Thanks,
Tomas
Steven Rostedt
maintainerQuoted 24 lines · On Thu, 30 Oct 2025 10:10:36 +0100 Tomas Glozar <[email protected]> wrote:
Hi Steven,
čt 2. 10. 2025 v 19:09 odesílatel Costa Shulyupin
<[email protected]> napsal:Quoted 8 lines
In recently introduced
timerlat_free(),
the variable 'nr_cpus' is not assigned.Assign it with
sysconf(_SC_NPROCESSORS_CONF)as done elsewhere. Remove the culprit: -Wno-maybe-uninitialized. The rest of the code is clean.Quoted 6 lines
Signed-off-by Costa Shulyupin <[email protected]>--- tools/tracing/rtla/Makefile.rtla | 2 +- tools/tracing/rtla/src/timerlat.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)This is another fix of a bug introduced in the 6.18-v1 RTLA code consolidation [1], this time affecting the resetting of idle states set through --deepest-idle-state. Could you please also add it to your RTLA fix queue?
Quoted 7 lines
Also, this should have:
Fixes 2f3172f9dd58 ("tools/rtla: Consolidate code betweenosnoise/timerlat and hist/top")
[1] https://lore.kernel.org/linux-trace-kernel/[email protected]/T/
Thanks,
I'll take a look at this today. We need to start making you a maintainer for this, so that you only need to send me pull requests.
Do you have a kernel.org account? If not, do you have PGP signatures from other kernel.org developers to your key?
-- Steve