* [PATCH 6.1.y 0/2] Backport dependency commits for 616b14b47a86 ("perf build: Conditionally define NDEBUG")
@ 2026-06-25 13:32 Simon Liebold
2026-06-25 13:32 ` [PATCH 6.1.y 1/2] perf bench: Avoid NDEBUG warning Simon Liebold
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Simon Liebold @ 2026-06-25 13:32 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Simon Liebold, Ian Rogers, linux-perf-users, linux-kernel, stable
Hi, please backport the following two patches to 6.1.y:
- d1babea9c382 ("perf bench: Avoid NDEBUG warning")
- 984a785f25e5 ("perf block-range: Move debug code behind ifndef NDEBUG")
They are stable dependencies for commit 616b14b47a86 ("perf build: Conditionally
define NDEBUG") which was backported to v6.1.176 as 7bf35a0237d04.
That commit adds -DNDEBUG=1 to perf CFLAGS, which compiles out assert() calls,
leaving variables consumed only by asserts as unused-but-set. Combined with
-Werror this breaks the build:
bench/find-bit-bench.c:64:22: error: variable 'old' set but not used
util/block-range.c:20:13: error: variable 'old' set but not used
We need these two dependency patches, because both guard assert-only variables
with #ifndef NDEBUG so they are compiled out alongside the asserts they
validate.
Tested using our regression test suite including kselftest and LTP on various
EC2 instances.
Thanks.
- Simon
Ian Rogers (2):
perf bench: Avoid NDEBUG warning
perf block-range: Move debug code behind ifndef NDEBUG
tools/perf/bench/find-bit-bench.c | 8 ++++++--
tools/perf/util/block-range.c | 6 +-----
2 files changed, 7 insertions(+), 7 deletions(-)
base-commit: fdb6fcb41cc741ad5eaa7995f278dfcb94fdf795
--
2.50.1
Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 6.1.y 1/2] perf bench: Avoid NDEBUG warning
2026-06-25 13:32 [PATCH 6.1.y 0/2] Backport dependency commits for 616b14b47a86 ("perf build: Conditionally define NDEBUG") Simon Liebold
@ 2026-06-25 13:32 ` Simon Liebold
2026-06-25 13:32 ` [PATCH 6.1.y 2/2] perf block-range: Move debug code behind ifndef NDEBUG Simon Liebold
2026-06-26 17:54 ` [PATCH 6.1.y 0/2] Backport dependency commits for 616b14b47a86 ("perf build: Conditionally define NDEBUG") Sasha Levin
2 siblings, 0 replies; 4+ messages in thread
From: Simon Liebold @ 2026-06-25 13:32 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Simon Liebold, Ian Rogers, linux-perf-users, linux-kernel, stable
Cc: Adrian Hunter, Paolo Bonzini, Sean Christopherson,
Arnaldo Carvalho de Melo
From: Ian Rogers <irogers@google.com>
[ Upstream commit d1babea9c38282b58a6f822ab95027cba3165a42 ]
With NDEBUG set the asserts are compiled out. This yields
"unused-but-set-variable" variables. Move these variables behind
NDEBUG to avoid the warning.
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20230330183827.1412303-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Stable-dep-of: 616b14b47a86 ("perf build: Conditionally define NDEBUG")
Signed-off-by: Simon Liebold <simonlie@amazon.de>
---
tools/perf/bench/find-bit-bench.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/perf/bench/find-bit-bench.c b/tools/perf/bench/find-bit-bench.c
index 22b5cfe970237..80f051f9c20fd 100644
--- a/tools/perf/bench/find-bit-bench.c
+++ b/tools/perf/bench/find-bit-bench.c
@@ -61,7 +61,6 @@ static int do_for_each_set_bit(unsigned int num_bits)
double time_average, time_stddev;
unsigned int bit, i, j;
unsigned int set_bits, skip;
- unsigned int old;
init_stats(&fb_time_stats);
init_stats(&tb_time_stats);
@@ -73,7 +72,10 @@ static int do_for_each_set_bit(unsigned int num_bits)
set_bit(i, to_test);
for (i = 0; i < outer_iterations; i++) {
- old = accumulator;
+#ifndef NDEBUG
+ unsigned int old = accumulator;
+#endif
+
gettimeofday(&start, NULL);
for (j = 0; j < inner_iterations; j++) {
for_each_set_bit(bit, to_test, num_bits)
@@ -85,7 +87,9 @@ static int do_for_each_set_bit(unsigned int num_bits)
runtime_us = diff.tv_sec * USEC_PER_SEC + diff.tv_usec;
update_stats(&fb_time_stats, runtime_us);
+#ifndef NDEBUG
old = accumulator;
+#endif
gettimeofday(&start, NULL);
for (j = 0; j < inner_iterations; j++) {
for (bit = 0; bit < num_bits; bit++) {
--
2.50.1
Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 6.1.y 2/2] perf block-range: Move debug code behind ifndef NDEBUG
2026-06-25 13:32 [PATCH 6.1.y 0/2] Backport dependency commits for 616b14b47a86 ("perf build: Conditionally define NDEBUG") Simon Liebold
2026-06-25 13:32 ` [PATCH 6.1.y 1/2] perf bench: Avoid NDEBUG warning Simon Liebold
@ 2026-06-25 13:32 ` Simon Liebold
2026-06-26 17:54 ` [PATCH 6.1.y 0/2] Backport dependency commits for 616b14b47a86 ("perf build: Conditionally define NDEBUG") Sasha Levin
2 siblings, 0 replies; 4+ messages in thread
From: Simon Liebold @ 2026-06-25 13:32 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Simon Liebold, Ian Rogers, linux-perf-users, linux-kernel, stable
Cc: Adrian Hunter, Paolo Bonzini, Sean Christopherson,
Arnaldo Carvalho de Melo
From: Ian Rogers <irogers@google.com>
[ Upstream commit 984a785f25e5b5db5fa673130b60dca6ca794406 ]
Make good on a comment and avoid a unused-but-set-variable warning.
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/r/20230330183827.1412303-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Stable-dep-of: 616b14b47a86 ("perf build: Conditionally define NDEBUG")
Signed-off-by: Simon Liebold <simonlie@amazon.de>
---
tools/perf/util/block-range.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/tools/perf/util/block-range.c b/tools/perf/util/block-range.c
index 1be4326575013..680e92774d0cd 100644
--- a/tools/perf/util/block-range.c
+++ b/tools/perf/util/block-range.c
@@ -11,11 +11,7 @@ struct {
static void block_range__debug(void)
{
- /*
- * XXX still paranoid for now; see if we can make this depend on
- * DEBUG=1 builds.
- */
-#if 1
+#ifndef NDEBUG
struct rb_node *rb;
u64 old = 0; /* NULL isn't executable */
--
2.50.1
Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 6.1.y 0/2] Backport dependency commits for 616b14b47a86 ("perf build: Conditionally define NDEBUG")
2026-06-25 13:32 [PATCH 6.1.y 0/2] Backport dependency commits for 616b14b47a86 ("perf build: Conditionally define NDEBUG") Simon Liebold
2026-06-25 13:32 ` [PATCH 6.1.y 1/2] perf bench: Avoid NDEBUG warning Simon Liebold
2026-06-25 13:32 ` [PATCH 6.1.y 2/2] perf block-range: Move debug code behind ifndef NDEBUG Simon Liebold
@ 2026-06-26 17:54 ` Sasha Levin
2 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2026-06-26 17:54 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Simon Liebold, Ian Rogers, linux-perf-users, linux-kernel, stable
Cc: Sasha Levin
> [PATCH 6.1.y 0/2] Backport dependency commits for 616b14b47a86
> ("perf build: Conditionally define NDEBUG")
Both patches queued for 6.1, thanks.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-06-26 17:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-25 13:32 [PATCH 6.1.y 0/2] Backport dependency commits for 616b14b47a86 ("perf build: Conditionally define NDEBUG") Simon Liebold
2026-06-25 13:32 ` [PATCH 6.1.y 1/2] perf bench: Avoid NDEBUG warning Simon Liebold
2026-06-25 13:32 ` [PATCH 6.1.y 2/2] perf block-range: Move debug code behind ifndef NDEBUG Simon Liebold
2026-06-26 17:54 ` [PATCH 6.1.y 0/2] Backport dependency commits for 616b14b47a86 ("perf build: Conditionally define NDEBUG") Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox