public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf symbols: take in account symfs setting when reading file build ID
@ 2017-02-06 23:48 Victor Kamensky
  2017-02-10  7:44 ` [tip:perf/core] perf symbols: Take into " tip-bot for Victor Kamensky
  0 siblings, 1 reply; 2+ messages in thread
From: Victor Kamensky @ 2017-02-06 23:48 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, linux-kernel
  Cc: xe-linux-external, Dima Kogan, Kan Liang, Peter Zijlstra,
	Ingo Molnar, Alexander Shishkin, Masami Hiramatsu, Wang Nan,
	Namhyung Kim, Chris Phlipot, He Kuang, Adrian Hunter

After 5baecbc 'perf symbols: we can now read separate debug-info files based on
a build ID' and when --symfs option is used perf failed to pick up symbols for
file with the same name between host and sysroot specified by --symfs option.
One can see message like this:

bin/bash with build id 26f0062cb6950d4d1ab0fd9c43eae8b10ca42062 not found, continuing without symbols

It happens because code added by 5baecbc opens files directly by dso->long_name
without symbol_conf.symfs consideration, which as result picks one from the
host. It reads its build ID and later even code finds another proper file in
directory pointed by --symfs perf ignores it because build id mismatches.

Fix is to use __symbol__join_symfs to adjust file name according to --symfs
setting. If no --symfs passed the operation would noop and picks the same host
file as before.

Also note in latter tree after 5baecbc commit additional check for
'!dso->has_build_id' was added, so to observe error condition 'perf record'
should run with --no-buildid, so perf.data itself would not have build id for
target binary in buildid perf section and 'perf report' will pass
'!dso->has_build_id' condition. Or target binary should not have build id, but
the same binary on host has build id, again '!dso->has_build_id' will pass in
this case and incorrect build id could be read if --symfs is used.

Fixes: 5baecbcd9c9a ("perf symbols: we can now read separate debug-info files based on a build ID")
Signed-off-by: Victor Kamensky <kamensky@cisco.com>
Cc: xe-linux-external@cisco.com
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Dima Kogan <dima@secretsauce.net>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Chris Phlipot <cphlipot0@gmail.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: linux-kernel@vger.kernel.org
---
 tools/perf/util/symbol.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index dc93940..70e389bc 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1460,9 +1460,11 @@ int dso__load(struct dso *dso, struct map *map)
 	 * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
 	 */
 	if (!dso->has_build_id &&
-	    is_regular_file(dso->long_name) &&
-	    filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0)
+	    is_regular_file(dso->long_name)) {
+	    __symbol__join_symfs(name, PATH_MAX, dso->long_name);
+	    if (filename__read_build_id(name, build_id, BUILD_ID_SIZE) > 0)
 		dso__set_build_id(dso, build_id);
+	}
 
 	/*
 	 * Iterate over candidate debug images.
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:perf/core] perf symbols: Take into account symfs setting when reading file build ID
  2017-02-06 23:48 [PATCH] perf symbols: take in account symfs setting when reading file build ID Victor Kamensky
@ 2017-02-10  7:44 ` tip-bot for Victor Kamensky
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Victor Kamensky @ 2017-02-10  7:44 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, hpa, kan.liang, hekuang, linux-kernel, wangnan0, cphlipot0,
	tglx, alexander.shishkin, acme, namhyung, dima, kamensky,
	adrian.hunter, mhiramat, peterz

Commit-ID:  9b200653518ea9ccc331b204c7d555d2440570d1
Gitweb:     http://git.kernel.org/tip/9b200653518ea9ccc331b204c7d555d2440570d1
Author:     Victor Kamensky <kamensky@cisco.com>
AuthorDate: Mon, 6 Feb 2017 15:48:28 -0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 8 Feb 2017 09:28:55 -0300

perf symbols: Take into account symfs setting when reading file build ID

After commit 5baecbcd9c9a ("perf symbols: we can now read separate
debug-info files based on a build ID") and when --symfs option is used
perf failed to pick up symbols for file with the same name between host
and sysroot specified by --symfs option.  One can see message like this:

  bin/bash with build id 26f0062cb6950d4d1ab0fd9c43eae8b10ca42062 not found, continuing without symbols

It happens because code added by 5baecbcd9c9a opens files directly by
dso->long_name without symbol_conf.symfs consideration, which as result
picks one from the host. It reads its build ID and later even code finds
another proper file in directory pointed by --symfs perf ignores it
because build id mismatches.

Fix is to use __symbol__join_symfs to adjust file name according to
--symfs setting. If no --symfs passed the operation would noop and picks
the same host file as before.

Also note in latter tree after 5baecbcd9c9a commit additional check for
'!dso->has_build_id' was added, so to observe error condition 'perf
record' should run with --no-buildid, so perf.data itself would not have
build id for target binary in buildid perf section and 'perf report'
will pass '!dso->has_build_id' condition. Or target binary should not
have build id, but the same binary on host has build id, again
'!dso->has_build_id' will pass in this case and incorrect build id could
be read if --symfs is used.

Signed-off-by: Victor Kamensky <kamensky@cisco.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Chris Phlipot <cphlipot0@gmail.com>
Cc: Dima Kogan <dima@secretsauce.net>
Cc: He Kuang <hekuang@huawei.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: xe-linux-external@cisco.com
Fixes: 5baecbcd9c9a ("perf symbols: we can now read separate debug-info files based on a build ID")
Link: http://lkml.kernel.org/r/1486424908-17094-1-git-send-email-kamensky@cisco.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index dc93940..70e389b 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1460,9 +1460,11 @@ int dso__load(struct dso *dso, struct map *map)
 	 * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
 	 */
 	if (!dso->has_build_id &&
-	    is_regular_file(dso->long_name) &&
-	    filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0)
+	    is_regular_file(dso->long_name)) {
+	    __symbol__join_symfs(name, PATH_MAX, dso->long_name);
+	    if (filename__read_build_id(name, build_id, BUILD_ID_SIZE) > 0)
 		dso__set_build_id(dso, build_id);
+	}
 
 	/*
 	 * Iterate over candidate debug images.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-10  7:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-06 23:48 [PATCH] perf symbols: take in account symfs setting when reading file build ID Victor Kamensky
2017-02-10  7:44 ` [tip:perf/core] perf symbols: Take into " tip-bot for Victor Kamensky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox