1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/tools/perf/arch/powerpc/util
Athira Rajeev f6a66ff98a tools/perf/arch/powerpc: Fix the CPU ID const char* value by adding 0x prefix
Simple expression parser test fails in powerpc as below:

    4: Simple expression parser
    test child forked, pid 170385
    Using CPUID 004e2102
    division by zero
    syntax error
    syntax error
    FAILED tests/expr.c:65 parse test failed
    test child finished with -1
    Simple expression parser: FAILED!

This is observed after commit:
'commit 9d5da30e4a ("perf jevents: Add a new expression builtin strcmp_cpuid_str()")'

With this commit, a new expression builtin strcmp_cpuid_str
got added. This function takes an 'ID' type value, which is
a string. So expression parse for strcmp_cpuid_str expects
const char * as cpuid value type. In case of powerpc, CPU IDs
are numbers. Hence it doesn't get interpreted correctly by
bison parser. Example in case of power9, cpuid string returns
as: 004e2102

cpuid of string type is expected in two cases:
1. char *get_cpuid_str(struct perf_pmu *pmu __maybe_unused);

   Testcase "tests/expr.c" uses "perf_pmu__getcpuid" which calls
   get_cpuid_str to get the cpuid string.

2. cpuid field in  :struct pmu_events_map

   struct pmu_events_map {
           const char *arch;
	   const char *cpuid;

   Here cpuid field is used in "perf_pmu__find_events_table"
   function as "strcmp_cpuid_str(map->cpuid, cpuid)". The
   value for cpuid field is picked from mapfile.csv.

Fix the mapfile.csv and get_cpuid_str function to prefix
cpuid with 0x so that it gets correctly interpreted by
the bison parser

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Tested-by: Disha Goel<disgoel@linux.ibm.com>
Cc: kjain@linux.ibm.com
Cc: maddy@linux.ibm.com
Cc: disgoel@linux.vnet.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20231009050052.64935-1-atrajeev@linux.vnet.ibm.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2023-10-17 12:40:51 -07:00
..
book3s_hcalls.h KVM: PPC: Fix typo on H_DISABLE_AND_GET hcall 2020-07-23 17:43:35 +10:00
book3s_hv_exits.h KVM: PPC: Book3S: Simplify external interrupt handling 2018-10-09 16:04:27 +11:00
Build perf build: Use libtraceevent from the system 2022-12-14 11:16:12 -03:00
dwarf-regs.c perf tools: Remove util.h from where it is not needed 2019-09-20 09:19:20 -03:00
event.c perf tools: Move 'struct perf_sample' to a separate header file to disentangle headers 2022-10-31 11:06:41 -03:00
evsel.c perf powerpc: Add support for PERF_SAMPLE_WEIGHT_STRUCT 2021-03-26 08:49:48 -03:00
header.c tools/perf/arch/powerpc: Fix the CPU ID const char* value by adding 0x prefix 2023-10-17 12:40:51 -07:00
kvm-stat.c perf kvm powerpc: Add missing rename opf pmu_have_event() to perf_pmus__have_event() 2023-05-30 12:05:11 -03:00
mem-events.c perf pmu: Remove logic for PMU name being NULL 2023-08-25 10:22:16 -03:00
perf_regs.c perf parse-regs: Move out arch specific header from util/perf_regs.h 2023-08-16 08:52:45 -03:00
skip-callchain-idx.c perf callchain powerpc: Fix addr location init during arch_skip_callchain_idx function 2023-07-24 17:46:11 -03:00
sym-handling.c perf map: Add helper for ->map_ip() and ->unmap_ip() 2023-04-06 22:10:17 -03:00
unwind-libdw.c perf parse-regs: Move out arch specific header from util/perf_regs.h 2023-08-16 08:52:45 -03:00
unwind-libunwind.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
utils_header.h perf tools: Fix various typos in comments 2021-03-23 17:13:43 -03:00