diff mbox

[RFC,7/8] perf probe powerpc: Use DWARF info only if necessary

Message ID 50dd0fedb50e3a56ff8f25c44098db3e2a2d6374.1418146300.git.naveen.n.rao@linux.vnet.ibm.com (mailing list archive)
State Changes Requested
Delegated to: Michael Ellerman
Headers show

Commit Message

Naveen N. Rao Dec. 9, 2014, 5:34 p.m. UTC
Use symbol table lookups by default if DWARF is not necessary, since
powerpc ABIv2 encodes local entry points in the symbol table and the
function entry address in DWARF may not be appropriate for kprobes,
as described here:
https://sourceware.org/bugzilla/show_bug.cgi?id=17638

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 tools/perf/util/probe-event.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Michael Ellerman Dec. 10, 2014, 10:17 a.m. UTC | #1
On Tue, 2014-12-09 at 23:04 +0530, Naveen N. Rao wrote:
> Use symbol table lookups by default if DWARF is not necessary, since
> powerpc ABIv2 encodes local entry points in the symbol table and the
> function entry address in DWARF may not be appropriate for kprobes,
> as described here:
> https://sourceware.org/bugzilla/show_bug.cgi?id=17638

Needs a better changelog.

> diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> index 174c22e..adcdbd2 100644
> --- a/tools/perf/util/probe-event.c
> +++ b/tools/perf/util/probe-event.c
> @@ -2382,6 +2382,14 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev,
>  		}
>  	}
>  
> +#if defined(__powerpc64__) && defined(_CALL_ELF) && _CALL_ELF == 2
> +	if (!perf_probe_event_need_dwarf(pev)) {
> +		ret = find_probe_trace_events_from_map(pev, tevs, max_tevs, target);
> +		if (ret > 0)
> +			return ret;	/* Found in symbol table */
> +	}
> +#endif

And should be in an arch helper, not a big powerpc wart dropped in the middle
of the generic code.

cheers
Naveen N. Rao Dec. 10, 2014, 11:48 a.m. UTC | #2
On 2014/12/10 09:17PM, Michael Ellerman wrote:
> On Tue, 2014-12-09 at 23:04 +0530, Naveen N. Rao wrote:
> > Use symbol table lookups by default if DWARF is not necessary, since
> > powerpc ABIv2 encodes local entry points in the symbol table and the
> > function entry address in DWARF may not be appropriate for kprobes,
> > as described here:
> > https://sourceware.org/bugzilla/show_bug.cgi?id=17638
> 
> Needs a better changelog.

Ok. Will add, but to elaborate quickly: DWARF will only include the 
entire function in low_pc/entry_pc and high_pc. It can't indicate the 
local entry point. Hence, we need to use the symbol table instead of 
DWARF on ABIv2.

> 
> > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> > index 174c22e..adcdbd2 100644
> > --- a/tools/perf/util/probe-event.c
> > +++ b/tools/perf/util/probe-event.c
> > @@ -2382,6 +2382,14 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev,
> >  		}
> >  	}
> >  
> > +#if defined(__powerpc64__) && defined(_CALL_ELF) && _CALL_ELF == 2
> > +	if (!perf_probe_event_need_dwarf(pev)) {
> > +		ret = find_probe_trace_events_from_map(pev, tevs, max_tevs, target);
> > +		if (ret > 0)
> > +			return ret;	/* Found in symbol table */
> > +	}
> > +#endif
> 
> And should be in an arch helper, not a big powerpc wart dropped in the middle
> of the generic code.

Sure - will change.

Thanks for the review!
- Naveen
diff mbox

Patch

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 174c22e..adcdbd2 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2382,6 +2382,14 @@  static int convert_to_probe_trace_events(struct perf_probe_event *pev,
 		}
 	}
 
+#if defined(__powerpc64__) && defined(_CALL_ELF) && _CALL_ELF == 2
+	if (!perf_probe_event_need_dwarf(pev)) {
+		ret = find_probe_trace_events_from_map(pev, tevs, max_tevs, target);
+		if (ret > 0)
+			return ret;	/* Found in symbol table */
+	}
+#endif
+
 	/* Convert perf_probe_event with debuginfo */
 	ret = try_to_find_probe_trace_events(pev, tevs, max_tevs, target);
 	if (ret != 0)