提交 eef6c034 编写于 作者: J Junhao He 提交者: Ma Wupeng

perf cs-etm: add error logging to cs_etm_is_etmv4()

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I79882
CVE: NA

----------------------------------------------------------------------

When setting up SMT, not every process has an ETM, so the path
".../cs_etm/cpux/trcidr/trcidr0" does not exist, and the function
perf_pmu__scan_file() will return an error.
Log a error when read fails.
Signed-off-by: NJunhao He <hejunhao3@huawei.com>
上级 3561c168
......@@ -558,7 +558,7 @@ 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;
bool ret = true;
char path[PATH_MAX];
int scan;
unsigned int val;
......@@ -570,10 +570,11 @@ static bool cs_etm_is_etmv4(struct auxtrace_record *itr, int cpu)
snprintf(path, PATH_MAX, "cpu%d/%s",
cpu, metadata_etmv4_ro[CS_ETMV4_TRCIDR0]);
scan = perf_pmu__scan_file(cs_etm_pmu, path, "%x", &val);
/* The file was read successfully, we have a winner */
if (scan == 1)
ret = true;
if (scan != 1) {
pr_err("%s: can't read file %s\n",
CORESIGHT_ETM_PMU_NAME, path);
ret = false;
}
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册