Re: [PATCH] tools/perf/arch/powerpc/util: Fix is_compat_mode build break in ppc64
From: Venkat Rao Bagalkote <hidden>
Date: 2025-03-24 12:21:32
Also in:
linux-perf-users
On 21/03/25 3:37 pm, Likhitha Korrapati wrote:
quoted hunk ↗ jump to hunk
Commit 54f9aa1092457 ("tools/perf/powerpc/util: Add support to handle compatible mode PVR for perf json events") introduced to select proper JSON events in case of compat mode using auxiliary vector. But this caused a compilation error in ppc64 Big Endian. arch/powerpc/util/header.c: In function 'is_compat_mode': arch/powerpc/util/header.c:20:21: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] 20 | if (!strcmp((char *)platform, (char *)base_platform)) | ^ arch/powerpc/util/header.c:20:39: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] 20 | if (!strcmp((char *)platform, (char *)base_platform)) | Commit saved the getauxval(AT_BASE_PLATFORM) and getauxval(AT_PLATFORM) return values in u64 which causes the compilation error. Patch fixes this issue by changing u64 to "unsigned long". Fixes: 54f9aa1092457 ("tools/perf/powerpc/util: Add support to handle compatible mode PVR for perf json events") Signed-off-by: Likhitha Korrapati <redacted> --- tools/perf/arch/powerpc/util/header.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)diff --git a/tools/perf/arch/powerpc/util/header.c b/tools/perf/arch/powerpc/util/header.c index c7df534dbf8f..0be74f048f96 100644 --- a/tools/perf/arch/powerpc/util/header.c +++ b/tools/perf/arch/powerpc/util/header.c@@ -14,8 +14,8 @@ static bool is_compat_mode(void) { - u64 base_platform = getauxval(AT_BASE_PLATFORM); - u64 platform = getauxval(AT_PLATFORM); + unsigned long base_platform = getauxval(AT_BASE_PLATFORM); + unsigned long platform = getauxval(AT_PLATFORM); if (!strcmp((char *)platform, (char *)base_platform)) return false;
Applied this patch on the powerpc kernel and it fixes the issue. Without this patch: INSTALL libsubcmd_headers INSTALL libsymbol_headers INSTALL libperf_headers INSTALL libapi_headers CC /output/arch/powerpc/util/header.o CC /output/arch/powerpc/util/perf_regs.o CC /output/arch/powerpc/util/mem-events.o CC /output/arch/powerpc/util/pmu.o CC /output/arch/powerpc/util/sym-handling.o CC /output/arch/powerpc/util/evsel.o CC /output/arch/powerpc/util/event.o arch/powerpc/util/header.c: In function 'is_compat_mode': arch/powerpc/util/header.c:20:21: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] 20 | if (!strcmp((char *)platform, (char *)base_platform)) | ^ arch/powerpc/util/header.c:20:39: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] 20 | if (!strcmp((char *)platform, (char *)base_platform)) | ^ cc1: all warnings being treated as errors make[6]: *** [/linux/tools/build/Makefile.build:85: /output/arch/powerpc/util/header.o] Error 1 make[6]: *** Waiting for unfinished jobs.... make[5]: *** [/linux/tools/build/Makefile.build:138: util] Error 2 make[4]: *** [/linux/tools/build/Makefile.build:138: powerpc] Error 2 make[3]: *** [/linux/tools/build/Makefile.build:138: arch] Error 2 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [Makefile.perf:781: /output/perf-util-in.o] Error 2 make[1]: *** [Makefile.perf:280: sub-make] Error 2 make: *** [Makefile:76: all] Error 2 make: Leaving directory '/linux/tools/perf' With this patch: PERF_VERSION = 6.14.rc4.gbdfd7b9150f1 INSTALL libapi_headers GEN perf-archive GEN perf-iostat INSTALL libperf_headers CC /output/arch/powerpc/util/header.o LD /output/arch/powerpc/util/perf-util-in.o LD /output/arch/powerpc/perf-util-in.o LD /output/arch/perf-util-in.o CC /output/util/header.o LD /output/util/perf-util-in.o LD /output/perf-util-in.o AR /output/libperf-util.a LINK /output/perf make: Leaving directory '/linux/tools/perf' ## tools/perf build completed rc = 0 ## Build completed OK Please add below tag: Tested-by: Venkat Rao Bagalkote <redacted> Regards, Venkat.