mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Victor Kamensky <kamensky@cisco.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>, linux-kernel@vger.kernel.org
Cc: xe-linux-external@cisco.com, Dima Kogan <dima@secretsauce.net>,
	Kan Liang <kan.liang@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Wang Nan <wangnan0@huawei.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Chris Phlipot <cphlipot0@gmail.com>,
	He Kuang <hekuang@huawei.com>,
	Adrian Hunter <adrian.hunter@intel.com>
Subject: [PATCH] perf symbols: take in account symfs setting when reading file build ID
Date: Mon,  6 Feb 2017 15:48:28 -0800	[thread overview]
Message-ID: <1486424908-17094-1-git-send-email-kamensky@cisco.com> (raw)

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

             reply	other threads:[~2017-02-06 23:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06 23:48 Victor Kamensky [this message]
2017-02-10  7:44 ` [tip:perf/core] perf symbols: Take into " tip-bot for Victor Kamensky

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=1486424908-17094-1-git-send-email-kamensky@cisco.com \
    --to=kamensky@cisco.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=cphlipot0@gmail.com \
    --cc=dima@secretsauce.net \
    --cc=hekuang@huawei.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=wangnan0@huawei.com \
    --cc=xe-linux-external@cisco.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

all inboxes | Powered by JetHome®