Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf probe ppc64le: Fixup function entry if using kallsyms lookup

On powerpc ABIv2, if no debug-info is found and we use kallsyms, we need
to fixup the function entry to point to the local entry point. Use
offset of 8 since current toolchains always generate 2 instructions (8
bytes).

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Link: http://lkml.kernel.org/r/92253021e77a104b23b615c8c23bf9501dfe60bf.1430217967.git.naveen.n.rao@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Naveen N. Rao and committed by
Arnaldo Carvalho de Melo
7b6ff0bd d5c2e2c1

+22
+15
tools/perf/arch/powerpc/util/sym-handling.c
··· 64 64 { 65 65 return true; 66 66 } 67 + 68 + #define PPC64LE_LEP_OFFSET 8 69 + 70 + void arch__fix_tev_from_maps(struct perf_probe_event *pev, 71 + struct probe_trace_event *tev, struct map *map) 72 + { 73 + /* 74 + * ppc64 ABIv2 local entry point is currently always 2 instructions 75 + * (8 bytes) after the global entry point. 76 + */ 77 + if (!pev->uprobes && map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS) { 78 + tev->point.address += PPC64LE_LEP_OFFSET; 79 + tev->point.offset += PPC64LE_LEP_OFFSET; 80 + } 81 + } 67 82 #endif
+5
tools/perf/util/probe-event.c
··· 2447 2447 #define strdup_or_goto(str, label) \ 2448 2448 ({ char *__p = strdup(str); if (!__p) goto label; __p; }) 2449 2449 2450 + void __weak arch__fix_tev_from_maps(struct perf_probe_event *pev __maybe_unused, 2451 + struct probe_trace_event *tev __maybe_unused, 2452 + struct map *map __maybe_unused) { } 2453 + 2450 2454 /* 2451 2455 * Find probe function addresses from map. 2452 2456 * Return an error or the number of found probe_trace_event ··· 2557 2553 strdup_or_goto(pev->args[i].type, 2558 2554 nomem_out); 2559 2555 } 2556 + arch__fix_tev_from_maps(pev, tev, map); 2560 2557 } 2561 2558 2562 2559 out:
+2
tools/perf/util/probe-event.h
··· 136 136 extern int show_available_funcs(const char *module, struct strfilter *filter, 137 137 bool user); 138 138 bool arch__prefers_symtab(void); 139 + void arch__fix_tev_from_maps(struct perf_probe_event *pev, 140 + struct probe_trace_event *tev, struct map *map); 139 141 140 142 /* Maximum index number of event-name postfix */ 141 143 #define MAX_EVENT_INDEX 1024