LKML Archive on
 help / color / Atom feed
From: Namhyung Kim <>
To: Arnaldo Carvalho de Melo <>
Cc: Peter Zijlstra <>,
	Paul Mackerras <>, Ingo Molnar <>,
	Namhyung Kim <>,
	LKML <>, Jiri Olsa <>,
	David Ahern <>
Subject: [PATCH 1/2] perf tools: Compare dso's also when comparing symbols
Date: Tue, 15 Oct 2013 11:01:56 +0900
Message-ID: <> (raw)

From: Namhyung Kim <>

Linus reported that sometimes 'perf report -s symbol' exits without
any message on TUI.  David and Jiri found that it's because it failed
to add a hist entry due to an invalid symbol length.

It turns out that sorting by symbol (address) was broken since it only
compares symbol addresses.  The symbol address is a relative address
within a dso thus just checking its address can result in merging
unrelated symbols together.  Fix it by checking dso before comparing
symbol address.

Reported-by: Linus Torvalds <>
Cc: David Ahern <>
Cc: Jiri Olsa <>
Signed-off-by: Namhyung Kim <>
 tools/perf/util/sort.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 32c56377e008..1f9821db9e77 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -182,9 +182,19 @@ static int64_t _sort__sym_cmp(struct symbol *sym_l, struct symbol *sym_r)
 static int64_t
 sort__sym_cmp(struct hist_entry *left, struct hist_entry *right)
+	int64_t ret;
 	if (!left->ms.sym && !right->ms.sym)
 		return right->level - left->level;
+	/*
+	 * comparing symbol address alone is not enough since it's a
+	 * relative address within a dso.
+	 */
+	ret = sort__dso_cmp(left, right);
+	if (ret != 0)
+		return ret;
 	return _sort__sym_cmp(left->ms.sym, right->ms.sym);

             reply index

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-15  2:01 Namhyung Kim [this message]
2013-10-15  2:01 ` [RFC/PATCH 2/2] perf tools: Sort dso using pointers Namhyung Kim
2013-10-15  6:08 ` [PATCH 1/2] perf tools: Compare dso's also when comparing symbols Ingo Molnar
2013-10-15  7:12   ` Namhyung Kim
2013-10-23  7:54 ` [tip:perf/core] perf tools: Compare dso' s " tip-bot for Namhyung Kim

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on

Archives are clonable:
	git clone --mirror lkml/git/0.git
	git clone --mirror lkml/git/1.git
	git clone --mirror lkml/git/2.git
	git clone --mirror lkml/git/3.git
	git clone --mirror lkml/git/4.git
	git clone --mirror lkml/git/5.git
	git clone --mirror lkml/git/6.git
	git clone --mirror lkml/git/7.git
	git clone --mirror lkml/git/8.git
	git clone --mirror lkml/git/9.git
	git clone --mirror lkml/git/10.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ \
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone