From: tip-bot for Masami Hiramatsu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, mingo@redhat.com,
dave.long@linaro.org, hpa@zytor.com, mingo@kernel.org,
namhyung@kernel.org, masami.hiramatsu.pt@hitachi.com,
rostedt@goodmis.org, srikar@linux.vnet.ibm.com,
dsahern@gmail.com, oleg@redhat.com, tglx@linutronix.de
Subject: [tip:perf/urgent] perf symbols: Load map before using map->map_ip ()
Date: Sat, 25 Jan 2014 06:23:19 -0800 [thread overview]
Message-ID: <tip-4afc81cd1caa93daa50c1c29a3ab747c978abc13@git.kernel.org> (raw)
In-Reply-To: <20140123022950.7206.17357.stgit@kbuild-fedora.yrl.intra.hitachi.co.jp>
Commit-ID: 4afc81cd1caa93daa50c1c29a3ab747c978abc13
Gitweb: http://git.kernel.org/tip/4afc81cd1caa93daa50c1c29a3ab747c978abc13
Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Thu, 23 Jan 2014 02:29:50 +0000
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 23 Jan 2014 15:48:12 -0300
perf symbols: Load map before using map->map_ip()
In map_groups__find_symbol() map->map_ip is used without ensuring the
map is loaded. Then the address passed to map->map_ip isn't mapped at
the first time.
E.g. below code always fails to get a symbol at the first call;
addr = /* Somewhere in the kernel text */
symbol_conf.try_vmlinux_path = true;
symbol__init();
host_machine = machine__new_host();
sym = machine__find_kernel_function(host_machine,
addr, NULL, NULL);
/* Note that machine__find_kernel_function calls
map_groups__find_symbol */
This ensures it by calling map__load before using it in
map_groups__find_symbol().
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: "David A. Long" <dave.long@linaro.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
Cc: yrl.pp-manager.tt@hitachi.com
Link: http://lkml.kernel.org/r/20140123022950.7206.17357.stgit@kbuild-fedora.yrl.intra.hitachi.co.jp
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/map.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index ee1dd68..3b97513 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -386,7 +386,8 @@ struct symbol *map_groups__find_symbol(struct map_groups *mg,
{
struct map *map = map_groups__find(mg, type, addr);
- if (map != NULL) {
+ /* Ensure map is loaded before using map->map_ip */
+ if (map != NULL && map__load(map, filter) >= 0) {
if (mapp != NULL)
*mapp = map;
return map__find_symbol(map, map->map_ip(map, addr), filter);
next prev parent reply other threads:[~2014-01-25 14:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-23 2:29 [PATCH -tip 0/8] perf-probe: Updates for handling local functions correctly Masami Hiramatsu
2014-01-23 2:29 ` [PATCH -tip 1/8] [BUGFIX] perf-probe: Fix to do exit call for symbol maps Masami Hiramatsu
2014-01-23 2:29 ` [PATCH -tip 2/8] [BUGFIX] perf-tools: Load map before using map->map_ip Masami Hiramatsu
2014-01-23 14:43 ` Arnaldo Carvalho de Melo
2014-01-25 14:23 ` tip-bot for Masami Hiramatsu [this message]
2014-01-23 2:29 ` [PATCH -tip 3/8] perf-probe: Show in what binaries/modules probes are set Masami Hiramatsu
2014-01-23 14:49 ` Arnaldo Carvalho de Melo
2014-01-23 2:29 ` [PATCH -tip 4/8] perf-probe: Use the actual address instead of the symbol name Masami Hiramatsu
2014-01-23 14:52 ` Arnaldo Carvalho de Melo
2014-01-23 16:12 ` Steven Rostedt
2014-01-24 1:49 ` Masami Hiramatsu
2014-01-24 12:13 ` Arnaldo Carvalho de Melo
2014-01-25 3:04 ` Masami Hiramatsu
2014-01-23 2:29 ` [PATCH -tip 5/8] perf-probe: Show source level information for address only kprobes Masami Hiramatsu
2014-01-23 2:29 ` [PATCH -tip 6/8] perf-probe: Show symbol+offset " Masami Hiramatsu
2014-01-23 2:30 ` [PATCH -tip 7/8] perf-probe: Show source-level or symbol-level info for uprobes Masami Hiramatsu
2014-01-23 2:30 ` [PATCH -tip 8/8] perf-probe: Allow to add events on the local functions Masami Hiramatsu
2014-01-27 10:26 ` [PATCH -tip 0/8] perf-probe: Updates for handling local functions correctly Masami Hiramatsu
2014-01-27 14:46 ` Arnaldo Carvalho de Melo
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-4afc81cd1caa93daa50c1c29a3ab747c978abc13@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=dave.long@linaro.org \
--cc=dsahern@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=oleg@redhat.com \
--cc=rostedt@goodmis.org \
--cc=srikar@linux.vnet.ibm.com \
--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
Powered by JetHome