From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752056AbdCDAvQ (ORCPT ); Fri, 3 Mar 2017 19:51:16 -0500 Received: from mail.kernel.org ([198.145.29.136]:52818 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751677AbdCDAvN (ORCPT ); Fri, 3 Mar 2017 19:51:13 -0500 Date: Sat, 4 Mar 2017 09:50:44 +0900 From: Masami Hiramatsu To: "Naveen N. Rao" Cc: Arnaldo Carvalho de Melo , Steven Rostedt , Ingo Molnar , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Ananth N Mavinakayanahalli , Michael Ellerman Subject: Re: [PATCH v4 3/3] perf: powerpc: choose local entry point with kretprobes Message-Id: <20170304095044.7f82f3952f34ea6e1ae93a45@kernel.org> In-Reply-To: <9de477aa0064e0a066146be5b3629615b8957960.1488475783.git.naveen.n.rao@linux.vnet.ibm.com> References: <9de477aa0064e0a066146be5b3629615b8957960.1488475783.git.naveen.n.rao@linux.vnet.ibm.com> X-Mailer: Sylpheed 3.5.0 (GTK+ 2.24.30; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2 Mar 2017 23:25:07 +0530 "Naveen N. Rao" wrote: > 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. Looks good to me. Acked-by: Masami Hiramatsu Thanks! > > Signed-off-by: Naveen N. Rao > --- > tools/perf/arch/powerpc/util/sym-handling.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/tools/perf/arch/powerpc/util/sym-handling.c b/tools/perf/arch/powerpc/util/sym-handling.c > index 1030a6e504bb..cc7c2697c036 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,11 +80,12 @@ 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 && !kretprobe_offset_is_supported()) > return; > > lep_offset = PPC64_LOCAL_ENTRY_OFFSET(sym->arch_sym); > -- > 2.11.1 > -- Masami Hiramatsu