From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@elte.hu>, Paul Mackerras <paulus@samba.org>,
Pekka Enberg <penberg@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
yrl.pp-manager.tt@hitachi.com,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 12/12] perf probe: Filter out redundant inline-instances
Date: Fri, 12 Aug 2011 13:29:04 -0300 [thread overview]
Message-ID: <1313166544-6209-13-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1313166544-6209-1-git-send-email-acme@infradead.org>
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
With gcc4.6, some instances of concrete inlined function looks redundant
and broken, because it appears inside of a concrete instance and its
call_file and call_line are same as the original abstruct's decl_file
and decl_line respectively.
e.g.
[ d1aa] subprogram
external (flag) Yes
name (strp) "add_timer"
decl_file (data1) 2 ;here is original
decl_line (data2) 847 ;line and file
prototyped (flag) Yes
inline (data1) inlined (1)
sibling (ref4) [ d1c6]
...
[ 11d84] subprogram
abstract_origin (ref4) [ d1aa] ; concrete instance
low_pc (addr) .text+0x000000000000246f <add_timer>
high_pc (addr) .text+0x000000000000248b <mod_timer_pending>
frame_base (block1) [ 0] call_frame_cfa
sibling (ref4) [ 11dd9]
[ 11d9f] formal_parameter
abstract_origin (ref4) [ d1b9]
location (data4) location list [ 701b]
[ 11da8] inlined_subroutine
abstract_origin (ref4) [ d1aa] ; redundant instance
low_pc (addr) .text+0x000000000000247e <add_timer+0xf>
high_pc (addr) .text+0x0000000000002480 <add_timer+0x11>
call_file (data1) 2 ; call line and file
call_line (data2) 847 ; are same as above
Those redundant instances leads unwilling results;
e.g. find probe points inside of functions even if we specify
a function entry as below;
$ perf probe -V add_timer
Available variables at add_timer
@<add_timer+0>
struct timer_list* timer
@<add_timer+15>
(No matched variables)
So, this filters out those redundant instances based on call-site and
decl-site information.
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: yrl.pp-manager.tt@hitachi.com
Link: http://lkml.kernel.org/r/20110811110317.19900.59525.stgit@fedora15
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/dwarf-aux.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
index d0f4048..ee51e9b 100644
--- a/tools/perf/util/dwarf-aux.c
+++ b/tools/perf/util/dwarf-aux.c
@@ -307,6 +307,17 @@ static int die_get_call_fileno(Dwarf_Die *in_die)
return -ENOENT;
}
+/* Get the declared file index number in CU DIE */
+static int die_get_decl_fileno(Dwarf_Die *pdie)
+{
+ Dwarf_Sword idx;
+
+ if (die_get_attr_sdata(pdie, DW_AT_decl_file, &idx) == 0)
+ return (int)idx;
+ else
+ return -ENOENT;
+}
+
/**
* die_get_call_file - Get callsite file name of inlined function instance
* @in_die: a DIE of an inlined function instance
@@ -467,6 +478,7 @@ static int __die_walk_instances_cb(Dwarf_Die *inst, void *data)
Dwarf_Die origin_mem;
Dwarf_Attribute *attr;
Dwarf_Die *origin;
+ int tmp;
attr = dwarf_attr(inst, DW_AT_abstract_origin, &attr_mem);
if (attr == NULL)
@@ -476,6 +488,16 @@ static int __die_walk_instances_cb(Dwarf_Die *inst, void *data)
if (origin == NULL || origin->addr != iwp->addr)
return DIE_FIND_CB_CONTINUE;
+ /* Ignore redundant instances */
+ if (dwarf_tag(inst) == DW_TAG_inlined_subroutine) {
+ dwarf_decl_line(origin, &tmp);
+ if (die_get_call_lineno(inst) == tmp) {
+ tmp = die_get_decl_fileno(origin);
+ if (die_get_call_fileno(inst) == tmp)
+ return DIE_FIND_CB_CONTINUE;
+ }
+ }
+
iwp->retval = iwp->callback(inst, iwp->data);
return (iwp->retval) ? DIE_FIND_CB_END : DIE_FIND_CB_CONTINUE;
--
1.6.2.5
prev parent reply other threads:[~2011-08-12 16:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-12 16:28 [GIT PULL 00/12] perf fixes Arnaldo Carvalho de Melo
2011-08-12 16:28 ` [PATCH 01/12] perf top browser: Remove spurious helpline update Arnaldo Carvalho de Melo
2011-08-12 16:28 ` [PATCH 02/12] perf report: Use properly build_id kernel binaries Arnaldo Carvalho de Melo
2011-08-12 16:28 ` [PATCH 03/12] perf: fix temporary file ownership check Arnaldo Carvalho de Melo
2011-08-12 16:28 ` [PATCH 04/12] perf probe: Fix a memory leak for scopes array Arnaldo Carvalho de Melo
2011-08-12 16:28 ` [PATCH 05/12] perf probe: Fix line walker to check CU correctly Arnaldo Carvalho de Melo
2011-08-12 16:28 ` [PATCH 06/12] perf probe: Fix to search nested inlined functions in CU Arnaldo Carvalho de Melo
2011-08-12 16:28 ` [PATCH 07/12] perf probe: Fix to walk all inline instances Arnaldo Carvalho de Melo
2011-08-12 16:29 ` [PATCH 08/12] perf probe: Warn when more than one line are given Arnaldo Carvalho de Melo
2011-08-12 16:29 ` [PATCH 09/12] perf probe: Fix to search local variables in appropriate scope Arnaldo Carvalho de Melo
2011-08-12 16:29 ` [PATCH 10/12] perf probe: Avoid searching variables in intermediate scopes Arnaldo Carvalho de Melo
2011-08-12 16:29 ` [PATCH 11/12] perf probe: Search concrete out-of-line instances Arnaldo Carvalho de Melo
2011-08-12 16:29 ` Arnaldo Carvalho de Melo [this message]
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=1313166544-6209-13-git-send-email-acme@infradead.org \
--to=acme@infradead.org \
--cc=acme@redhat.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=penberg@kernel.org \
--cc=peterz@infradead.org \
--cc=yrl.pp-manager.tt@hitachi.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
all inboxes | Powered by JetHome®