linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junhao He <hejunhao3@huawei.com>
To: <linux-perf-users@vger.kernel.org>, <acme@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <mathieu.poirier@linaro.org>,
	<mike.leach@linaro.org>, <john.g.garry@oracle.com>,
	<will@kernel.org>, <peterz@infradead.org>, <mingo@redhat.com>,
	<mark.rutland@arm.com>, <alexander.shishkin@linux.intel.com>,
	<jolsa@kernel.org>, <namhyung@kernel.org>, <irogers@google.com>,
	<coresight@lists.linaro.org>,
	<linux-arm-kernel@lists.infradead.org>, <linuxarm@huawei.com>,
	<prime.zeng@hisilicon.com>, <hejunhao3@huawei.com>
Subject: [RESEND PATCH] perf cs-etm: add error logging to cs_etm_is_etmv4()
Date: Thu, 16 Mar 2023 21:32:32 +0800	[thread overview]
Message-ID: <20230316133232.42209-1-hejunhao3@huawei.com> (raw)

On the HiSilicon platform, there is one ETM per logic core.
When setting up SMT, not every process has an ETM. So the path
".../cs_etm/cpux/trcidr/trcidr0" does not exist, the function
perf_pmu__scan_file() return an error. However, the command
'perf record' will returns silently and don't print.

After this patch, log a error when read fails that makes it easy
for users to debug.

  root@localhost:/# perf record -e /cs_etm/@ultra_smb0/ -C 3 uname -a
  cs_etm: can't read file cpu3/trcidr/trcidr0
  root@localhost:/#

Signed-off-by: Junhao He <hejunhao3@huawei.com>
---
 tools/perf/arch/arm/util/cs-etm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c
index 7f71c8a237ff..19ea17430399 100644
--- a/tools/perf/arch/arm/util/cs-etm.c
+++ b/tools/perf/arch/arm/util/cs-etm.c
@@ -585,7 +585,6 @@ cs_etm_info_priv_size(struct auxtrace_record *itr __maybe_unused,
 
 static bool cs_etm_is_etmv4(struct auxtrace_record *itr, int cpu)
 {
-	bool ret = false;
 	char path[PATH_MAX];
 	int scan;
 	unsigned int val;
@@ -600,9 +599,10 @@ static bool cs_etm_is_etmv4(struct auxtrace_record *itr, int cpu)
 
 	/* The file was read successfully, we have a winner */
 	if (scan == 1)
-		ret = true;
+		return true;
 
-	return ret;
+	pr_err("%s: can't read file %s\n", CORESIGHT_ETM_PMU_NAME, path);
+	return false;
 }
 
 static int cs_etm_get_ro(struct perf_pmu *pmu, int cpu, const char *path)
-- 
2.33.0


                 reply	other threads:[~2023-03-16 13:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230316133232.42209-1-hejunhao3@huawei.com \
    --to=hejunhao3@huawei.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=coresight@lists.linaro.org \
    --cc=irogers@google.com \
    --cc=john.g.garry@oracle.com \
    --cc=jolsa@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.poirier@linaro.org \
    --cc=mike.leach@linaro.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=prime.zeng@hisilicon.com \
    --cc=will@kernel.org \
    /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).