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


Groups > linux.kernel > #1591477 > unrolled thread

[PATCH v4 3/3] perf: powerpc: choose local entry point with kretprobes

Started by"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
First post2017-03-02 22:30 +0100
Last post2017-03-04 02:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v4 3/3] perf: powerpc: choose local entry point with kretprobes "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-03-02 22:30 +0100
    Re: [PATCH v4 3/3] perf: powerpc: choose local entry point with  kretprobes Masami Hiramatsu <mhiramat@kernel.org> - 2017-03-04 02:00 +0100

#1591477 — [PATCH v4 3/3] perf: powerpc: choose local entry point with kretprobes

From"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Date2017-03-02 22:30 +0100
Subject[PATCH v4 3/3] perf: powerpc: choose local entry point with kretprobes
Message-ID<tgGsr-852-41@gated-at.bofh.it>
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>
---
 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

[toc] | [next] | [standalone]


#1592364 — Re: [PATCH v4 3/3] perf: powerpc: choose local entry point with kretprobes

FromMasami Hiramatsu <mhiramat@kernel.org>
Date2017-03-04 02:00 +0100
SubjectRe: [PATCH v4 3/3] perf: powerpc: choose local entry point with kretprobes
Message-ID<th6db-Gi-1@gated-at.bofh.it>
In reply to#1591477
On Thu,  2 Mar 2017 23:25:07 +0530
"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> 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 <mhiramat@kernel.org>

Thanks!

> 
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> ---
>  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 <mhiramat@kernel.org>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web