public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot for Naveen N. Rao" <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
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
Subject: [tip:perf/core] perf powerpc: Choose local entry point with kretprobes
Date: Wed, 15 Mar 2017 11:43:34 -0700	[thread overview]
Message-ID: <tip-44ca9341f65295c56e904cce4c84f5778f5c8537@git.kernel.org> (raw)
In-Reply-To: <7445b5334673ef5404ac1d12609bad4d73d2b567.1488961018.git.naveen.n.rao@linux.vnet.ibm.com>

Commit-ID:  44ca9341f65295c56e904cce4c84f5778f5c8537
Gitweb:     http://git.kernel.org/tip/44ca9341f65295c56e904cce4c84f5778f5c8537
Author:     Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
AuthorDate: Wed, 8 Mar 2017 13:56:10 +0530
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
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 <naveen.n.rao@linux.vnet.ibm.com>
Acked-by: Masami 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: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 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)

      parent reply	other threads:[~2017-03-15 18:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-08  8:26 [PATCH v5 0/5] kretprobe fixes Naveen N. Rao
2017-03-08  8:26 ` [PATCH v5 1/5] trace/kprobes: fix check for kretprobe offset within function entry Naveen N. Rao
2017-03-16 16:34   ` [tip:perf/core] trace/kprobes: Fix " tip-bot for Naveen N. Rao
2017-03-08  8:26 ` [PATCH v5 2/5] powerpc: kretprobes: override default function entry offset Naveen N. Rao
2017-03-08 10:43   ` Michael Ellerman
2017-03-08 14:24     ` Naveen N. Rao
2017-03-08 14:29       ` Arnaldo Carvalho de Melo
2017-03-08 16:46         ` Naveen N. Rao
2017-03-09  6:37           ` Michael Ellerman
2017-03-09  8:03             ` Naveen N. Rao
2017-03-14 13:18             ` Arnaldo Carvalho de Melo
2017-03-15  9:15               ` Naveen N. Rao
2017-04-24 22:47   ` [v5,2/5] " Michael Ellerman
2017-03-08  8:26 ` [PATCH v5 3/5] perf: probe: factor out the ftrace README scanning Naveen N. Rao
2017-03-15 18:42   ` [tip:perf/core] perf probe: Factor " tip-bot for Naveen N. Rao
2017-03-08  8:26 ` [PATCH v5 4/5] perf: kretprobes: offset from reloc_sym if kernel supports it Naveen N. Rao
2017-03-15 18:43   ` [tip:perf/core] perf kretprobes: Offset " tip-bot for Naveen N. Rao
2017-03-08  8:26 ` [PATCH v5 5/5] perf: powerpc: choose local entry point with kretprobes Naveen N. Rao
2017-03-08 10:31   ` Masami Hiramatsu
2017-03-08 11:39     ` Naveen N. Rao
2017-03-15 18:43   ` tip-bot for Naveen N. Rao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-44ca9341f65295c56e904cce4c84f5778f5c8537@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=ananth@linux.vnet.ibm.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox