Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752397AbaAYOYW (ORCPT ); Sat, 25 Jan 2014 09:24:22 -0500 Received: from terminus.zytor.com ([198.137.202.10]:52418 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752295AbaAYOXo (ORCPT ); Sat, 25 Jan 2014 09:23:44 -0500 Date: Sat, 25 Jan 2014 06:23:19 -0800 From: tip-bot for Masami Hiramatsu Message-ID: 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 Reply-To: mingo@kernel.org, hpa@zytor.com, dave.long@linaro.org, mingo@redhat.com, linux-kernel@vger.kernel.org, acme@redhat.com, namhyung@kernel.org, masami.hiramatsu.pt@hitachi.com, rostedt@goodmis.org, srikar@linux.vnet.ibm.com, dsahern@gmail.com, tglx@linutronix.de, oleg@redhat.com In-Reply-To: <20140123022950.7206.17357.stgit@kbuild-fedora.yrl.intra.hitachi.co.jp> References: <20140123022950.7206.17357.stgit@kbuild-fedora.yrl.intra.hitachi.co.jp> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf symbols: Load map before using map->map_ip () Git-Commit-ID: 4afc81cd1caa93daa50c1c29a3ab747c978abc13 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.1 (terminus.zytor.com [127.0.0.1]); Sat, 25 Jan 2014 06:23:26 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 4afc81cd1caa93daa50c1c29a3ab747c978abc13 Gitweb: http://git.kernel.org/tip/4afc81cd1caa93daa50c1c29a3ab747c978abc13 Author: Masami Hiramatsu AuthorDate: Thu, 23 Jan 2014 02:29:50 +0000 Committer: Arnaldo Carvalho de Melo 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 Cc: "David A. Long" Cc: David Ahern Cc: Ingo Molnar Cc: Namhyung Kim Cc: Oleg Nesterov Cc: Srikar Dronamraju Cc: "Steven Rostedt (Red Hat)" 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 --- 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); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/