Skip to contentSkip to conversation

perf uretprobe ppc64le: Fix probe location

PATCH New Ravi Bangoria 2 participants 2 messages Oct 4, 2016 – Oct 6, 2016 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf uretprobe ppc64le: Fix probe location

Perf uretprobe probes on GEP(Glabal Entry Point) which fails to record all function calls via LEP(Local Entry Point). Fix that by probing on LEP.

Objdump:
00000000100005f0 <doit>:

      100005f0:   02 10 40 3c     lis     r2,4098
      100005f4:   00 7f 42 38     addi    r2,r2,32512
      100005f8:   a6 02 08 7c     mflr    r0
      100005fc:   10 00 01 f8     std     r0,16(r1)
      10000600:   f8 ff e1 fb     std     r31,-8(r1)

Before applying patch:

  $ cat /sys/kernel/debug/tracing/uprobe_events
    r:probe_uprobe_test/doit /home/ravi/uprobe_test:0x00000000000005f0

After applying patch:

  $ cat /sys/kernel/debug/tracing/uprobe_events
    r:probe_uprobe_test/doit /home/ravi/uprobe_test:0x00000000000005f8

This is not the case with kretprobe because kernel itself finds LEP and probes on it.

---
 tools/perf/arch/powerpc/util/sym-handling.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/arch/powerpc/util/sym-handling.c +2 -1
index ed9d5d1..1030a6e 100644
@@ -82,7 +82,8 @@ void arch__fix_tev_from_maps(struct perf_probe_event *pev,
 	 *
 	 * In addition, we shouldn't specify an offset for kretprobes.
 	 */
-	if (pev->point.offset || pev->point.retprobe || !map || !sym)
+	if (pev->point.offset || (!pev->uprobes && pev->point.retprobe) ||
+	    !map || !sym)
 		return;
 
 	lep_offset = PPC64_LOCAL_ENTRY_OFFSET(sym->arch_sym);
Signature · 1 line
2.7.4
#1 lore raw
perf uretprobe ppc64le: Fix probe location
Commit-ID:  a1d9972e59e15538458c030affbfc298c32a47f8
Gitweb:     http://git.kernel.org/tip/a1d9972e59e15538458c030affbfc298c32a47f8
Author:     Ravi Bangoria <[email protected]>
AuthorDate: Tue, 4 Oct 2016 15:57:45 +0530
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 5 Oct 2016 08:14:22 -0300

perf uretprobe ppc64le: Fix probe location

Perf uretprobe probes on GEP(Global Entry Point) which fails to record all function calls via LEP(Local Entry Point). Fix that by probing on LEP.

Objdump:

00000000100005f0 <doit>:

      100005f0:   02 10 40 3c     lis     r2,4098
      100005f4:   00 7f 42 38     addi    r2,r2,32512
      100005f8:   a6 02 08 7c     mflr    r0
      100005fc:   10 00 01 f8     std     r0,16(r1)
      10000600:   f8 ff e1 fb     std     r31,-8(r1)

Before applying patch:

  $ cat /sys/kernel/debug/tracing/uprobe_events
    r:probe_uprobe_test/doit /home/ravi/uprobe_test:0x00000000000005f0

After applying patch:

  $ cat /sys/kernel/debug/tracing/uprobe_events
    r:probe_uprobe_test/doit /home/ravi/uprobe_test:0x00000000000005f8

This is not the case with kretprobes because the kernel itself finds LEP and probes on it.

---
 tools/perf/arch/powerpc/util/sym-handling.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/arch/powerpc/util/sym-handling.c +2 -1
index ed9d5d1..1030a6e 100644
@@ -82,7 +82,8 @@ void arch__fix_tev_from_maps(struct perf_probe_event *pev,
 	 *
 	 * In addition, we shouldn't specify an offset for kretprobes.
 	 */
-	if (pev->point.offset || pev->point.retprobe || !map || !sym)
+	if (pev->point.offset || (!pev->uprobes && pev->point.retprobe) ||
+	    !map || !sym)
 		return;
 
 	lep_offset = PPC64_LOCAL_ENTRY_OFFSET(sym->arch_sym);