* why is perf-report asking for objdump path?
@ 2012-11-01 21:09 David Ahern
2012-11-02 1:11 ` Namhyung Kim
0 siblings, 1 reply; 3+ messages in thread
From: David Ahern @ 2012-11-01 21:09 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Namhyung Kim; +Cc: LKML
$ /tmp/pbuild/perf report -i perf.data --kallsyms kallsyms
Error:
Please install objdump for i686.
You can add it to PATH, set CROSS_COMPILE or override the default using
--objdump.
And worse it refuses to run without it. If I was running the annotate
command I could understand the request -- but this is the report path.
Furthermore objdump exists:
$ which objdump
/usr/bin/objdump
yes, the file was created on an i686 target, but I should be able to use
the x86_64 host objdump if I were doing an annotate.
David
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: why is perf-report asking for objdump path?
2012-11-01 21:09 why is perf-report asking for objdump path? David Ahern
@ 2012-11-02 1:11 ` Namhyung Kim
2012-11-02 3:37 ` David Ahern
0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2012-11-02 1:11 UTC (permalink / raw)
To: David Ahern; +Cc: Arnaldo Carvalho de Melo, LKML, Irina Tirdea
Hi David,
On Thu, 01 Nov 2012 15:09:46 -0600, David Ahern wrote:
> $ /tmp/pbuild/perf report -i perf.data --kallsyms kallsyms
> Error:
> Please install objdump for i686.
> You can add it to PATH, set CROSS_COMPILE or override the default
> using --objdump.
>
> And worse it refuses to run without it. If I was running the annotate
> command I could understand the request -- but this is the report path.
Agreed. It should not affect when no annotation was used.
>
> Furthermore objdump exists:
>
> $ which objdump
> /usr/bin/objdump
>
> yes, the file was created on an i686 target, but I should be able to
> use the x86_64 host objdump if I were doing an annotate.
Could you test the below patch? It'd great if you can do it in a
reverse situation - using x86_64 target on i686 host.
>From f0a9d6303f83452c8b6f81081abae8fdf9c81778 Mon Sep 17 00:00:00 2001
From: Namhyung Kim <namhyung.kim@lge.com>
Date: Fri, 2 Nov 2012 09:48:17 +0900
Subject: [PATCH] perf tools: Use normalized arch name for searching objdump
path
David reported that perf report for i686 target data on x86_64 host
failed to work because it tried to find out cross-compiled objdump.
However objdump for x86_64 is compatible to i686 so that it doesn't
need to do it at all. To prevent similar artifacts, normalize arch
name when comparing host and file architectures.
Reported-by: David Ahern <dsahern@gmail.com>
Cc: Irina Tirdea <irina.tirdea@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/arch/common.c | 40 +++++++++++++++++++++++++++++++++-------
1 file changed, 33 insertions(+), 7 deletions(-)
diff --git a/tools/perf/arch/common.c b/tools/perf/arch/common.c
index 2367b253f039..5683529135b1 100644
--- a/tools/perf/arch/common.c
+++ b/tools/perf/arch/common.c
@@ -93,16 +93,46 @@ static int lookup_triplets(const char *const *triplets, const char *name)
return -1;
}
+/*
+ * Return architecture name in a normalized form.
+ * The conversion logic comes from the Makefile.
+ */
+static const char *normalize_arch(char *arch)
+{
+ if (!strcmp(arch, "x86_64"))
+ return "x86";
+ if (arch[0] == 'i' && arch[2] == '8' && arch[3] == '6')
+ return "x86";
+ if (!strcmp(arch, "sun4u") || !strncmp(arch, "sparc", 5))
+ return "sparc";
+ if (!strncmp(arch, "arm", 3) || !strcmp(arch, "sa110"))
+ return "arm";
+ if (!strncmp(arch, "s390", 4))
+ return "s390";
+ if (!strncmp(arch, "parisc", 6))
+ return "parisc";
+ if (!strncmp(arch, "powerpc", 7) || !strncmp(arch, "ppc", 3))
+ return "powerpc";
+ if (!strncmp(arch, "mips", 4))
+ return "mips";
+ if (!strncmp(arch, "sh", 2) && isdigit(arch[2]))
+ return "sh";
+
+ return arch;
+}
+
static int perf_session_env__lookup_binutils_path(struct perf_session_env *env,
const char *name,
const char **path)
{
int idx;
- char *arch, *cross_env;
+ const char *arch, *cross_env;
struct utsname uts;
const char *const *path_list;
char *buf = NULL;
+ arch = normalize_arch(env->arch);
+
if (uname(&uts) < 0)
goto out;
@@ -110,7 +140,7 @@ static int perf_session_env__lookup_binutils_path(struct perf_session_env *env,
* We don't need to try to find objdump path for native system.
* Just use default binutils path (e.g.: "objdump").
*/
- if (!strcmp(uts.machine, env->arch))
+ if (!strcmp(normalize_arch(uts.machine), arch))
goto out;
cross_env = getenv("CROSS_COMPILE");
@@ -127,8 +157,6 @@ static int perf_session_env__lookup_binutils_path(struct perf_session_env *env,
free(buf);
}
- arch = env->arch;
-
if (!strcmp(arch, "arm"))
path_list = arm_triplets;
else if (!strcmp(arch, "powerpc"))
@@ -139,9 +167,7 @@ static int perf_session_env__lookup_binutils_path(struct perf_session_env *env,
path_list = s390_triplets;
else if (!strcmp(arch, "sparc"))
path_list = sparc_triplets;
- else if (!strcmp(arch, "x86") || !strcmp(arch, "i386") ||
- !strcmp(arch, "i486") || !strcmp(arch, "i586") ||
- !strcmp(arch, "i686"))
+ else if (!strcmp(arch, "x86"))
path_list = x86_triplets;
else if (!strcmp(arch, "mips"))
path_list = mips_triplets;
--
1.7.11.7
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: why is perf-report asking for objdump path?
2012-11-02 1:11 ` Namhyung Kim
@ 2012-11-02 3:37 ` David Ahern
0 siblings, 0 replies; 3+ messages in thread
From: David Ahern @ 2012-11-02 3:37 UTC (permalink / raw)
To: Namhyung Kim; +Cc: Arnaldo Carvalho de Melo, LKML, Irina Tirdea
On 11/1/12 7:11 PM, Namhyung Kim wrote:
> From f0a9d6303f83452c8b6f81081abae8fdf9c81778 Mon Sep 17 00:00:00 2001
> From: Namhyung Kim<namhyung.kim@lge.com>
> Date: Fri, 2 Nov 2012 09:48:17 +0900
> Subject: [PATCH] perf tools: Use normalized arch name for searching objdump
> path
>
> David reported that perf report for i686 target data on x86_64 host
> failed to work because it tried to find out cross-compiled objdump.
>
> However objdump for x86_64 is compatible to i686 so that it doesn't
> need to do it at all. To prevent similar artifacts, normalize arch
> name when comparing host and file architectures.
>
This fixes the i686 perf.data file analyzed on x86_64. I don't have time
for the reverse - partly because I needed to verify my other point on
this bug report: why does objdump path matter for non-annotate commands?
Before this patch I can analyze 32-bit ppc files on x86 (an important
use case on my end). After the objdump patch it fails -- or rather, I
have to add the --objdump argument which is awkward. I don't want to
have to educate users to add a non-sensical argument to perf-report (and
other specialized commands).
David
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-02 3:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-01 21:09 why is perf-report asking for objdump path? David Ahern
2012-11-02 1:11 ` Namhyung Kim
2012-11-02 3:37 ` David Ahern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).