linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Li Huafei <lihuafei1@huawei.com>
To: <acme@kernel.org>, <james.clark@arm.com>, <jolsa@kernel.org>
Cc: <peterz@infradead.org>, <mark.rutland@arm.com>,
	<mingo@redhat.com>, <alexander.shishkin@linux.intel.com>,
	<namhyung@kernel.org>, <mliska@suse.cz>, <irogers@google.com>,
	<dzhu@wavecomp.com>, <rickyman7@gmail.com>,
	<yao.jin@linux.intel.com>, <linux-perf-users@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <zhangjinhao2@huawei.com>
Subject: [PATCH v2 1/2] perf env: Normalize aarch64.* and arm64.* to arm64 in normalize_arch()
Date: Mon, 26 Jul 2021 20:38:53 +0800	[thread overview]
Message-ID: <20210726123854.13463-1-lihuafei1@huawei.com> (raw)

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


             reply	other threads:[~2021-07-26 12:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-26 12:38 Li Huafei [this message]
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

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=20210726123854.13463-1-lihuafei1@huawei.com \
    --to=lihuafei1@huawei.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=dzhu@wavecomp.com \
    --cc=irogers@google.com \
    --cc=james.clark@arm.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=mliska@suse.cz \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rickyman7@gmail.com \
    --cc=yao.jin@linux.intel.com \
    --cc=zhangjinhao2@huawei.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;
as well as URLs for NNTP newsgroup(s).