From: Wang ShaoBo bobo.shaobowang@huawei.com
hulk inclusion category: feature bugzilla: 34278 CVE: NA
-------------------------------------------------
rmid is used to mark each resctrl group for monitoring, anyhow, also following corresponding resctrl group's configuration, we export rmid sysfile to resctrl sysfs for any usage elsewhere such as SMMU io, user can get rmid from a resctrl group and set this rmid to a target io through SMMU driver if SMMU MPAM implemented, so make related io devices can be monitored or accomplish aimed configuration for resource's usage.
Signed-off-by: Wang ShaoBo bobo.shaobowang@huawei.com Reviewed-by: Xiongfeng Wang wangxiongfeng2@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com Signed-off-by: Cheng Jian cj.chengjian@huawei.com --- arch/arm64/kernel/mpam/mpam_resctrl.c | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
diff --git a/arch/arm64/kernel/mpam/mpam_resctrl.c b/arch/arm64/kernel/mpam/mpam_resctrl.c index ea99c711a296..004be508459e 100644 --- a/arch/arm64/kernel/mpam/mpam_resctrl.c +++ b/arch/arm64/kernel/mpam/mpam_resctrl.c @@ -1733,6 +1733,29 @@ static int resctrl_group_tasks_show(struct kernfs_open_file *of, return ret; }
+static int resctrl_group_rmid_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + int ret = 0; + struct rdtgroup *rdtgrp; + u32 flag, times; + + hw_alloc_times_validate(times, flag); + + rdtgrp = resctrl_group_kn_lock_live(of->kn); + if (rdtgrp) { + if (flag) + seq_printf(s, "%u-%u\n", rdtgrp->mon.rmid, + rdtgrp->mon.rmid + 1); + else + seq_printf(s, "%u\n", rdtgrp->mon.rmid); + } else + ret = -ENOENT; + resctrl_group_kn_unlock(of->kn); + + return ret; +} + /* rdtgroup information files for one cache resource. */ static struct rftype res_specific_files[] = { { @@ -1830,6 +1853,13 @@ static struct rftype res_specific_files[] = { .seq_show = resctrl_group_tasks_show, .fflags = RFTYPE_BASE, }, + { + .name = "rmid", + .mode = 0444, + .kf_ops = &resctrl_group_kf_single_ops, + .seq_show = resctrl_group_rmid_show, + .fflags = RFTYPE_BASE, + }, { .name = "schemata", .mode = 0644,