Commit c1fbc0cf authored by Ravi Bangoria's avatar Ravi Bangoria Committed by Arnaldo Carvalho de Melo

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.htmlReported-by: default avatarAlexander Pozdneev <pozdneyev@gmail.com>
Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Acked-by: default avatarJiri 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 1addcd55
...@@ -685,6 +685,8 @@ static enum match_result match_chain(struct callchain_cursor_node *node, ...@@ -685,6 +685,8 @@ static enum match_result match_chain(struct callchain_cursor_node *node,
{ {
struct symbol *sym = node->sym; struct symbol *sym = node->sym;
u64 left, right; u64 left, right;
struct dso *left_dso = NULL;
struct dso *right_dso = NULL;
if (callchain_param.key == CCKEY_SRCLINE) { if (callchain_param.key == CCKEY_SRCLINE) {
enum match_result match = match_chain_srcline(node, cnode); 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,12 +698,14 @@ static enum match_result match_chain(struct callchain_cursor_node *node,
if (cnode->ms.sym && sym && callchain_param.key == CCKEY_FUNCTION) { if (cnode->ms.sym && sym && callchain_param.key == CCKEY_FUNCTION) {
left = cnode->ms.sym->start; left = cnode->ms.sym->start;
right = sym->start; right = sym->start;
left_dso = cnode->ms.map->dso;
right_dso = node->map->dso;
} else { } else {
left = cnode->ip; left = cnode->ip;
right = node->ip; right = node->ip;
} }
if (left == right) { if (left == right && left_dso == right_dso) {
if (node->branch) { if (node->branch) {
cnode->branch_count++; cnode->branch_count++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment