Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753813AbdCOSpZ (ORCPT ); Wed, 15 Mar 2017 14:45:25 -0400 Received: from terminus.zytor.com ([65.50.211.136]:39652 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751756AbdCOSnv (ORCPT ); Wed, 15 Mar 2017 14:43:51 -0400 Date: Wed, 15 Mar 2017 11:43:34 -0700 From: "tip-bot for Naveen N. Rao" Message-ID: Cc: linux-kernel@vger.kernel.org, rostedt@goodmis.org, mhiramat@kernel.org, acme@redhat.com, ananth@linux.vnet.ibm.com, hpa@zytor.com, naveen.n.rao@linux.vnet.ibm.com, mpe@ellerman.id.au, mingo@kernel.org, tglx@linutronix.de Reply-To: mhiramat@kernel.org, rostedt@goodmis.org, linux-kernel@vger.kernel.org, hpa@zytor.com, ananth@linux.vnet.ibm.com, acme@redhat.com, naveen.n.rao@linux.vnet.ibm.com, tglx@linutronix.de, mpe@ellerman.id.au, mingo@kernel.org In-Reply-To: <7445b5334673ef5404ac1d12609bad4d73d2b567.1488961018.git.naveen.n.rao@linux.vnet.ibm.com> References: <7445b5334673ef5404ac1d12609bad4d73d2b567.1488961018.git.naveen.n.rao@linux.vnet.ibm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf powerpc: Choose local entry point with kretprobes Git-Commit-ID: 44ca9341f65295c56e904cce4c84f5778f5c8537 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2487 Lines: 61 Commit-ID: 44ca9341f65295c56e904cce4c84f5778f5c8537 Gitweb: http://git.kernel.org/tip/44ca9341f65295c56e904cce4c84f5778f5c8537 Author: Naveen N. Rao AuthorDate: Wed, 8 Mar 2017 13:56:10 +0530 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 14 Mar 2017 15:17:39 -0300 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: Naveen N. Rao Acked-by: Masami Hiramatsu Cc: Ananth N Mavinakayanahalli Cc: Michael Ellerman Cc: Steven Rostedt 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: Arnaldo Carvalho de Melo --- tools/perf/arch/powerpc/util/sym-handling.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/perf/arch/powerpc/util/sym-handling.c b/tools/perf/arch/powerpc/util/sym-handling.c index 1030a6e..39dbe51 100644 --- a/tools/perf/arch/powerpc/util/sym-handling.c +++ b/tools/perf/arch/powerpc/util/sym-handling.c @@ -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,13 +80,18 @@ 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); if (map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS)