lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:   Thu, 16 Mar 2023 21:32:32 +0800
From:   Junhao He <hejunhao3@...wei.com>
To:     <linux-perf-users@...r.kernel.org>, <acme@...nel.org>
CC:     <linux-kernel@...r.kernel.org>, <mathieu.poirier@...aro.org>,
        <mike.leach@...aro.org>, <john.g.garry@...cle.com>,
        <will@...nel.org>, <peterz@...radead.org>, <mingo@...hat.com>,
        <mark.rutland@....com>, <alexander.shishkin@...ux.intel.com>,
        <jolsa@...nel.org>, <namhyung@...nel.org>, <irogers@...gle.com>,
        <coresight@...ts.linaro.org>,
        <linux-arm-kernel@...ts.infradead.org>, <linuxarm@...wei.com>,
        <prime.zeng@...ilicon.com>, <hejunhao3@...wei.com>
Subject: [RESEND PATCH] perf cs-etm: add error logging to cs_etm_is_etmv4()

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@...alhost:/# perf record -e /cs_etm/@...ra_smb0/ -C 3 uname -a
  cs_etm: can't read file cpu3/trcidr/trcidr0
  root@...alhost:/#

Signed-off-by: Junhao He <hejunhao3@...wei.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ