diff options
author | Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com> | 2017-10-05 05:12:34 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-10-05 09:52:54 -0400 |
commit | c1fbc0cf81f1c464f5fda322c1104d4bb1da6711 (patch) | |
tree | 06b54ec9f8dee12c4f25efe4306335e9047ebdb9 | |
parent | 1addcd55bc54d669000221b41e379458ff3e6747 (diff) |
perf callchain: Compare dsos (as well) for CCKEY_FUNCTION
Two functions from different binaries can have same start address. Thus,
comparing only start address in match_chain() leads to inconsistent
callchains. Fix this by adding a check for dsos as well.
Ex, https://www.spinics.net/lists/linux-perf-users/msg04067.html
Reported-by: Alexander Pozdneev <pozdneyev@gmail.com>
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Krister Johansen <kjlx@templeofstupid.com>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Yao Jin <yao.jin@linux.intel.com>
Cc: zhangmengting@huawei.com
Link: http://lkml.kernel.org/r/20171005091234.5874-1-ravi.bangoria@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/util/callchain.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index be09d77cade0..a971caf3759d 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c | |||
@@ -685,6 +685,8 @@ static enum match_result match_chain(struct callchain_cursor_node *node, | |||
685 | { | 685 | { |
686 | struct symbol *sym = node->sym; | 686 | struct symbol *sym = node->sym; |
687 | u64 left, right; | 687 | u64 left, right; |
688 | struct dso *left_dso = NULL; | ||
689 | struct dso *right_dso = NULL; | ||
688 | 690 | ||
689 | if (callchain_param.key == CCKEY_SRCLINE) { | 691 | if (callchain_param.key == CCKEY_SRCLINE) { |
690 | enum match_result match = match_chain_srcline(node, cnode); | 692 | enum match_result match = match_chain_srcline(node, cnode); |
@@ -696,12 +698,14 @@ static enum match_result match_chain(struct callchain_cursor_node *node, | |||
696 | if (cnode->ms.sym && sym && callchain_param.key == CCKEY_FUNCTION) { | 698 | if (cnode->ms.sym && sym && callchain_param.key == CCKEY_FUNCTION) { |
697 | left = cnode->ms.sym->start; | 699 | left = cnode->ms.sym->start; |
698 | right = sym->start; | 700 | right = sym->start; |
701 | left_dso = cnode->ms.map->dso; | ||
702 | right_dso = node->map->dso; | ||
699 | } else { | 703 | } else { |
700 | left = cnode->ip; | 704 | left = cnode->ip; |
701 | right = node->ip; | 705 | right = node->ip; |
702 | } | 706 | } |
703 | 707 | ||
704 | if (left == right) { | 708 | if (left == right && left_dso == right_dso) { |
705 | if (node->branch) { | 709 | if (node->branch) { |
706 | cnode->branch_count++; | 710 | cnode->branch_count++; |
707 | 711 | ||