Skip to content

Commit ca8dad2

Browse files
babumogerbp3tk0v
authored andcommitted
x86/resctrl: Display CLOSID for resource group
In x86, hardware uses CLOSID to identify a control group. When a user creates a control group this information is not visible to the user. It can help resctrl debugging. Add CLOSID(ctrl_hw_id) to the control groups display in the resctrl interface. Users can see this detail when resctrl is mounted with the "-o debug" option. Other architectures do not use "CLOSID". Use the names ctrl_hw_id to refer to "CLOSID" in an effort to keep the naming generic. For example: $cat /sys/fs/resctrl/ctrl_grp1/ctrl_hw_id 1 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 cb07d71 commit ca8dad2

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

Documentation/arch/x86/resctrl.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,10 @@ When control is enabled all CTRL_MON groups will also contain:
359359
file. On successful pseudo-locked region creation the mode will
360360
automatically change to "pseudo-locked".
361361

362+
"ctrl_hw_id":
363+
Available only with debug option. The identifier used by hardware
364+
for the control group. On x86 this is the CLOSID.
365+
362366
When monitoring is enabled all MON groups will also contain:
363367

364368
"mon_data":

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,22 @@ static int rdtgroup_tasks_show(struct kernfs_open_file *of,
779779
return ret;
780780
}
781781

782+
static int rdtgroup_closid_show(struct kernfs_open_file *of,
783+
struct seq_file *s, void *v)
784+
{
785+
struct rdtgroup *rdtgrp;
786+
int ret = 0;
787+
788+
rdtgrp = rdtgroup_kn_lock_live(of->kn);
789+
if (rdtgrp)
790+
seq_printf(s, "%u\n", rdtgrp->closid);
791+
else
792+
ret = -ENOENT;
793+
rdtgroup_kn_unlock(of->kn);
794+
795+
return ret;
796+
}
797+
782798
#ifdef CONFIG_PROC_CPU_RESCTRL
783799

784800
/*
@@ -1881,6 +1897,13 @@ static struct rftype res_common_files[] = {
18811897
.seq_show = rdt_has_sparse_bitmasks_show,
18821898
.fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE,
18831899
},
1900+
{
1901+
.name = "ctrl_hw_id",
1902+
.mode = 0444,
1903+
.kf_ops = &rdtgroup_kf_single_ops,
1904+
.seq_show = rdtgroup_closid_show,
1905+
.fflags = RFTYPE_CTRL_BASE | RFTYPE_DEBUG,
1906+
},
18841907

18851908
};
18861909

0 commit comments

Comments
 (0)