Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 44ca9341 authored by Naveen N. Rao's avatar Naveen N. Rao Committed by Arnaldo Carvalho de Melo
Browse files

perf powerpc: Choose local entry point with kretprobes



perf now uses an offset from _text/_stext for kretprobes if the kernel
supports it, rather than the actual function name. As such, let's choose
the LEP for powerpc ABIv2 so as to ensure the probe gets hit. Do it only
if the kernel supports specifying offsets with kretprobes.

Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: linuxppc-dev@lists.ozlabs.org
Link: http://lkml.kernel.org/r/7445b5334673ef5404ac1d12609bad4d73d2b567.1488961018.git.naveen.n.rao@linux.vnet.ibm.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 7ab31d94
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
#include "symbol.h"
#include "map.h"
#include "probe-event.h"
#include "probe-file.h"

#ifdef HAVE_LIBELF_SUPPORT
bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
@@ -79,12 +80,17 @@ void arch__fix_tev_from_maps(struct perf_probe_event *pev,
	 * However, if the user specifies an offset, we fall back to using the
	 * GEP since all userspace applications (objdump/readelf) show function
	 * disassembly with offsets from the GEP.
	 *
	 * In addition, we shouldn't specify an offset for kretprobes.
	 */
	if (pev->point.offset || (!pev->uprobes && pev->point.retprobe) ||
	    !map || !sym)
	if (pev->point.offset || !map || !sym)
		return;

	/* For kretprobes, add an offset only if the kernel supports it */
	if (!pev->uprobes && pev->point.retprobe) {
#ifdef HAVE_LIBELF_SUPPORT
		if (!kretprobe_offset_is_supported())
#endif
			return;
	}

	lep_offset = PPC64_LOCAL_ENTRY_OFFSET(sym->arch_sym);