From: Wang ShaoBo <bobo.shaobowang(a)huawei.com>
commit d3edc138bc98fdd654ac057b68291570130daa2e openEuler-1.0
hulk inclusion
category: bugfix
bugzilla: 34588
CVE: NA
-----------------------------------------------
In many cases writing resctrl interface may return failure, but
err tips in info/last_cmd_status remain ok.
e.g.
echo 'L3:5=7fff' > schemata
-bash: echo: write error: Invalid argument
cat info/last_cmd_status
ok
cat ctrlmon
1
echo 1 > ctrlmon
-bash: echo: write
error: No such file or directory
cat info/last_cmd_status
ok
We add extra tips when goes to this branches.
Signed-off-by: Wang ShaoBo <bobo.shaobowang(a)huawei.com>
Reviewed-by: Xie XiuQi <xiexiuqi(a)huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
Signed-off-by: Xin Hao <haoxing990(a)gmail.com>
---
arch/arm64/kernel/mpam.c | 7 ++++++-
arch/arm64/kernel/mpam_ctrlmon.c | 4 ++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/mpam.c b/arch/arm64/kernel/mpam.c
index dc6dd566fc37..30900c08f0ef 100644
--- a/arch/arm64/kernel/mpam.c
+++ b/arch/arm64/kernel/mpam.c
@@ -863,7 +863,7 @@ static int resctrl_num_mon_show(struct kernfs_open_file *of,
int cpus_mon_write(struct rdtgroup *rdtgrp, cpumask_var_t newmask,
cpumask_var_t tmpmask)
{
- pr_info("unsupported on mon_groups, please use ctrlmon groups\n");
+ rdt_last_cmd_puts("temporarily unsupported write cpus on mon_groups\n");
return -EINVAL;
}
@@ -1148,6 +1148,7 @@ static ssize_t resctrl_group_ctrlmon_write(struct kernfs_open_file
*of,
if (!rdtgrp) {
ret = -ENOENT;
+ rdt_last_cmd_puts("directory was removed\n");
goto unlock;
}
@@ -1161,6 +1162,10 @@ static ssize_t resctrl_group_ctrlmon_write(struct kernfs_open_file
*of,
if (!ret)
rdtgrp->flags |= RDT_CTRLMON;
} else {
+ if (ctrlmon)
+ rdt_last_cmd_printf("ctrlmon has been enabled\n");
+ else
+ rdt_last_cmd_printf("ctrlmon has been disabled\n");
ret = -ENOENT;
}
diff --git a/arch/arm64/kernel/mpam_ctrlmon.c b/arch/arm64/kernel/mpam_ctrlmon.c
index 90f34987e5b8..b62ab076bf30 100644
--- a/arch/arm64/kernel/mpam_ctrlmon.c
+++ b/arch/arm64/kernel/mpam_ctrlmon.c
@@ -175,6 +175,9 @@ static int parse_line(char *line, struct resctrl_resource *r)
goto next;
}
}
+
+ rdt_last_cmd_printf("unknown domain (%lu)\n", dom_id);
+
return -EINVAL;
}
@@ -228,6 +231,7 @@ ssize_t resctrl_group_schemata_write(struct kernfs_open_file *of,
rdtgrp = resctrl_group_kn_lock_live(of->kn);
if (!rdtgrp) {
resctrl_group_kn_unlock(of->kn);
+ rdt_last_cmd_puts("directory was removed\n");
return -ENOENT;
}
rdt_last_cmd_clear();
--
2.31.0