perf: arm64: Fix build with refcount checking
Subsystems (2)
PATCH 1/1 perf: arm64: Fix build with refcount checking
With EXTRA_CFLAGS=-DREFCNT_CHECKING=1 and build-test, some unwrapped map accesses appear. Wrap it in the new accessor to fix the error:
error: 'struct perf_cpu_map' has no member named 'map'
--- tools/perf/arch/arm64/util/header.c | 4 ++-- tools/perf/arch/arm64/util/pmu.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/arch/arm64/util/header.c +2 -2
@@ -29,8 +29,8 @@ static int _get_cpuid(char *buf, size_t sz, struct perf_cpu_map *cpus)char path[PATH_MAX ];FILE *file; -scnprintf (path,PATH_MAX ,"%s/devices/system/cpu/cpu%d" MIDR , - sysfs, cpus->map[cpu]); +scnprintf (path,PATH_MAX ,"%s/devices/system/cpu/cpu%d" MIDR , + sysfs,RC_CHK_ACCESS (cpus)->map[cpu].cpu); file =fopen (path,"r" );if (!file) {
tools/perf/arch/arm64/util/pmu.c +1 -1
@@ -18,7 +18,7 @@ static struct perf_pmu *pmu__find_core_pmu(void)* The cpumap should cover all CPUs. Otherwise, some CPUs may * not support some events or have different event IDs. */ -if (pmu->cpus->nr !=cpu__max_cpu ().cpu) +if (RC_CHK_ACCESS (pmu->cpus)->nr !=cpu__max_cpu ().cpu)return NULL ;return pmu;
Signature · 1 line
2.34.1
Quoted 7 lines · James Clark
With EXTRA_CFLAGS=-DREFCNT_CHECKING=1 and build-test, some unwrapped map accesses appear. Wrap it in the new accessor to fix the error:
error: 'struct
perf_cpu_map' has no member named 'map'Signed-off-by James Clark <[email protected]>
Thanks James and sorry for the breakage!
Ian
Quoted 36 lines
--- tools/perf/arch/arm64/util/header.c | 4 ++-- tools/perf/arch/arm64/util/pmu.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)tools/perf/arch/arm64/util/header.c +2
-2@@ -29,8 +29,8 @@ static int _get_cpuid(char *buf, size_t sz, struct perf_cpu_map *cpus)char path[PATH_MAX ];FILE *file; -scnprintf (path,PATH_MAX ,"%s/devices/system/cpu/cpu%d" MIDR , - sysfs, cpus->map[cpu]); +scnprintf (path,PATH_MAX ,"%s/devices/system/cpu/cpu%d" MIDR , + sysfs,RC_CHK_ACCESS (cpus)->map[cpu].cpu); file =fopen (path,"r" );if (!file) {tools/perf/arch/arm64/util/pmu.c +1
-2@@ -18,7 +18,7 @@ static struct perf_pmu *pmu__find_core_pmu(void)* The cpumap should cover all CPUs. Otherwise, some CPUs may * not support some events or have different event IDs. */ -if (pmu->cpus->nr !=cpu__max_cpu ().cpu) +if (RC_CHK_ACCESS (pmu->cpus)->nr !=cpu__max_cpu ().cpu)return NULL ;return pmu; --2.34.1
Em Thu, May 04, 2023 at 09:28:21AM -0700, Ian Rogers escreveu:
Quoted 11 lines · James Clark
Quoted 7 lines
With EXTRA_CFLAGS=-DREFCNT_CHECKING=1 and build-test, some unwrapped map accesses appear. Wrap it in the new accessor to fix the error:
error: 'struct
perf_cpu_map' has no member named 'map'Signed-off-by James Clark <[email protected]>Thanks James and sorry for the breakage!
Acked-by Ian Rogers <[email protected]>
Thanks, applied.
- Arnaldo
Quoted 38 lines
Ian
Quoted 36 lines
--- tools/perf/arch/arm64/util/header.c | 4 ++-- tools/perf/arch/arm64/util/pmu.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)tools/perf/arch/arm64/util/header.c +2
-2@@ -29,8 +29,8 @@ static int _get_cpuid(char *buf, size_t sz, struct perf_cpu_map *cpus)char path[PATH_MAX ];FILE *file; -scnprintf (path,PATH_MAX ,"%s/devices/system/cpu/cpu%d" MIDR , - sysfs, cpus->map[cpu]); +scnprintf (path,PATH_MAX ,"%s/devices/system/cpu/cpu%d" MIDR , + sysfs,RC_CHK_ACCESS (cpus)->map[cpu].cpu); file =fopen (path,"r" );if (!file) {tools/perf/arch/arm64/util/pmu.c +1
-2@@ -18,7 +18,7 @@ static struct perf_pmu *pmu__find_core_pmu(void)* The cpumap should cover all CPUs. Otherwise, some CPUs may * not support some events or have different event IDs. */ -if (pmu->cpus->nr !=cpu__max_cpu ().cpu) +if (RC_CHK_ACCESS (pmu->cpus)->nr !=cpu__max_cpu ().cpu)return NULL ;return pmu; --2.34.1
Signature · 1 line
- Arnaldo