linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Thomas-Mich Richter <tmricht@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com,
	heiko.carstens@de.ibm.com
Subject: Re: [PATCH v2] perf trace: Fix missing handling of --call-graph dwarf
Date: Mon, 15 Jan 2018 12:02:27 -0300	[thread overview]
Message-ID: <20180115150227.GE3542@kernel.org> (raw)
In-Reply-To: <4ead78ee-398b-c782-330f-61359ad40fe2@linux.vnet.ibm.com>

Em Mon, Jan 15, 2018 at 03:50:15PM +0100, Thomas-Mich Richter escreveu:
> On 01/15/2018 03:16 PM, Arnaldo Carvalho de Melo wrote:
> > Em Mon, Jan 15, 2018 at 10:57:52AM -0300, Arnaldo Carvalho de Melo escreveu:
> >>> [root@f27 perf]# ./perf trace --no-syscalls --max-stack 4
> >>>         -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
> >>> PING ::1(::1) 56 data bytes
> >>> 64 bytes from ::1: icmp_seq=1 ttl=64 time=0.020 ms
> >>>
> >>> --- ::1 ping statistics ---
> >>> 1 packets transmitted, 1 received, 0% packet loss, time 0ms
> >>> rtt min/avg/max/mdev = 0.020/0.020/0.020/0.000 ms
> >>>      0.000 probe_libc:inet_pton:(7ffbc5f768a0))
> >>>             __inet_pton (inlined)
> >>>             gaih_inet.constprop.7 (/usr/lib64/libc-2.26.so)
> >>>             __GI_getaddrinfo (inlined)
> >>>             main (/usr/bin/ping)
> >>> [root@f27 perf]#
> >>>
> >>>
> >>> --> Dwarf call graph and --max-stack 4 is also honoured.
> >>
> >> [root@jouet ~]# perf trace --no-syscalls -e probe_libc:inet_pton/call-graph=dwarf,max-stack=4/
> >> perf trace --no-syscalls --max-stack 4 -e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
> >> Value too large for defined data type
> >> [root@jouet ~]# 
> >>
> >> Grrr.
> > 
> > 
> > Got this one fixed with the following patch:
> > 
> > commit b78278e11f6992ca348a4b96aad3b2c0a9ecf0f0
> 
> [...]
> 
> > 
> > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> > index efa2e629a669..8f971a2301d1 100644
> > --- a/tools/perf/util/evsel.c
> > +++ b/tools/perf/util/evsel.c
> > @@ -731,14 +731,14 @@ static void apply_config_terms(struct perf_evsel *evsel,
> >  	struct perf_evsel_config_term *term;
> >  	struct list_head *config_terms = &evsel->config_terms;
> >  	struct perf_event_attr *attr = &evsel->attr;
> > -	struct callchain_param param;
> > +	/* callgraph default */
> > +	struct callchain_param param = {
> > +		.record_mode = callchain_param.record_mode,
> > +	};
> >  	u32 dump_size = 0;
> >  	int max_stack = 0;
> >  	const char *callgraph_buf = NULL;
> > 
> > -	/* callgraph default */
> > -	param.record_mode = callchain_param.record_mode;
> > -
> >  	list_for_each_entry(term, config_terms, list) {
> >  		switch (term->type) {
> >  		case PERF_EVSEL__CONFIG_TERM_PERIOD:
> 
> This patch works for me.
> Here is the output on my s390x:
> 
> [root@s8360047 perf]# ./perf trace --no-syscalls --max-stack 4 
> 	-e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
> PING ::1(::1) 56 data bytes
> 64 bytes from ::1: icmp_seq=1 ttl=64 time=0.070 ms
> 
> --- ::1 ping statistics ---
> 1 packets transmitted, 1 received, 0% packet loss, time 0ms
> rtt min/avg/max/mdev = 0.070/0.070/0.070/0.000 ms
>      0.000 probe_libc:inet_pton:(3ffa70c2060))
>            __GI___inet_pton (/usr/lib64/libc-2.26.so)
>            gaih_inet (inlined)
>            __GI_getaddrinfo (inlined)
>            main (/usr/bin/ping)
> [root@s8360047 perf]# ./perf trace --no-syscalls --call-graph dwarf 
> 	-e probe_libc:inet_pton -- ping -6 -c 1 ::1
> PING ::1(::1) 56 data bytes
> 64 bytes from ::1: icmp_seq=1 ttl=64 time=0.086 ms
> 
> --- ::1 ping statistics ---
> 1 packets transmitted, 1 received, 0% packet loss, time 0ms
> rtt min/avg/max/mdev = 0.086/0.086/0.086/0.000 ms
>      0.000 probe_libc:inet_pton:(3ff93fc2060))
>            __GI___inet_pton (/usr/lib64/libc-2.26.so)
>            gaih_inet (inlined)
>            __GI_getaddrinfo (inlined)
>            main (/usr/bin/ping)
>            __libc_start_main (/usr/lib64/libc-2.26.so)
>            _start (/usr/bin/ping)
> [root@s8360047 perf]#
> 
> [root@s8360047 perf]# ./perf trace --no-syscalls 
> 	-e probe_libc:inet_pton/call-graph=dwarf,max-stack=3/ ping -6 -c 1 ::1
> PING ::1(::1) 56 data bytes
> 64 bytes from ::1: icmp_seq=1 ttl=64 time=0.066 ms
> 
> --- ::1 ping statistics ---
> 1 packets transmitted, 1 received, 0% packet loss, time 0ms
> rtt min/avg/max/mdev = 0.066/0.066/0.066/0.000 ms
>      0.000 probe_libc:inet_pton:(3ffb82c2060))
>            __GI___inet_pton (/usr/lib64/libc-2.26.so)
>            gaih_inet (inlined)
>            __GI_getaddrinfo (inlined)
>            main (/usr/bin/ping)
>            __libc_start_main (/usr/lib64/libc-2.26.so)
>            _start (/usr/bin/ping)
> [root@s8360047 perf]# 
> 
> Not sure if this can work at all. Since dwarf stack unwinding is done in user space
> the attr.sample_max_stack set to 3 is useless in this case.

right, I'm working on this case now, this has to be honoured in
trace__resolve_callchain, that has to use evsel->attr.sample_max_stack
if it is set, otherwise fallback to trace->max_stack.

- Arnaldo

  reply	other threads:[~2018-01-15 15:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12 10:03 [PATCH v2] perf trace: Fix missing handling of --call-graph dwarf Thomas Richter
2018-01-12 14:20 ` Arnaldo Carvalho de Melo
2018-01-12 15:01   ` Arnaldo Carvalho de Melo
2018-01-12 16:47     ` Arnaldo Carvalho de Melo
2018-01-12 20:02       ` Arnaldo Carvalho de Melo
2018-01-15  9:11         ` Thomas-Mich Richter
2018-01-15 13:20           ` Arnaldo Carvalho de Melo
2018-01-15 12:31         ` Thomas-Mich Richter
2018-01-15 13:57           ` Arnaldo Carvalho de Melo
2018-01-15 14:16             ` Arnaldo Carvalho de Melo
2018-01-15 14:50               ` Thomas-Mich Richter
2018-01-15 15:02                 ` Arnaldo Carvalho de Melo [this message]
2018-01-15 14:45             ` Hendrik Brueckner

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=20180115150227.GE3542@kernel.org \
    --to=acme@kernel.org \
    --cc=arnaldo.melo@gmail.com \
    --cc=brueckner@linux.vnet.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=tmricht@linux.vnet.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).