[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <8c8553387ebf904a9e5a93eaf643cb01164d9fb3.1736188471.git.christophe.leroy@csgroup.eu>
Date: Mon, 6 Jan 2025 20:38:28 +0100
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
"Liang, Kan" <kan.liang@...ux.intel.com>,
Leo Yan <leo.yan@....com>
Cc: Christophe Leroy <christophe.leroy@...roup.eu>,
linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org,
Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: [PATCH] libperf: Add back guard on MAX_NR_CPUS
Building perf with EXTRA_CFLAGS="-DMAX_NR_CPUS=1" fails:
CC /home/chleroy/linux-powerpc/tools/perf/libperf/cpumap.o
cpumap.c:16: error: "MAX_NR_CPUS" redefined [-Werror]
16 | #define MAX_NR_CPUS 4096
|
<command-line>: note: this is the location of the previous definition
Commit e8399d34d568 ("libperf cpumap: Hide/reduce scope of MAX_NR_CPUS")
moved definition of MAX_NR_CPUS from lib/perf/include/internal/cpumap.h
to lib/perf/cpumap.c but the guard surrounding that definition got lost
in the move.
See commit 21b8732eb447 ("perf tools: Allow overriding MAX_NR_CPUS at
compile time") to see why it is needed.
Note that MAX_NR_CPUS was initialy defined in perf/perf.h and a
redundant definition was added by commit 9c3516d1b850 ("libperf:
Add perf_cpu_map__new()/perf_cpu_map__read() functions").
A cleaner fix would be to remove that duplicate but for the time
being fix the problem by bringing back the guard for when MAX_NR_CPUS
is already defined.
Fixes: e8399d34d568 ("libperf cpumap: Hide/reduce scope of MAX_NR_CPUS")
Signed-off-by: Christophe Leroy <christophe.leroy@...roup.eu>
Reviewed-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/lib/perf/cpumap.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/lib/perf/cpumap.c b/tools/lib/perf/cpumap.c
index fcc47214062a..12eaa6955121 100644
--- a/tools/lib/perf/cpumap.c
+++ b/tools/lib/perf/cpumap.c
@@ -13,7 +13,9 @@
#include "internal.h"
#include <api/fs/fs.h>
+#ifndef MAX_NR_CPUS
#define MAX_NR_CPUS 4096
+#endif
void perf_cpu_map__set_nr(struct perf_cpu_map *map, int nr_cpus)
{
--
2.47.0
Powered by blists - more mailing lists