From: tip-bot for Chris Phlipot <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, tglx@linutronix.de, adrian.hunter@intel.com,
peterz@infradead.org, mingo@kernel.org, acme@redhat.com,
linux-kernel@vger.kernel.org, cphlipot0@gmail.com
Subject: [tip:perf/core] perf symbols: Fix handling of zero-length symbols.
Date: Tue, 10 May 2016 13:33:01 -0700 [thread overview]
Message-ID: <tip-9c7b37cd63d0d910c531233209286f169993cbd9@git.kernel.org> (raw)
In-Reply-To: <1462612620-25008-1-git-send-email-cphlipot0@gmail.com>
Commit-ID: 9c7b37cd63d0d910c531233209286f169993cbd9
Gitweb: http://git.kernel.org/tip/9c7b37cd63d0d910c531233209286f169993cbd9
Author: Chris Phlipot <cphlipot0@gmail.com>
AuthorDate: Sat, 7 May 2016 02:16:59 -0700
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 9 May 2016 18:40:03 -0300
perf symbols: Fix handling of zero-length symbols.
This change introduces a fix to symbols__find, so that it is able to
find symbols of length zero (where start == end).
The current code has the following problem:
- The current implementation of symbols__find is unable to find any symbols
of length zero.
- The db-export framework explicitly creates zero length symbols at
locations where no symbol currently exists.
The combination of the two above behaviors results in behavior similar
to the example below.
1. addr_location is created for a sample, but symbol is unable to be
resolved.
2. db export creates an "unknown" symbol of length zero at that address
and inserts it into the dso.
3. A new sample comes in at the same address, but symbol__find is unable
to find the zero length symbol, so it is still unresolved.
4. db export sees the symbol is unresolved, and allocated a duplicate
symbol, even though it already did this in step 2.
This behavior continues every time an address without symbol information
is seen, which causes a very large number of these symbols to be
allocated.
The effect of this fix can be observed by looking at the contents of an
exported database before/after the fix (generated with
scripts/python/export-to-postgresql.py)
Ex.
BEFORE THE CHANGE:
example_db=# select count(*) from symbols;
count
--------
900213
(1 row)
example_db=# select count(*) from symbols where symbols.name='unknown';
count
--------
897355
(1 row)
example_db=# select count(*) from symbols where symbols.name!='unknown';
count
-------
2858
(1 row)
AFTER THE CHANGE:
example_db=# select count(*) from symbols;
count
-------
25217
(1 row)
example_db=# select count(*) from symbols where name='unknown';
count
-------
22359
(1 row)
example_db=# select count(*) from symbols where name!='unknown';
count
-------
2858
(1 row)
Signed-off-by: Chris Phlipot <cphlipot0@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1462612620-25008-1-git-send-email-cphlipot0@gmail.com
[ Moved the test to later in the rb_tree tests, as this not the likely case ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/symbol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 415c4f6..2946295 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -301,7 +301,7 @@ static struct symbol *symbols__find(struct rb_root *symbols, u64 ip)
if (ip < s->start)
n = n->rb_left;
- else if (ip >= s->end)
+ else if (ip > s->end || (ip == s->end && ip != s->start))
n = n->rb_right;
else
return s;
prev parent reply other threads:[~2016-05-10 20:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-07 9:16 [PATCH 1/2] perf tools: fix handling of zero-length symbols Chris Phlipot
2016-05-07 9:17 ` [PATCH 2/2] perf script: fix incorrect python db-export error message Chris Phlipot
2016-05-10 20:31 ` [tip:perf/core] perf script: Fix " tip-bot for Chris Phlipot
2016-05-09 17:06 ` [PATCH 1/2] perf tools: fix handling of zero-length symbols Arnaldo Carvalho de Melo
2016-05-09 17:51 ` Chris Phlipot
2016-05-10 20:33 ` tip-bot for Chris Phlipot [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=tip-9c7b37cd63d0d910c531233209286f169993cbd9@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=cphlipot0@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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).