LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2 1/2] perf env: Normalize aarch64.* and arm64.* to arm64 in normalize_arch()
@ 2021-07-26 12:38 Li Huafei
2021-07-26 12:38 ` [PATCH 2/2] perf annotate: Add error log in symbol__annotate() Li Huafei
2021-07-26 15:18 ` [PATCH v2 1/2] perf env: Normalize aarch64.* and arm64.* to arm64 in normalize_arch() James Clark
0 siblings, 2 replies; 5+ messages in thread
From: Li Huafei @ 2021-07-26 12:38 UTC (permalink / raw)
To: acme, james.clark, jolsa
Cc: peterz, mark.rutland, mingo, alexander.shishkin, namhyung,
mliska, irogers, dzhu, rickyman7, yao.jin, linux-perf-users,
linux-kernel, zhangjinhao2
On my aarch64 big endian machine, the perf annotate does not work.
# perf annotate
Percent | Source code & Disassembly of [kernel.kallsyms] for cycles (253 samples, percent: local period)
--------------------------------------------------------------------------------------------------------------
Percent | Source code & Disassembly of [kernel.kallsyms] for cycles (1 samples, percent: local period)
------------------------------------------------------------------------------------------------------------
Percent | Source code & Disassembly of [kernel.kallsyms] for cycles (47 samples, percent: local period)
-------------------------------------------------------------------------------------------------------------
...
This is because the arch_find() function uses the normalized architecture
name provided by normalize_arch(), and my machine's architecture name
aarch64_be is not normalized to arm64. Like other architectures such as
arm and powerpc, we can fuzzy match the architecture names associated with
aarch64.* and normalize them.
It seems that there is also arm64_be architecture name, which we also
normalize to arm64.
Signed-off-by: Li Huafei <lihuafei1@huawei.com>
---
Changes in v2:
- The error log added in symbol__annotate() is put into a single patch
- Remove the "Fixes" tag
- According to James' suggestion, "arm64_be" is also normalized to
"arm64"
tools/perf/util/env.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
index cec2e6cad8aa..ab341050be46 100644
--- a/tools/perf/util/env.c
+++ b/tools/perf/util/env.c
@@ -349,7 +349,7 @@ static const char *normalize_arch(char *arch)
return "x86";
if (!strcmp(arch, "sun4u") || !strncmp(arch, "sparc", 5))
return "sparc";
- if (!strcmp(arch, "aarch64") || !strcmp(arch, "arm64"))
+ if (!strncmp(arch, "aarch64", 7) || !strncmp(arch, "arm64", 5))
return "arm64";
if (!strncmp(arch, "arm", 3) || !strcmp(arch, "sa110"))
return "arm";
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] perf annotate: Add error log in symbol__annotate()
2021-07-26 12:38 [PATCH v2 1/2] perf env: Normalize aarch64.* and arm64.* to arm64 in normalize_arch() Li Huafei
@ 2021-07-26 12:38 ` Li Huafei
2021-07-26 15:19 ` James Clark
2021-07-26 15:18 ` [PATCH v2 1/2] perf env: Normalize aarch64.* and arm64.* to arm64 in normalize_arch() James Clark
1 sibling, 1 reply; 5+ messages in thread
From: Li Huafei @ 2021-07-26 12:38 UTC (permalink / raw)
To: acme, james.clark, jolsa
Cc: peterz, mark.rutland, mingo, alexander.shishkin, namhyung,
mliska, irogers, dzhu, rickyman7, yao.jin, linux-perf-users,
linux-kernel, zhangjinhao2
When users use the perf annotate feature on unsupported machines, error
logs should be printed for user feedback.
Signed-off-by: Li Huafei <lihuafei1@huawei.com>
---
tools/perf/util/annotate.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index aa04a3655236..cb280de3369f 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -2192,8 +2192,10 @@ int symbol__annotate(struct map_symbol *ms, struct evsel *evsel,
return errno;
args.arch = arch = arch__find(arch_name);
- if (arch == NULL)
+ if (arch == NULL) {
+ pr_err("%s: unsupported arch %s\n", __func__, arch_name);
return ENOTSUP;
+ }
if (parch)
*parch = arch;
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] perf env: Normalize aarch64.* and arm64.* to arm64 in normalize_arch()
2021-07-26 12:38 [PATCH v2 1/2] perf env: Normalize aarch64.* and arm64.* to arm64 in normalize_arch() Li Huafei
2021-07-26 12:38 ` [PATCH 2/2] perf annotate: Add error log in symbol__annotate() Li Huafei
@ 2021-07-26 15:18 ` James Clark
1 sibling, 0 replies; 5+ messages in thread
From: James Clark @ 2021-07-26 15:18 UTC (permalink / raw)
To: Li Huafei, acme, jolsa
Cc: peterz, mark.rutland, mingo, alexander.shishkin, namhyung,
mliska, irogers, dzhu, rickyman7, yao.jin, linux-perf-users,
linux-kernel, zhangjinhao2
On 26/07/2021 13:38, Li Huafei wrote:
> On my aarch64 big endian machine, the perf annotate does not work.
>
> # perf annotate
> Percent | Source code & Disassembly of [kernel.kallsyms] for cycles (253 samples, percent: local period)
> --------------------------------------------------------------------------------------------------------------
> Percent | Source code & Disassembly of [kernel.kallsyms] for cycles (1 samples, percent: local period)
> ------------------------------------------------------------------------------------------------------------
> Percent | Source code & Disassembly of [kernel.kallsyms] for cycles (47 samples, percent: local period)
> -------------------------------------------------------------------------------------------------------------
> ...
>
> This is because the arch_find() function uses the normalized architecture
> name provided by normalize_arch(), and my machine's architecture name
> aarch64_be is not normalized to arm64. Like other architectures such as
> arm and powerpc, we can fuzzy match the architecture names associated with
> aarch64.* and normalize them.
>
> It seems that there is also arm64_be architecture name, which we also
> normalize to arm64.
>
> Signed-off-by: Li Huafei <lihuafei1@huawei.com>
> ---
> Changes in v2:
> - The error log added in symbol__annotate() is put into a single patch
> - Remove the "Fixes" tag
> - According to James' suggestion, "arm64_be" is also normalized to
> "arm64"
>
> tools/perf/util/env.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c
> index cec2e6cad8aa..ab341050be46 100644
> --- a/tools/perf/util/env.c
> +++ b/tools/perf/util/env.c
> @@ -349,7 +349,7 @@ static const char *normalize_arch(char *arch)
> return "x86";
> if (!strcmp(arch, "sun4u") || !strncmp(arch, "sparc", 5))
> return "sparc";
> - if (!strcmp(arch, "aarch64") || !strcmp(arch, "arm64"))
> + if (!strncmp(arch, "aarch64", 7) || !strncmp(arch, "arm64", 5))
> return "arm64";
> if (!strncmp(arch, "arm", 3) || !strcmp(arch, "sa110"))
> return "arm";
>
Reviewed-by: James Clark <james.clark@arm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] perf annotate: Add error log in symbol__annotate()
2021-07-26 12:38 ` [PATCH 2/2] perf annotate: Add error log in symbol__annotate() Li Huafei
@ 2021-07-26 15:19 ` James Clark
2021-07-27 15:55 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 5+ messages in thread
From: James Clark @ 2021-07-26 15:19 UTC (permalink / raw)
To: Li Huafei, acme, jolsa
Cc: peterz, mark.rutland, mingo, alexander.shishkin, namhyung,
mliska, irogers, dzhu, rickyman7, yao.jin, linux-perf-users,
linux-kernel, zhangjinhao2
On 26/07/2021 13:38, Li Huafei wrote:
> When users use the perf annotate feature on unsupported machines, error
> logs should be printed for user feedback.
>
> Signed-off-by: Li Huafei <lihuafei1@huawei.com>
> ---
> tools/perf/util/annotate.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> index aa04a3655236..cb280de3369f 100644
> --- a/tools/perf/util/annotate.c
> +++ b/tools/perf/util/annotate.c
> @@ -2192,8 +2192,10 @@ int symbol__annotate(struct map_symbol *ms, struct evsel *evsel,
> return errno;
>
> args.arch = arch = arch__find(arch_name);
> - if (arch == NULL)
> + if (arch == NULL) {
> + pr_err("%s: unsupported arch %s\n", __func__, arch_name);
> return ENOTSUP;
> + }
>
> if (parch)
> *parch = arch;
>
This one is missing the v2 in the summary so it doesn't work with tools like b4,
but I applied it manually and it works.
Reviewed-by: James Clark <james.clark@arm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] perf annotate: Add error log in symbol__annotate()
2021-07-26 15:19 ` James Clark
@ 2021-07-27 15:55 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-07-27 15:55 UTC (permalink / raw)
To: James Clark
Cc: Li Huafei, jolsa, peterz, mark.rutland, mingo,
alexander.shishkin, namhyung, mliska, irogers, dzhu, rickyman7,
yao.jin, linux-perf-users, linux-kernel, zhangjinhao2
Em Mon, Jul 26, 2021 at 04:19:26PM +0100, James Clark escreveu:
>
>
> On 26/07/2021 13:38, Li Huafei wrote:
> > When users use the perf annotate feature on unsupported machines, error
> > logs should be printed for user feedback.
> >
> > Signed-off-by: Li Huafei <lihuafei1@huawei.com>
> > ---
> > tools/perf/util/annotate.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> > index aa04a3655236..cb280de3369f 100644
> > --- a/tools/perf/util/annotate.c
> > +++ b/tools/perf/util/annotate.c
> > @@ -2192,8 +2192,10 @@ int symbol__annotate(struct map_symbol *ms, struct evsel *evsel,
> > return errno;
> >
> > args.arch = arch = arch__find(arch_name);
> > - if (arch == NULL)
> > + if (arch == NULL) {
> > + pr_err("%s: unsupported arch %s\n", __func__, arch_name);
> > return ENOTSUP;
> > + }
> >
> > if (parch)
> > *parch = arch;
> >
>
> This one is missing the v2 in the summary so it doesn't work with tools like b4,
> but I applied it manually and it works.
>
> Reviewed-by: James Clark <james.clark@arm.com>
Thanks, applied.
- Arnaldo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-07-27 15:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-26 12:38 [PATCH v2 1/2] perf env: Normalize aarch64.* and arm64.* to arm64 in normalize_arch() Li Huafei
2021-07-26 12:38 ` [PATCH 2/2] perf annotate: Add error log in symbol__annotate() Li Huafei
2021-07-26 15:19 ` James Clark
2021-07-27 15:55 ` Arnaldo Carvalho de Melo
2021-07-26 15:18 ` [PATCH v2 1/2] perf env: Normalize aarch64.* and arm64.* to arm64 in normalize_arch() James Clark
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).