[v13,10/10] x86/resctrl: Display RMID of resource group
Commit Message
In x86, hardware uses RMID to identify a monitoring group. When a user
creates a monitor group these details are not visible. These details
can help resctrl debugging.
Add RMID(mon_hw_id) to the monitor groups display in resctrl interface.
Users can see these details when resctrl is mounted with "-o debug" option.
Add RFTYPE_MON_BASE that complements existing RFTYPE_CTRL_BASE and
represents files belonging to monitoring groups.
Other architectures do not use "RMID". Use the name mon_hw_id to refer
to "RMID" in an effort to keep the naming generic.
For example:
$cat /sys/fs/resctrl/mon_groups/mon_grp1/mon_hw_id
3
Signed-off-by: Babu Moger <babu.moger@amd.com>
Tested-by: Peter Newman <peternewman@google.com>
Reviewed-by: Peter Newman <peternewman@google.com>
Tested-by: Tan Shaopeng <tan.shaopeng@jp.fujitsu.com>
Reviewed-by: Tan Shaopeng <tan.shaopeng@jp.fujitsu.com>
Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
v13: Minor commit message update. (Reinette).
v12: Moved the comments from arch/x86/kernel/cpu/resctrl/internal.h
to Documentation/arch/x86/resctrl.rst. (Boris)
Moved RFTYPE_MON_BASE definition here where it is being used. (Boris)
---
Documentation/arch/x86/resctrl.rst | 12 ++++++++++++
arch/x86/kernel/cpu/resctrl/internal.h | 1 +
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 23 +++++++++++++++++++++++
3 files changed, 36 insertions(+)
Comments
Hi Babu,
On 10/13/2023 1:26 PM, Babu Moger wrote:
> @@ -440,6 +444,14 @@ RESCTRL filesystem has two main components
> -> RFTYPE_CTRL (Files for CTRL group)
> Files: mode, schemata, size
>
> + -> RFTYPE_MON (Files for MON group)
> +
> + -> RFTYPE_DEBUG (Files to help resctrl debugging)
> + File: mon_hw_id
> +
> + -> RFTYPE_CTRL (Files for CTRL group)
> + Files: mode, schemata, size
> +
> -> RFTYPE_DEBUG (Files to help resctrl debugging)
> File: ctrl_hw_id
>
Something went wrong during creation of this patch. Notice that the
"RFTYPE_CTRL" at the top is duplicated in the new changes and that
the "RFTYPE_MON" changes were inserted in the wrong place.
Reinette
Hi Reinette,
On 10/13/2023 4:24 PM, Reinette Chatre wrote:
> Hi Babu,
>
> On 10/13/2023 1:26 PM, Babu Moger wrote:
>
>> @@ -440,6 +444,14 @@ RESCTRL filesystem has two main components
>> -> RFTYPE_CTRL (Files for CTRL group)
>> Files: mode, schemata, size
>>
>> + -> RFTYPE_MON (Files for MON group)
>> +
>> + -> RFTYPE_DEBUG (Files to help resctrl debugging)
>> + File: mon_hw_id
>> +
>> + -> RFTYPE_CTRL (Files for CTRL group)
>> + Files: mode, schemata, size
>> +
>> -> RFTYPE_DEBUG (Files to help resctrl debugging)
>> File: ctrl_hw_id
>>
> Something went wrong during creation of this patch. Notice that the
> "RFTYPE_CTRL" at the top is duplicated in the new changes and that
> the "RFTYPE_MON" changes were inserted in the wrong place.
Yes. Thanks for pointing that out.
Will check.
Thanks
Babu
@@ -376,6 +376,10 @@ When monitoring is enabled all MON groups will also contain:
the sum for all tasks in the CTRL_MON group and all tasks in
MON groups. Please see example section for more details on usage.
+"mon_hw_id":
+ Available only with debug option. The identifier used by hardware
+ for the monitor group. On x86 this is the RMID.
+
RESCTRL filesystem implementation notes
=======================================
RESCTRL filesystem has two main components
@@ -440,6 +444,14 @@ RESCTRL filesystem has two main components
-> RFTYPE_CTRL (Files for CTRL group)
Files: mode, schemata, size
+ -> RFTYPE_MON (Files for MON group)
+
+ -> RFTYPE_DEBUG (Files to help resctrl debugging)
+ File: mon_hw_id
+
+ -> RFTYPE_CTRL (Files for CTRL group)
+ Files: mode, schemata, size
+
-> RFTYPE_DEBUG (Files to help resctrl debugging)
File: ctrl_hw_id
@@ -254,6 +254,7 @@ struct rdtgroup {
#define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON)
#define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP)
#define RFTYPE_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL)
+#define RFTYPE_MON_BASE (RFTYPE_BASE | RFTYPE_MON)
/* List of all resource groups */
extern struct list_head rdt_all_groups;
@@ -795,6 +795,22 @@ static int rdtgroup_closid_show(struct kernfs_open_file *of,
return ret;
}
+static int rdtgroup_rmid_show(struct kernfs_open_file *of,
+ struct seq_file *s, void *v)
+{
+ struct rdtgroup *rdtgrp;
+ int ret = 0;
+
+ rdtgrp = rdtgroup_kn_lock_live(of->kn);
+ if (rdtgrp)
+ seq_printf(s, "%u\n", rdtgrp->mon.rmid);
+ else
+ ret = -ENOENT;
+ rdtgroup_kn_unlock(of->kn);
+
+ return ret;
+}
+
#ifdef CONFIG_PROC_CPU_RESCTRL
/*
@@ -1867,6 +1883,13 @@ static struct rftype res_common_files[] = {
.seq_show = rdtgroup_tasks_show,
.fflags = RFTYPE_BASE,
},
+ {
+ .name = "mon_hw_id",
+ .mode = 0444,
+ .kf_ops = &rdtgroup_kf_single_ops,
+ .seq_show = rdtgroup_rmid_show,
+ .fflags = RFTYPE_MON_BASE | RFTYPE_DEBUG,
+ },
{
.name = "schemata",
.mode = 0644,