* [PATCH stable 6.1 1/3] perf build: Conditionally define NDEBUG
2026-05-19 18:51 [PATCH stable 6.1 0/3] perf build fixes Florian Fainelli
@ 2026-05-19 18:51 ` Florian Fainelli
2026-05-19 18:51 ` [PATCH stable 6.1 2/3] perf parse-events: Make YYDEBUG dependent on doing a debug build Florian Fainelli
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2026-05-19 18:51 UTC (permalink / raw)
To: stable
Cc: Ian Rogers, Adrian Hunter, Alexander Shishkin, Ingo Molnar,
Jiri Olsa, Mark Rutland, Namhyung Kim, Paolo Bonzini,
Peter Zijlstra, Sean Christopherson, Arnaldo Carvalho de Melo,
Florian Fainelli, Arnaldo Carvalho de Melo, Nathan Chancellor,
Nick Desaulniers, Tom Rix, open list:PERFORMANCE EVENTS SUBSYSTEM,
open list:PERFORMANCE EVENTS SUBSYSTEM, open list:BPF [MISC],
open list:CLANG/LLVM BUILD SUPPORT, bcm-kernel-feedback-list
From: Ian Rogers <irogers@google.com>
commit 616b14b47a86d880ba21a363440f20f82152d8f2 upstream
When a build is done without DEBUG=1 then define NDEBUG. This will
compile out asserts and other debug code.
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>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
tools/perf/Makefile.config | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 249f3d841563..c54692976001 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -228,6 +228,7 @@ ifndef DEBUG
endif
ifeq ($(DEBUG),0)
+CORE_CFLAGS += -DNDEBUG=1
ifeq ($(CC_NO_CLANG), 0)
CORE_CFLAGS += -O3
else
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH stable 6.1 2/3] perf parse-events: Make YYDEBUG dependent on doing a debug build
2026-05-19 18:51 [PATCH stable 6.1 0/3] perf build fixes Florian Fainelli
2026-05-19 18:51 ` [PATCH stable 6.1 1/3] perf build: Conditionally define NDEBUG Florian Fainelli
@ 2026-05-19 18:51 ` Florian Fainelli
2026-05-19 18:51 ` [PATCH stable 6.1 3/3] perf build: Disable fewer bison warnings Florian Fainelli
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2026-05-19 18:51 UTC (permalink / raw)
To: stable
Cc: Ian Rogers, Namhyung Kim, Adrian Hunter, Alexander Shishkin,
Gaosheng Cui, Ingo Molnar, James Clark, Jiri Olsa, Kan Liang,
Mark Rutland, Peter Zijlstra, Rob Herring, bpf,
Arnaldo Carvalho de Melo, Florian Fainelli,
Arnaldo Carvalho de Melo, Nathan Chancellor, Nick Desaulniers,
Tom Rix, open list:PERFORMANCE EVENTS SUBSYSTEM,
open list:PERFORMANCE EVENTS SUBSYSTEM,
open list:CLANG/LLVM BUILD SUPPORT, bcm-kernel-feedback-list
From: Ian Rogers <irogers@google.com>
commit d4ce60190e08d84f88937019defa5e3d23409ac1 upstream
YYDEBUG enables line numbers and other error helpers in the generated
parse-events-bison.c. These shouldn't be generated when debugging
isn't enabled.
Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Gaosheng Cui <cuigaosheng1@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Herring <robh@kernel.org>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230911170559.4037734-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
tools/perf/util/parse-events.y | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index be8c51770051..dbc350a2c382 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -6,7 +6,9 @@
%{
+#ifndef NDEBUG
#define YYDEBUG 1
+#endif
#include <fnmatch.h>
#include <stdio.h>
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH stable 6.1 3/3] perf build: Disable fewer bison warnings
2026-05-19 18:51 [PATCH stable 6.1 0/3] perf build fixes Florian Fainelli
2026-05-19 18:51 ` [PATCH stable 6.1 1/3] perf build: Conditionally define NDEBUG Florian Fainelli
2026-05-19 18:51 ` [PATCH stable 6.1 2/3] perf parse-events: Make YYDEBUG dependent on doing a debug build Florian Fainelli
@ 2026-05-19 18:51 ` Florian Fainelli
2026-05-19 18:55 ` [PATCH stable 6.1 0/3] perf build fixes Ian Rogers
2026-05-20 14:31 ` Sasha Levin
4 siblings, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2026-05-19 18:51 UTC (permalink / raw)
To: stable
Cc: Ian Rogers, Adrian Hunter, Alexander Shishkin, Andrii Nakryiko,
Eduard Zingerman, Gaosheng Cui, Ingo Molnar, Jiri Olsa, Kan Liang,
Mark Rutland, Namhyung Kim, Nathan Chancellor, Nick Desaulniers,
Peter Zijlstra, Rob Herring, Tom Rix, bpf, llvm,
Arnaldo Carvalho de Melo, Florian Fainelli,
Arnaldo Carvalho de Melo, open list:PERFORMANCE EVENTS SUBSYSTEM,
open list:PERFORMANCE EVENTS SUBSYSTEM, bcm-kernel-feedback-list
From: Ian Rogers <irogers@google.com>
commit ddc8e4c966923ad1137790817157c8a5f0301aec upstream
If bison is version 3.8.2, reduce the number of bison C warnings
disabled. Earlier bison versions have all C warnings disabled. Avoid
implicit declarations of yylex by adding the declaration in the C
file. A header can't be included as a circular dependency would occur
due to the lexer using the bison defined tokens.
Committer notes:
Some recent versions of gcc and clang (noticed on Alpine Linux 3.17,
edge, clearlinux, fedora 37, etc.
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: Gaosheng Cui <cuigaosheng1@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Tom Rix <trix@redhat.com>
Cc: bpf@vger.kernel.org
Cc: llvm@lists.linux.dev
Link: https://lore.kernel.org/r/20230728064917.767761-6-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[florian: Remove non-existent tools/perf/util/bpf-filter.y in 6.1.y,
adjusted perf_pmu_lex() signature]
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
tools/perf/util/Build | 12 ++++++++----
tools/perf/util/expr.y | 4 +++-
tools/perf/util/parse-events.y | 1 +
tools/perf/util/pmu.y | 3 +++
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 2c364a9087a2..036f9780b398 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -269,10 +269,14 @@ CFLAGS_parse-events-flex.o += $(flex_flags)
CFLAGS_pmu-flex.o += $(flex_flags)
CFLAGS_expr-flex.o += $(flex_flags)
-bison_flags := -DYYENABLE_NLS=0
-BISON_GE_35 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\)/\1\2/g') \>\= 35)
-ifeq ($(BISON_GE_35),1)
- bison_flags += -Wno-unused-parameter -Wno-nested-externs -Wno-implicit-function-declaration -Wno-switch-enum -Wno-unused-but-set-variable -Wno-unknown-warning-option
+# Some newer clang and gcc version complain about this
+# util/parse-events-bison.c:1317:9: error: variable 'parse_events_nerrs' set but not used [-Werror,-Wunused-but-set-variable]
+# int yynerrs = 0;
+
+bison_flags := -DYYENABLE_NLS=0 -Wno-unused-but-set-variable
+BISON_GE_382 := $(shell expr $(shell $(BISON) --version | grep bison | sed -e 's/.\+ \([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/\1\2\3/g') \>\= 382)
+ifeq ($(BISON_GE_382),1)
+ bison_flags += -Wno-switch-enum
else
bison_flags += -w
endif
diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y
index 635e562350c5..b8745d564b78 100644
--- a/tools/perf/util/expr.y
+++ b/tools/perf/util/expr.y
@@ -7,6 +7,8 @@
#include "util/debug.h"
#define IN_EXPR_Y 1
#include "expr.h"
+#include "expr-bison.h"
+int expr_lex(YYSTYPE * yylval_param , void *yyscanner);
%}
%define api.pure full
@@ -56,7 +58,7 @@
static void expr_error(double *final_val __maybe_unused,
struct expr_parse_ctx *ctx __maybe_unused,
bool compute_ids __maybe_unused,
- void *scanner,
+ void *scanner __maybe_unused,
const char *s)
{
pr_debug("%s\n", s);
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index dbc350a2c382..42d4414760e3 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -20,6 +20,7 @@
#include "parse-events.h"
#include "parse-events-bison.h"
+int parse_events_lex(YYSTYPE * yylval_param, YYLTYPE * yylloc_param , void *yyscanner);
void parse_events_error(YYLTYPE *loc, void *parse_state, void *scanner, char const *msg);
#define ABORT_ON(val) \
diff --git a/tools/perf/util/pmu.y b/tools/perf/util/pmu.y
index e675d79a0274..ae88d2d2dd6a 100644
--- a/tools/perf/util/pmu.y
+++ b/tools/perf/util/pmu.y
@@ -9,6 +9,9 @@
#include <linux/bitmap.h>
#include <string.h>
#include "pmu.h"
+#include "pmu-bison.h"
+
+int perf_pmu_lex(void);
#define ABORT_ON(val) \
do { \
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH stable 6.1 0/3] perf build fixes
2026-05-19 18:51 [PATCH stable 6.1 0/3] perf build fixes Florian Fainelli
` (2 preceding siblings ...)
2026-05-19 18:51 ` [PATCH stable 6.1 3/3] perf build: Disable fewer bison warnings Florian Fainelli
@ 2026-05-19 18:55 ` Ian Rogers
2026-05-19 19:29 ` Florian Fainelli
2026-05-20 14:31 ` Sasha Levin
4 siblings, 1 reply; 7+ messages in thread
From: Ian Rogers @ 2026-05-19 18:55 UTC (permalink / raw)
To: Florian Fainelli
Cc: stable, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Nathan Chancellor, Nick Desaulniers, Tom Rix,
open list:PERFORMANCE EVENTS SUBSYSTEM,
open list:PERFORMANCE EVENTS SUBSYSTEM, open list:BPF [MISC],
open list:CLANG/LLVM BUILD SUPPORT, bcm-kernel-feedback-list
On Tue, May 19, 2026 at 11:51 AM Florian Fainelli
<florian.fainelli@broadcom.com> wrote:
>
> This patch series contains "perf" build fixes specific to 6.1. We have
> seen occasional build failures in our CI looking like these:
>
> util/parse-events-bison.c: In function 'yy_symbol_print':
> util/parse-events-bison.c:901: error: unterminated #if
> 901 | #if YYDEBUG
> |
> util/parse-events-bison.c:1020:62: error: '_p' undeclared (first use in this function)
> 1020 | yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, _parse_state, scanner);
> | ^~
> util/parse-events-bison.c:1020:62: note: each undeclared identifier is reported only once for each function it appears in
> util/parse-events-bison.c:1020:64: error: expected ')' at end of input
> 1020 | yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, _parse_state, scanner);
> | ~ ^
> | )
> 1021 | YYFPRINTF (yyo, ")");
> |
> util/parse-events-bison.c:1020:3: error: too few arguments to function 'yy_symbol_value_print'
> 1020 | yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, _parse_state, scanner);
> | ^~~~~~~~~~~~~~~~~~~~~
> util/parse-events-bison.c:991:1: note: declared here
> 991 | yy_symbol_value_print (FILE *yyo,
> | ^~~~~~~~~~~~~~~~~~~~~
>
> which are resolved by these patches.
Lgtm, but the changes should be unnecessary as perf from Linux 7.1
should run on Linux 6.1 and with more and better features.
Thanks,
Ian
> Ian Rogers (3):
> perf build: Conditionally define NDEBUG
> perf parse-events: Make YYDEBUG dependent on doing a debug build
> perf build: Disable fewer bison warnings
>
> tools/perf/Makefile.config | 1 +
> tools/perf/util/Build | 12 ++++++++----
> tools/perf/util/expr.y | 4 +++-
> tools/perf/util/parse-events.y | 3 +++
> tools/perf/util/pmu.y | 3 +++
> 5 files changed, 18 insertions(+), 5 deletions(-)
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH stable 6.1 0/3] perf build fixes
2026-05-19 18:55 ` [PATCH stable 6.1 0/3] perf build fixes Ian Rogers
@ 2026-05-19 19:29 ` Florian Fainelli
0 siblings, 0 replies; 7+ messages in thread
From: Florian Fainelli @ 2026-05-19 19:29 UTC (permalink / raw)
To: Ian Rogers
Cc: stable, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
Nathan Chancellor, Nick Desaulniers, Tom Rix,
open list:PERFORMANCE EVENTS SUBSYSTEM,
open list:PERFORMANCE EVENTS SUBSYSTEM, open list:BPF [MISC],
open list:CLANG/LLVM BUILD SUPPORT, bcm-kernel-feedback-list
On 5/19/26 11:55, Ian Rogers wrote:
> On Tue, May 19, 2026 at 11:51 AM Florian Fainelli
> <florian.fainelli@broadcom.com> wrote:
>>
>> This patch series contains "perf" build fixes specific to 6.1. We have
>> seen occasional build failures in our CI looking like these:
>>
>> util/parse-events-bison.c: In function 'yy_symbol_print':
>> util/parse-events-bison.c:901: error: unterminated #if
>> 901 | #if YYDEBUG
>> |
>> util/parse-events-bison.c:1020:62: error: '_p' undeclared (first use in this function)
>> 1020 | yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, _parse_state, scanner);
>> | ^~
>> util/parse-events-bison.c:1020:62: note: each undeclared identifier is reported only once for each function it appears in
>> util/parse-events-bison.c:1020:64: error: expected ')' at end of input
>> 1020 | yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, _parse_state, scanner);
>> | ~ ^
>> | )
>> 1021 | YYFPRINTF (yyo, ")");
>> |
>> util/parse-events-bison.c:1020:3: error: too few arguments to function 'yy_symbol_value_print'
>> 1020 | yy_symbol_value_print (yyo, yykind, yyvaluep, yylocationp, _parse_state, scanner);
>> | ^~~~~~~~~~~~~~~~~~~~~
>> util/parse-events-bison.c:991:1: note: declared here
>> 991 | yy_symbol_value_print (FILE *yyo,
>> | ^~~~~~~~~~~~~~~~~~~~~
>>
>> which are resolved by these patches.
>
> Lgtm, but the changes should be unnecessary as perf from Linux 7.1
> should run on Linux 6.1 and with more and better features.
That's a bit harder to ship logistically for us and likely for others as
well where we expect a single source to build the kernel and its
companion tools.
--
Florian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH stable 6.1 0/3] perf build fixes
2026-05-19 18:51 [PATCH stable 6.1 0/3] perf build fixes Florian Fainelli
` (3 preceding siblings ...)
2026-05-19 18:55 ` [PATCH stable 6.1 0/3] perf build fixes Ian Rogers
@ 2026-05-20 14:31 ` Sasha Levin
4 siblings, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2026-05-20 14:31 UTC (permalink / raw)
To: stable
Cc: Sasha Levin, Florian Fainelli, Peter Zijlstra, Ingo Molnar,
Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
Jiri Olsa, Namhyung Kim, Nathan Chancellor, Nick Desaulniers,
Tom Rix, Ian Rogers, linux-perf-users, linux-kernel, bpf, llvm,
bcm-kernel-feedback-list
> This patch series contains "perf" build fixes specific to 6.1. We have
> seen occasional build failures in our CI looking like these:
[...]
> Ian Rogers (3):
> perf build: Conditionally define NDEBUG
> perf parse-events: Make YYDEBUG dependent on doing a debug build
> perf build: Disable fewer bison warnings
Thanks for the series.
Patch 3/3 (ddc8e4c96692) has an upstream Fixes: follow-up,
878460e8d0ff8 ("perf build: Remove -Wno-unused-but-set-variable from
the flex flags when building with clang < 13.0.0"), which we need on
6.1 alongside 3/3 to keep clang<13 perf builds working. Without it,
3/3 unconditionally adds -Wno-unused-but-set-variable and drops the
-Wno-unknown-warning-option guard that was previously gated by
BISON_GE_35, so clang 11/12 fails under WERROR=1.
878460e8d0ff8 does not cherry-pick cleanly onto 6.1 - it references
the 'version-lt3' make macro (introduced by a9b451509565d, not in 6.1)
and bpf-filter-flex.o (no such file in 6.1's tools/perf). I wasn't
comfortable resolving that conflict blind on a 6.1-only perf change.
Could you send a v2 6.1 series that includes 878460e8d0ff8 adapted to
6.1 (or an equivalent 6.1-specific patch that preserves the
-Wno-unknown-warning-option guard for clang<13)? I'll queue the whole
thing once that piece is in.
--
Thanks,
Sasha
^ permalink raw reply [flat|nested] 7+ messages in thread