[tip:perf/core] perf symbols: Take into account symfs setting when reading file build ID

2017-02-09 Thread tip-bot for Victor Kamensky
Commit-ID:  9b200653518ea9ccc331b204c7d555d2440570d1
Gitweb: http://git.kernel.org/tip/9b200653518ea9ccc331b204c7d555d2440570d1
Author: Victor Kamensky 
AuthorDate: Mon, 6 Feb 2017 15:48:28 -0800
Committer:  Arnaldo Carvalho de Melo 
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 
Cc: Adrian Hunter 
Cc: Alexander Shishkin 
Cc: Chris Phlipot 
Cc: Dima Kogan 
Cc: He Kuang 
Cc: Kan Liang 
Cc: Masami Hiramatsu 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Wang Nan 
Cc: xe-linux-exter...@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-kamen...@cisco.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 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.


[tip:perf/core] perf symbols: Take into account symfs setting when reading file build ID

2017-02-09 Thread tip-bot for Victor Kamensky
Commit-ID:  9b200653518ea9ccc331b204c7d555d2440570d1
Gitweb: http://git.kernel.org/tip/9b200653518ea9ccc331b204c7d555d2440570d1
Author: Victor Kamensky 
AuthorDate: Mon, 6 Feb 2017 15:48:28 -0800
Committer:  Arnaldo Carvalho de Melo 
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 
Cc: Adrian Hunter 
Cc: Alexander Shishkin 
Cc: Chris Phlipot 
Cc: Dima Kogan 
Cc: He Kuang 
Cc: Kan Liang 
Cc: Masami Hiramatsu 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Wang Nan 
Cc: xe-linux-exter...@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-kamen...@cisco.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 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.


[tip:perf/core] perf symbols: debuglink should take symfs option into account

2015-02-18 Thread tip-bot for Victor Kamensky
Commit-ID:  dc6254cf870732804b76a83ff2d8a72fea4365f6
Gitweb: http://git.kernel.org/tip/dc6254cf870732804b76a83ff2d8a72fea4365f6
Author: Victor Kamensky 
AuthorDate: Mon, 26 Jan 2015 22:34:02 -0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Fri, 6 Feb 2015 11:46:36 +0100

perf symbols: debuglink should take symfs option into account

Currently code that tries to read corresponding debug symbol file from
.gnu_debuglink section (DSO_BINARY_TYPE__DEBUGLINK) does not take in
account symfs option, so filename__read_debuglink function cannot open
ELF file, if symfs option is used.

Fix is to add proper handling of symfs as it is done in other places:
use __symbol__join_symfs function to get real file name of target ELF
file.

Signed-off-by: Victor Kamensky 
Tested-by: David Ahern 
Acked-by: David Ahern 
Acked-by: Namhyung Kim 
Cc: Adrian Hunter 
Cc: Anton Blanchard 
Cc: Avi Kivity 
Cc: Dave Martin 
Cc: Jiri Olsa 
Cc: Masami Hiramatsu 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Russell King 
Cc: Waiman Long 
Cc: Will Deacon 
Cc: linux-arm-ker...@lists.infradead.org
Link: 
http://lkml.kernel.org/r/1422340442-4673-3-git-send-email-victor.kamen...@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/dso.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index a8b3f18..814554d 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -45,13 +45,13 @@ int dso__read_binary_type_filename(const struct dso *dso,
case DSO_BINARY_TYPE__DEBUGLINK: {
char *debuglink;
 
-   strncpy(filename, dso->long_name, size);
-   debuglink = filename + dso->long_name_len;
+   len = __symbol__join_symfs(filename, size, dso->long_name);
+   debuglink = filename + len;
while (debuglink != filename && *debuglink != '/')
debuglink--;
if (*debuglink == '/')
debuglink++;
-   ret = filename__read_debuglink(dso->long_name, debuglink,
+   ret = filename__read_debuglink(filename, debuglink,
   size - (debuglink - filename));
}
break;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf symbols: Ignore mapping symbols on aarch64

2015-02-18 Thread tip-bot for Victor Kamensky
Commit-ID:  4886f2ca19f6ff22ebfbe8e78c79c699e572b89f
Gitweb: http://git.kernel.org/tip/4886f2ca19f6ff22ebfbe8e78c79c699e572b89f
Author: Victor Kamensky 
AuthorDate: Mon, 26 Jan 2015 22:34:01 -0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Fri, 6 Feb 2015 11:46:36 +0100

perf symbols: Ignore mapping symbols on aarch64

Aarch64 ELF files use mapping symbols with special names $x, $d
to identify regions of Aarch64 code (see Aarch64 ELF ABI - "ARM
IHI 0056B", section "4.5.4 Mapping symbols").

The patch filters out these symbols at load time, similar to
"696b97a perf symbols: Ignore mapping symbols on ARM" changes
done for ARM before V8.

Also added handling of mapping symbols that has format
"$d." and similar for both cases.

Note we are not making difference between EM_ARM and
EM_AARCH64 mapping symbols instead code handles superset
of both.

Signed-off-by: Victor Kamensky 
Acked-by: Namhyung Kim 
Acked-by: Will Deacon 
Cc: Adrian Hunter 
Cc: Anton Blanchard 
Cc: Avi Kivity 
Cc: Dave Martin 
Cc: David Ahern 
Cc: Jiri Olsa 
Cc: linux-arm-ker...@lists.infradead.org
Cc: Masami Hiramatsu 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Russell King 
Link: 
http://lkml.kernel.org/r/1422340442-4673-2-git-send-email-victor.kamen...@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/symbol-elf.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index b24f9d8..225eb73 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -859,10 +859,9 @@ int dso__load_sym(struct dso *dso, struct map *map,
/* Reject ARM ELF "mapping symbols": these aren't unique and
 * don't identify functions, so will confuse the profile
 * output: */
-   if (ehdr.e_machine == EM_ARM) {
-   if (!strcmp(elf_name, "$a") ||
-   !strcmp(elf_name, "$d") ||
-   !strcmp(elf_name, "$t"))
+   if (ehdr.e_machine == EM_ARM || ehdr.e_machine == EM_AARCH64) {
+   if (elf_name[0] == '$' && strchr("adtx", elf_name[1])
+   && (elf_name[2] == '\0' || elf_name[2] == '.'))
continue;
}
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf symbols: Ignore mapping symbols on aarch64

2015-02-18 Thread tip-bot for Victor Kamensky
Commit-ID:  4886f2ca19f6ff22ebfbe8e78c79c699e572b89f
Gitweb: http://git.kernel.org/tip/4886f2ca19f6ff22ebfbe8e78c79c699e572b89f
Author: Victor Kamensky victor.kamen...@linaro.org
AuthorDate: Mon, 26 Jan 2015 22:34:01 -0800
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Fri, 6 Feb 2015 11:46:36 +0100

perf symbols: Ignore mapping symbols on aarch64

Aarch64 ELF files use mapping symbols with special names $x, $d
to identify regions of Aarch64 code (see Aarch64 ELF ABI - ARM
IHI 0056B, section 4.5.4 Mapping symbols).

The patch filters out these symbols at load time, similar to
696b97a perf symbols: Ignore mapping symbols on ARM changes
done for ARM before V8.

Also added handling of mapping symbols that has format
$d.any and similar for both cases.

Note we are not making difference between EM_ARM and
EM_AARCH64 mapping symbols instead code handles superset
of both.

Signed-off-by: Victor Kamensky victor.kamen...@linaro.org
Acked-by: Namhyung Kim namhy...@kernel.org
Acked-by: Will Deacon will.dea...@arm.com
Cc: Adrian Hunter adrian.hun...@intel.com
Cc: Anton Blanchard an...@samba.org
Cc: Avi Kivity a...@cloudius-systems.com
Cc: Dave Martin dave.mar...@arm.com
Cc: David Ahern dsah...@gmail.com
Cc: Jiri Olsa jo...@redhat.com
Cc: linux-arm-ker...@lists.infradead.org
Cc: Masami Hiramatsu masami.hiramatsu...@hitachi.com
Cc: Paul Mackerras pau...@samba.org
Cc: Peter Zijlstra a.p.zijls...@chello.nl
Cc: Russell King li...@arm.linux.org.uk
Link: 
http://lkml.kernel.org/r/1422340442-4673-2-git-send-email-victor.kamen...@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/util/symbol-elf.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index b24f9d8..225eb73 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -859,10 +859,9 @@ int dso__load_sym(struct dso *dso, struct map *map,
/* Reject ARM ELF mapping symbols: these aren't unique and
 * don't identify functions, so will confuse the profile
 * output: */
-   if (ehdr.e_machine == EM_ARM) {
-   if (!strcmp(elf_name, $a) ||
-   !strcmp(elf_name, $d) ||
-   !strcmp(elf_name, $t))
+   if (ehdr.e_machine == EM_ARM || ehdr.e_machine == EM_AARCH64) {
+   if (elf_name[0] == '$'  strchr(adtx, elf_name[1])
+(elf_name[2] == '\0' || elf_name[2] == '.'))
continue;
}
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf symbols: debuglink should take symfs option into account

2015-02-18 Thread tip-bot for Victor Kamensky
Commit-ID:  dc6254cf870732804b76a83ff2d8a72fea4365f6
Gitweb: http://git.kernel.org/tip/dc6254cf870732804b76a83ff2d8a72fea4365f6
Author: Victor Kamensky victor.kamen...@linaro.org
AuthorDate: Mon, 26 Jan 2015 22:34:02 -0800
Committer:  Arnaldo Carvalho de Melo a...@redhat.com
CommitDate: Fri, 6 Feb 2015 11:46:36 +0100

perf symbols: debuglink should take symfs option into account

Currently code that tries to read corresponding debug symbol file from
.gnu_debuglink section (DSO_BINARY_TYPE__DEBUGLINK) does not take in
account symfs option, so filename__read_debuglink function cannot open
ELF file, if symfs option is used.

Fix is to add proper handling of symfs as it is done in other places:
use __symbol__join_symfs function to get real file name of target ELF
file.

Signed-off-by: Victor Kamensky victor.kamen...@linaro.org
Tested-by: David Ahern dsah...@gmail.com
Acked-by: David Ahern dsah...@gmail.com
Acked-by: Namhyung Kim namhy...@kernel.org
Cc: Adrian Hunter adrian.hun...@intel.com
Cc: Anton Blanchard an...@samba.org
Cc: Avi Kivity a...@cloudius-systems.com
Cc: Dave Martin dave.mar...@arm.com
Cc: Jiri Olsa jo...@redhat.com
Cc: Masami Hiramatsu masami.hiramatsu...@hitachi.com
Cc: Paul Mackerras pau...@samba.org
Cc: Peter Zijlstra a.p.zijls...@chello.nl
Cc: Russell King li...@arm.linux.org.uk
Cc: Waiman Long waiman.l...@hp.com
Cc: Will Deacon will.dea...@arm.com
Cc: linux-arm-ker...@lists.infradead.org
Link: 
http://lkml.kernel.org/r/1422340442-4673-3-git-send-email-victor.kamen...@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo a...@redhat.com
---
 tools/perf/util/dso.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index a8b3f18..814554d 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -45,13 +45,13 @@ int dso__read_binary_type_filename(const struct dso *dso,
case DSO_BINARY_TYPE__DEBUGLINK: {
char *debuglink;
 
-   strncpy(filename, dso-long_name, size);
-   debuglink = filename + dso-long_name_len;
+   len = __symbol__join_symfs(filename, size, dso-long_name);
+   debuglink = filename + len;
while (debuglink != filename  *debuglink != '/')
debuglink--;
if (*debuglink == '/')
debuglink++;
-   ret = filename__read_debuglink(dso-long_name, debuglink,
+   ret = filename__read_debuglink(filename, debuglink,
   size - (debuglink - filename));
}
break;
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/