From: Xie XiuQi <xiexiuqi(a)huawei.com>
hulk inclusion
category: feature
bugzilla: 5510
CVE: NA
Signed-off-by: Xie XiuQi <xiexiuqi(a)huawei.com>
Reviewed-by: Hanjun Guo <guohanjun(a)huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang(a)huawei.com>
Signed-off-by: Xin Hao <haoxing990(a)gmail.com>
---
arch/arm64/include/asm/mpam.h | 10 ++++++++++
arch/arm64/kernel/mpam_ctrlmon.c | 31 ++++++++++++++++---------------
arch/arm64/kernel/mpam_mon.c | 4 +---
3 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/arch/arm64/include/asm/mpam.h b/arch/arm64/include/asm/mpam.h
index 4bb583b6a053..8dc8f24e879b 100644
--- a/arch/arm64/include/asm/mpam.h
+++ b/arch/arm64/include/asm/mpam.h
@@ -332,4 +332,14 @@ struct raw_resctrl_resource {
int parse_cbm(char *buf, struct raw_resctrl_resource *r, struct rdt_domain *d);
+union mon_data_bits {
+ void *priv;
+ struct {
+ u8 rid;
+ u8 domid;
+ u8 partid;
+ u8 pmg;
+ } u;
+};
+
#endif /* _ASM_ARM64_MPAM_H */
diff --git a/arch/arm64/kernel/mpam_ctrlmon.c b/arch/arm64/kernel/mpam_ctrlmon.c
index 8d93da01d5b5..db3d4b8dfbc5 100644
--- a/arch/arm64/kernel/mpam_ctrlmon.c
+++ b/arch/arm64/kernel/mpam_ctrlmon.c
@@ -306,7 +306,7 @@ int resctrl_group_mondata_show(struct seq_file *m, void *arg)
{
struct kernfs_open_file *of = m->private;
struct rdtgroup *rdtgrp;
- struct rdt_domain *d;
+ union mon_data_bits md;
int ret = 0;
char *resname = get_resource_name(kernfs_node_name(of));
@@ -315,19 +315,13 @@ int resctrl_group_mondata_show(struct seq_file *m, void *arg)
rdtgrp = resctrl_group_kn_lock_live(of->kn);
- d = of->kn->priv;
-
- if (rdtgrp)
- /* for debug */
- seq_printf(m, "resource: %s, group: partid: %d, pmg: %d\n",
- resname, rdtgrp->closid, rdtgrp->mon.rmid);
- else
- seq_printf(m, "resource: %s: need partid and pmg here\n",
- resname);
-
- if (d)
- seq_printf(m, "domain: id %d: cpu_list %s, base %016llx\n",
- d->id, d->cpus_list, (u64)d->base);
+ md.priv = of->kn->priv;
+ pr_info("%s: resname %s, rid %d, domid %d, partid %d, pmg %d\n",
+ __func__, resname,
+ md.u.rid,
+ md.u.domid,
+ md.u.partid,
+ md.u.pmg);
/* show monitor data */
@@ -383,14 +377,21 @@ static int mkdir_mondata_subdir(struct kernfs_node *parent_kn,
struct resctrl_resource *r, struct resctrl_group *prgrp)
{
#if 1
+ union mon_data_bits md;
struct kernfs_node *kn;
char name[32];
int ret = 0;
+
+ md.u.rid = r->rid;
+ md.u.domid = d->id;
+ md.u.partid = prgrp->closid;
+ md.u.pmg = prgrp->mon.rmid;
+
sprintf(name, "mon_%s_%02d", r->name, d->id);
kn = __kernfs_create_file(parent_kn, name, 0444,
GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, 0,
- &kf_mondata_ops, d, NULL, NULL);
+ &kf_mondata_ops, md.priv, NULL, NULL);
if (IS_ERR(kn))
return PTR_ERR(kn);
diff --git a/arch/arm64/kernel/mpam_mon.c b/arch/arm64/kernel/mpam_mon.c
index 503d97da82ad..38fe89268eca 100644
--- a/arch/arm64/kernel/mpam_mon.c
+++ b/arch/arm64/kernel/mpam_mon.c
@@ -51,10 +51,8 @@ int alloc_pmg(void)
{
u32 pmg = ffs(pmg_free_map);
- if (pmg == 0) {
- pr_info("%s: no pmg available\n");
+ if (pmg == 0)
return -ENOSPC;
- }
pmg--;
pmg_free_map &= ~(1 << pmg);
--
2.31.0