Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1600808

[PATCH 17/19] perf powerpc: Choose local entry point with kretprobes

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 17/19] perf powerpc: Choose local entry point with kretprobes
Date 2017-03-14 20:00 +0100
Message-ID <tkZPP-4ju-17@gated-at.bofh.it> (permalink)
References <tkZPP-4ju-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>

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 1030a6e504bb..39dbe512b9fc 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)
-- 
2.9.3

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/19] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 17/19] perf powerpc: Choose local entry point with kretprobes Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 12/19] perf script: Add script print support for namespace events Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 16/19] perf kretprobes: Offset from reloc_sym if kernel supports it Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 04/19] perf tools: Missing c2c command in command-list Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 07/19] perf report: Document +field style argument support for --field option Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 05/19] perf tools: Ignore generated files pmu-events/{jevents,pmu-events.c} for git Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 06/19] perf sort: Fix segfault with basic block 'cycles' sort dimension Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 19/19] kprobes: Convert kprobe_exceptions_notify to use NOKPROBE_SYMBOL Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 14/19] perf sched timehist: Add --next option Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 13/19] perf tools: Add 'cgroup_id' sort order keyword Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 03/19] perf c2c: Fix display bug when using pipe Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 01/19] perf report: Hide tip message when -q option is given Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 02/19] perf c2c: Clarify help message of --stats option Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 18/19] doc: trace/kprobes: add information about NOKPROBE_SYMBOL Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 10/19] perf tools: Add PERF_RECORD_NAMESPACES to include namespaces related info Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 08/19] perf hists browser: Fix typo in function switch_data_file Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  [PATCH 15/19] perf probe: Factor out the ftrace README scanning Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-14 20:00 +0100
  Re: [GIT PULL 00/19] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2017-03-15 19:40 +0100

csiph-web