linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Andi Kleen <ak@linux.intel.com>, David Ahern <dsahern@gmail.com>,
	Jin Yao <yao.jin@linux.intel.com>, Jiri Olsa <jolsa@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Wang Nan <wangnan0@huawei.com>
Subject: [PATCH 11/14] perf annotate: Use ops->target.name when available for unresolved call targets
Date: Mon, 19 Mar 2018 16:01:33 -0300	[thread overview]
Message-ID: <20180319190136.7441-12-acme@kernel.org> (raw)
In-Reply-To: <20180319190136.7441-1-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

There is a bug where when using 'perf annotate timerqueue_add' the
target for its only routine called with the 'callq' instruction,
'rb_insert_color', doesn't get resolved from its address when parsing
that 'callq' instruction.

That symbol resolution works when using 'perf report --tui' and then
doing annotation for 'timerqueue_add' from there, the vmlinux
dso->symbols rb_tree somehow gets in a state that we can't find that
address, that is a bug that has to be further investigated.

But since the objdump output has the function name, i.e. the raw objdump
disassembled line looks like:

So, before:

  # perf annotate timerqueue_add

              │      mov    %rbx,%rdi
              │      mov    %rbx,(%rdx)
              │    → callq  *ffffffff8184dc80
              │      mov    0x8(%rbp),%rdx
              │      test   %rdx,%rdx
              │    ↓ je     67

  # perf report

              │      mov    %rbx,%rdi
              │      mov    %rbx,(%rdx)
              │    → callq  rb_insert_color
              │      mov    0x8(%rbp),%rdx
              │      test   %rdx,%rdx
              │    ↓ je     67

And after both look the same:

  # perf annotate timerqueue_add

              │      mov    %rbx,%rdi
              │      mov    %rbx,(%rdx)
              │    → callq  rb_insert_color
              │      mov    0x8(%rbp),%rdx
              │      test   %rdx,%rdx
              │    ↓ je     67

>From 'perf report' one can annotate and navigate to that 'rb_insert_color'
function, but not directly from 'perf annotate timerqueue_add', that
remains to be investigated and fixed.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-nkktz6355rhqtq7o8atr8f8r@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/annotate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index ddad87f34a68..535357c6ce02 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -238,6 +238,9 @@ static int call__scnprintf(struct ins *ins, char *bf, size_t size,
 	if (ops->target.addr == 0)
 		return ins__raw_scnprintf(ins, bf, size, ops);
 
+	if (ops->target.name)
+		return scnprintf(bf, size, "%-6s %s", ins->name, ops->target.name);
+
 	return scnprintf(bf, size, "%-6s *%" PRIx64, ins->name, ops->target.addr);
 }
 
-- 
2.14.3

  parent reply	other threads:[~2018-03-19 19:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19 19:01 [GIT PULL 00/14] perf/core improvements and fixes Arnaldo Carvalho de Melo
2018-03-19 19:01 ` [PATCH 01/14] perf annotate: Use asprintf when formatting objdump command line Arnaldo Carvalho de Melo
2018-03-19 19:01 ` [PATCH 02/14] perf tests: Fix out of bounds access on array fd when cnt is 100 Arnaldo Carvalho de Melo
2018-03-19 19:01 ` [PATCH 03/14] perf record: Synthesize features before events in pipe mode Arnaldo Carvalho de Melo
2018-03-19 19:01 ` [PATCH 04/14] perf report: Support forced leader feature " Arnaldo Carvalho de Melo
2018-03-19 19:01 ` [PATCH 05/14] perf vendor events: Update POWER9 events Arnaldo Carvalho de Melo
2018-03-19 19:01 ` [PATCH 06/14] perf mmap: Discard head in overwrite_rb_find_range() Arnaldo Carvalho de Melo
2018-03-19 19:01 ` [PATCH 07/14] perf debug: Avoid setting 'quiet' to 'true' unnecessarily Arnaldo Carvalho de Melo
2018-03-19 19:01 ` [PATCH 08/14] perf tools: Fix snprint warnings for gcc 8 Arnaldo Carvalho de Melo
2018-03-19 19:01 ` [PATCH 09/14] perf tools: Fix python extension build " Arnaldo Carvalho de Melo
2018-03-19 19:01 ` [PATCH 10/14] perf top: Document --ignore-vmlinux Arnaldo Carvalho de Melo
2018-03-19 19:01 ` Arnaldo Carvalho de Melo [this message]
2018-03-19 19:01 ` [PATCH 12/14] perf probe: Use right type to access array elements Arnaldo Carvalho de Melo
2018-03-19 19:01 ` [PATCH 13/14] objtool, perf: Fix GCC 8 -Wrestrict error Arnaldo Carvalho de Melo
2018-03-19 19:01 ` [PATCH 14/14] perf tests bp_account: Fix build with clang-6 Arnaldo Carvalho de Melo
2018-03-19 19:39 ` [GIT PULL 00/14] perf/core improvements and fixes Ingo Molnar

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=20180319190136.7441-12-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=dsahern@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=wangnan0@huawei.com \
    --cc=yao.jin@linux.intel.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;
as well as URLs for NNTP newsgroup(s).