diff options
| author | Swapnil Sapkal <swapnil.sapkal@amd.com> | 2026-01-27 18:49:55 +0000 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-01-28 15:18:11 -0300 |
| commit | 2a85bbaed06bec2b97dec15bb01cbdbf81dce3e3 (patch) | |
| tree | 775c026b20c89803e39ccbc18d87dc480d528df2 /tools | |
| parent | 297c9d96e3085116c5cde18170dba716a1f2591e (diff) | |
perf header: Replace hardcoded max cpus by MAX_NR_CPUS
cpumask and cpulist from cpu-domain header have hardcoded max_cpus value
of 1024.
Current systems have more cpus than this value. Replace it with
MAX_NR_CPUS.
Also define a macro to represent domain name length.
Fixes: d40c68a49f69c9bd ("perf header: Support CPU DOMAIN relation info")
Reported-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Reviewed-by: Shrikanth Hegde <sshegde@linux.ibm.com>
Signed-off-by: Swapnil Sapkal <swapnil.sapkal@amd.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Anubhav Shelat <ashelat@redhat.com>
Cc: Chen Yu <yu.c.chen@intel.com>
Cc: Gautham Shenoy <gautham.shenoy@amd.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Thomas Falcon <thomas.falcon@intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/perf/util/header.c | 5 | ||||
| -rw-r--r-- | tools/perf/util/util.c | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index eefd1cd73b6a..31c3bab1b10a 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -76,6 +76,7 @@ static const u64 __perf_magic2 = 0x32454c4946524550ULL; static const u64 __perf_magic2_sw = 0x50455246494c4532ULL; #define PERF_MAGIC __perf_magic2 +#define DNAME_LEN 16 const char perf_version_string[] = PERF_VERSION; @@ -1616,10 +1617,10 @@ static int write_pmu_caps(struct feat_fd *ff, struct cpu_domain_map **build_cpu_domain_map(u32 *schedstat_version, u32 *max_sched_domains, u32 nr) { + char dname[DNAME_LEN], cpumask[MAX_NR_CPUS]; struct domain_info *domain_info; struct cpu_domain_map **cd_map; - char dname[16], cpumask[256]; - char cpulist[1024]; + char cpulist[MAX_NR_CPUS]; char *line = NULL; u32 cpu, domain; u32 dcount = 0; diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 03a603fbcd7d..94f5a2ece245 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c @@ -1,4 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 +#include "perf.h" #include "util.h" #include "debug.h" #include "event.h" @@ -262,7 +263,7 @@ void cpumask_to_cpulist(char *cpumask, char *cpulist) int i, j, bm_size, nbits; int len = strlen(cpumask); unsigned long *bm; - char cpus[1024]; + char cpus[MAX_NR_CPUS]; for (i = 0; i < len; i++) { if (cpumask[i] == ',') { |
