Linux Trace Kernel
 help / color / mirror / Atom feed
* [PATCH v1] tools/rtla: Fix unassigned nr_cpus
@ 2025-10-02 17:08 Costa Shulyupin
  2025-10-29 13:58 ` Tomas Glozar
  2025-10-30  9:10 ` Tomas Glozar
  0 siblings, 2 replies; 4+ messages in thread
From: Costa Shulyupin @ 2025-10-02 17:08 UTC (permalink / raw)
  To: Steven Rostedt, Tomas Glozar, Crystal Wood, Costa Shulyupin,
	John Kacur, linux-trace-kernel, linux-kernel

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.

Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
---
 tools/tracing/rtla/Makefile.rtla  | 2 +-
 tools/tracing/rtla/src/timerlat.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/tracing/rtla/Makefile.rtla b/tools/tracing/rtla/Makefile.rtla
index 08c1b40883d3..1743d91829d4 100644
--- a/tools/tracing/rtla/Makefile.rtla
+++ b/tools/tracing/rtla/Makefile.rtla
@@ -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))
diff --git a/tools/tracing/rtla/src/timerlat.c b/tools/tracing/rtla/src/timerlat.c
index 28ea4f6710c1..df4f9bfe3433 100644
--- a/tools/tracing/rtla/src/timerlat.c
+++ b/tools/tracing/rtla/src/timerlat.c
@@ -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)
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] tools/rtla: Fix unassigned nr_cpus
  2025-10-02 17:08 [PATCH v1] tools/rtla: Fix unassigned nr_cpus Costa Shulyupin
@ 2025-10-29 13:58 ` Tomas Glozar
  2025-10-30  9:10 ` Tomas Glozar
  1 sibling, 0 replies; 4+ messages in thread
From: Tomas Glozar @ 2025-10-29 13:58 UTC (permalink / raw)
  To: Costa Shulyupin
  Cc: Steven Rostedt, Crystal Wood, John Kacur, linux-trace-kernel,
	linux-kernel

čt 2. 10. 2025 v 19:09 odesílatel Costa Shulyupin
<costa.shul@redhat.com> napsal:
>
> 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.

>
> Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
> ---
>  tools/tracing/rtla/Makefile.rtla  | 2 +-
>  tools/tracing/rtla/src/timerlat.c | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>

Reviewed-by: Tomas Glozar <tglozar@redhat.com>

Tomas


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] tools/rtla: Fix unassigned nr_cpus
  2025-10-02 17:08 [PATCH v1] tools/rtla: Fix unassigned nr_cpus Costa Shulyupin
  2025-10-29 13:58 ` Tomas Glozar
@ 2025-10-30  9:10 ` Tomas Glozar
  2025-10-30 10:00   ` Steven Rostedt
  1 sibling, 1 reply; 4+ messages in thread
From: Tomas Glozar @ 2025-10-30  9:10 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Costa Shulyupin, Crystal Wood, John Kacur, linux-trace-kernel,
	linux-kernel

Hi Steven,

čt 2. 10. 2025 v 19:09 odesílatel Costa Shulyupin
<costa.shul@redhat.com> napsal:
>
> 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.
>
> Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
> ---
>  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:

Fixes: 2f3172f9dd58 ("tools/rtla: Consolidate code between
osnoise/timerlat and hist/top")

[1] https://lore.kernel.org/linux-trace-kernel/20250907022325.243930-1-crwood@redhat.com/T/

Thanks,
Tomas


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] tools/rtla: Fix unassigned nr_cpus
  2025-10-30  9:10 ` Tomas Glozar
@ 2025-10-30 10:00   ` Steven Rostedt
  0 siblings, 0 replies; 4+ messages in thread
From: Steven Rostedt @ 2025-10-30 10:00 UTC (permalink / raw)
  To: Tomas Glozar
  Cc: Costa Shulyupin, Crystal Wood, John Kacur, linux-trace-kernel,
	linux-kernel

On Thu, 30 Oct 2025 10:10:36 +0100
Tomas Glozar <tglozar@redhat.com> wrote:

> Hi Steven,
> 
> čt 2. 10. 2025 v 19:09 odesílatel Costa Shulyupin
> <costa.shul@redhat.com> napsal:
> >
> > 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.
> >
> > Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
> > ---
> >  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:
> 
> Fixes: 2f3172f9dd58 ("tools/rtla: Consolidate code between
> osnoise/timerlat and hist/top")
> 
> [1] https://lore.kernel.org/linux-trace-kernel/20250907022325.243930-1-crwood@redhat.com/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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-30  9:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-02 17:08 [PATCH v1] tools/rtla: Fix unassigned nr_cpus Costa Shulyupin
2025-10-29 13:58 ` Tomas Glozar
2025-10-30  9:10 ` Tomas Glozar
2025-10-30 10:00   ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox