Skip to content

Commit 4cee14b

Browse files
babumogerbp3tk0v
authored andcommitted
x86/resctrl: Display RMID of resource group
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 the 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 <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Peter Newman <[email protected]> Reviewed-by: Tan Shaopeng <[email protected]> Reviewed-by: Fenghua Yu <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Tested-by: Peter Newman <[email protected]> Tested-by: Tan Shaopeng <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 918f211 commit 4cee14b

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

Documentation/arch/x86/resctrl.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,10 @@ When monitoring is enabled all MON groups will also contain:
376376
the sum for all tasks in the CTRL_MON group and all tasks in
377377
MON groups. Please see example section for more details on usage.
378378

379+
"mon_hw_id":
380+
Available only with debug option. The identifier used by hardware
381+
for the monitor group. On x86 this is the RMID.
382+
379383
Resource allocation rules
380384
-------------------------
381385

arch/x86/kernel/cpu/resctrl/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ struct rdtgroup {
254254
#define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON)
255255
#define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP)
256256
#define RFTYPE_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL)
257+
#define RFTYPE_MON_BASE (RFTYPE_BASE | RFTYPE_MON)
257258

258259
/* List of all resource groups */
259260
extern struct list_head rdt_all_groups;

arch/x86/kernel/cpu/resctrl/rdtgroup.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,22 @@ static int rdtgroup_closid_show(struct kernfs_open_file *of,
795795
return ret;
796796
}
797797

798+
static int rdtgroup_rmid_show(struct kernfs_open_file *of,
799+
struct seq_file *s, void *v)
800+
{
801+
struct rdtgroup *rdtgrp;
802+
int ret = 0;
803+
804+
rdtgrp = rdtgroup_kn_lock_live(of->kn);
805+
if (rdtgrp)
806+
seq_printf(s, "%u\n", rdtgrp->mon.rmid);
807+
else
808+
ret = -ENOENT;
809+
rdtgroup_kn_unlock(of->kn);
810+
811+
return ret;
812+
}
813+
798814
#ifdef CONFIG_PROC_CPU_RESCTRL
799815

800816
/*
@@ -1867,6 +1883,13 @@ static struct rftype res_common_files[] = {
18671883
.seq_show = rdtgroup_tasks_show,
18681884
.fflags = RFTYPE_BASE,
18691885
},
1886+
{
1887+
.name = "mon_hw_id",
1888+
.mode = 0444,
1889+
.kf_ops = &rdtgroup_kf_single_ops,
1890+
.seq_show = rdtgroup_rmid_show,
1891+
.fflags = RFTYPE_MON_BASE | RFTYPE_DEBUG,
1892+
},
18701893
{
18711894
.name = "schemata",
18721895
.mode = 0644,

0 commit comments

Comments
 (0)