From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755346AbdCGKuC (ORCPT ); Tue, 7 Mar 2017 05:50:02 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:55200 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754796AbdCGKsu (ORCPT ); Tue, 7 Mar 2017 05:48:50 -0500 From: "Naveen N. Rao" To: Arnaldo Carvalho de Melo , Masami Hiramatsu Cc: Steven Rostedt , Ingo Molnar , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Ananth N Mavinakayanahalli , Michael Ellerman Subject: [RESEND PATCH 6/6] perf: powerpc: choose local entry point with kretprobes Date: Tue, 7 Mar 2017 16:17:41 +0530 X-Mailer: git-send-email 2.11.1 In-Reply-To: References: In-Reply-To: References: <20170306220638.e7db155d44e14325c5c0174b@kernel.org> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17030710-0012-0000-0000-000003C64112 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17030710-0013-0000-0000-00001B4B93D1 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-03-07_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703070091 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Acked-by: Masami Hiramatsu 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..e93b3db25012 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 "trace-event.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