Skip to content

Commit 918f211

Browse files
babumogerbp3tk0v
authored andcommitted
x86/resctrl: Add support for the files of MON groups only
Files unique to monitoring groups have the RFTYPE_MON flag. When a new monitoring group is created the resctrl files with flags RFTYPE_BASE (files common to all resource groups) and RFTYPE_MON (files unique to monitoring groups) are created to support interacting with the new monitoring group. A resource group can support both monitoring and control, also termed a CTRL_MON resource group. CTRL_MON groups should get both monitoring and control resctrl files but that is not the case. Only the RFTYPE_BASE and RFTYPE_CTRL files are created for CTRL_MON groups. Ensure that files with the RFTYPE_MON flag are created for CTRL_MON groups. 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: Ilpo Järvinen <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Tested-by: Peter Newman <[email protected]> Tested-by: Tan Shaopeng <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ca8dad2 commit 918f211

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2551,6 +2551,7 @@ static void schemata_list_destroy(void)
25512551
static int rdt_get_tree(struct fs_context *fc)
25522552
{
25532553
struct rdt_fs_context *ctx = rdt_fc2context(fc);
2554+
unsigned long flags = RFTYPE_CTRL_BASE;
25542555
struct rdt_domain *dom;
25552556
struct rdt_resource *r;
25562557
int ret;
@@ -2581,7 +2582,10 @@ static int rdt_get_tree(struct fs_context *fc)
25812582

25822583
closid_init();
25832584

2584-
ret = rdtgroup_add_files(rdtgroup_default.kn, RFTYPE_CTRL_BASE);
2585+
if (rdt_mon_capable)
2586+
flags |= RFTYPE_MON;
2587+
2588+
ret = rdtgroup_add_files(rdtgroup_default.kn, flags);
25852589
if (ret)
25862590
goto out_schemata_free;
25872591

@@ -3271,8 +3275,8 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
32713275
enum rdt_group_type rtype, struct rdtgroup **r)
32723276
{
32733277
struct rdtgroup *prdtgrp, *rdtgrp;
3278+
unsigned long files = 0;
32743279
struct kernfs_node *kn;
3275-
uint files = 0;
32763280
int ret;
32773281

32783282
prdtgrp = rdtgroup_kn_lock_live(parent_kn);
@@ -3324,10 +3328,13 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
33243328
goto out_destroy;
33253329
}
33263330

3327-
if (rtype == RDTCTRL_GROUP)
3331+
if (rtype == RDTCTRL_GROUP) {
33283332
files = RFTYPE_BASE | RFTYPE_CTRL;
3329-
else
3333+
if (rdt_mon_capable)
3334+
files |= RFTYPE_MON;
3335+
} else {
33303336
files = RFTYPE_BASE | RFTYPE_MON;
3337+
}
33313338

33323339
ret = rdtgroup_add_files(kn, files);
33333340
if (ret) {

0 commit comments

Comments
 (0)