@@ -69,7 +69,7 @@ struct rdt_hw_resource rdt_resources_all[] = {
.domains = domain_init(RDT_RESOURCE_L3),
.parse_ctrlval = parse_cbm,
.format_str = "%d=%0*x",
- .fflags = RFTYPE_RES_CACHE,
+ .fflags = RFTYPE_CACHE,
},
.msr_base = MSR_IA32_L3_CBM_BASE,
.msr_update = cat_wrmsr,
@@ -83,7 +83,7 @@ struct rdt_hw_resource rdt_resources_all[] = {
.domains = domain_init(RDT_RESOURCE_L2),
.parse_ctrlval = parse_cbm,
.format_str = "%d=%0*x",
- .fflags = RFTYPE_RES_CACHE,
+ .fflags = RFTYPE_CACHE,
},
.msr_base = MSR_IA32_L2_CBM_BASE,
.msr_update = cat_wrmsr,
@@ -97,7 +97,7 @@ struct rdt_hw_resource rdt_resources_all[] = {
.domains = domain_init(RDT_RESOURCE_MBA),
.parse_ctrlval = parse_bw,
.format_str = "%d=%*u",
- .fflags = RFTYPE_RES_MB,
+ .fflags = RFTYPE_MB,
},
},
[RDT_RESOURCE_SMBA] =
@@ -109,7 +109,7 @@ struct rdt_hw_resource rdt_resources_all[] = {
.domains = domain_init(RDT_RESOURCE_SMBA),
.parse_ctrlval = parse_bw,
.format_str = "%d=%*u",
- .fflags = RFTYPE_RES_MB,
+ .fflags = RFTYPE_MB,
},
},
};
@@ -240,18 +240,64 @@ struct rdtgroup {
/*
* Define the file type flags for base and info directories.
+ *
+ * RESCTRL filesystem has two main components
+ * a. info
+ * b. base.
+ *
+ * /sys/fs/resctrl/
+ * |
+ * --> info (Displays information about control and monitoring)
+ * |
+ * --> base (Displays the details on resctrl groups)
+ *
+ * -------------------------------------------------------------
+ * info directory structure
+ * --> INFO
+ * --> TOP
+ * last_cmd_status
+ *
+ * --> MON
+ * --> (L2_MON)
+ * --> (L3_MON)
+ * max_threshold_occupancy, mbm_local_bytes_config,
+ * mbm_total_bytes_config, mon_features, num_rmids
+ *
+ * --> RES
+ * --> CACHE (L2, L3)
+ * bit_usage, cbm_mask, min_cbm_bits, num_closids,
+ * shareable_bits
+ *
+ * --> MB (MB, SMBA)
+ * bandwidth_gran, delay_linear, min_bandwidth,
+ * num_closids
+ *
+ * group structure
+ * -----------------------------------------------------------
+ * --> BASE (Files common for both MON and CTRL groups)
+ * cpus, cpus_list, tasks
+ *
+ * --> CTRL (Files only for CTRL group)
+ * mode, schemata, size
+ *
*/
#define RFTYPE_INFO BIT(0)
#define RFTYPE_BASE BIT(1)
-#define RFTYPE_CTRL BIT(4)
-#define RFTYPE_MON BIT(5)
-#define RFTYPE_TOP BIT(6)
-#define RFTYPE_RES_CACHE BIT(8)
-#define RFTYPE_RES_MB BIT(9)
-#define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL)
-#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_TOP BIT(2)
+#define RFTYPE_MON BIT(3)
+#define RFTYPE_RES BIT(4)
+
+#define RFTYPE_CACHE BIT(5)
+#define RFTYPE_MB BIT(6)
+
+#define RFTYPE_CTRL BIT(8)
+
+#define RFTYPE_INFO_TOP (RFTYPE_INFO | RFTYPE_TOP)
+#define RFTYPE_INFO_MON (RFTYPE_INFO | RFTYPE_MON)
+#define RFTYPE_INFO_RES (RFTYPE_INFO | RFTYPE_RES)
+
+#define RFTYPE_BASE_CTRL (RFTYPE_BASE | RFTYPE_CTRL)
/* List of all resource groups */
extern struct list_head rdt_all_groups;
@@ -1691,77 +1691,77 @@ static struct rftype res_common_files[] = {
.mode = 0444,
.kf_ops = &rdtgroup_kf_single_ops,
.seq_show = rdt_last_cmd_status_show,
- .fflags = RFTYPE_TOP_INFO,
+ .fflags = RFTYPE_INFO_TOP,
},
{
.name = "num_closids",
.mode = 0444,
.kf_ops = &rdtgroup_kf_single_ops,
.seq_show = rdt_num_closids_show,
- .fflags = RFTYPE_CTRL_INFO,
+ .fflags = RFTYPE_INFO_RES,
},
{
.name = "mon_features",
.mode = 0444,
.kf_ops = &rdtgroup_kf_single_ops,
.seq_show = rdt_mon_features_show,
- .fflags = RFTYPE_MON_INFO,
+ .fflags = RFTYPE_INFO_MON,
},
{
.name = "num_rmids",
.mode = 0444,
.kf_ops = &rdtgroup_kf_single_ops,
.seq_show = rdt_num_rmids_show,
- .fflags = RFTYPE_MON_INFO,
+ .fflags = RFTYPE_INFO_MON,
},
{
.name = "cbm_mask",
.mode = 0444,
.kf_ops = &rdtgroup_kf_single_ops,
.seq_show = rdt_default_ctrl_show,
- .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE,
+ .fflags = RFTYPE_INFO_RES | RFTYPE_CACHE,
},
{
.name = "min_cbm_bits",
.mode = 0444,
.kf_ops = &rdtgroup_kf_single_ops,
.seq_show = rdt_min_cbm_bits_show,
- .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE,
+ .fflags = RFTYPE_INFO_RES | RFTYPE_CACHE,
},
{
.name = "shareable_bits",
.mode = 0444,
.kf_ops = &rdtgroup_kf_single_ops,
.seq_show = rdt_shareable_bits_show,
- .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE,
+ .fflags = RFTYPE_INFO_RES | RFTYPE_CACHE,
},
{
.name = "bit_usage",
.mode = 0444,
.kf_ops = &rdtgroup_kf_single_ops,
.seq_show = rdt_bit_usage_show,
- .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE,
+ .fflags = RFTYPE_INFO_RES | RFTYPE_CACHE,
},
{
.name = "min_bandwidth",
.mode = 0444,
.kf_ops = &rdtgroup_kf_single_ops,
.seq_show = rdt_min_bw_show,
- .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB,
+ .fflags = RFTYPE_INFO_RES | RFTYPE_MB,
},
{
.name = "bandwidth_gran",
.mode = 0444,
.kf_ops = &rdtgroup_kf_single_ops,
.seq_show = rdt_bw_gran_show,
- .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB,
+ .fflags = RFTYPE_INFO_RES | RFTYPE_MB,
},
{
.name = "delay_linear",
.mode = 0444,
.kf_ops = &rdtgroup_kf_single_ops,
.seq_show = rdt_delay_linear_show,
- .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB,
+ .fflags = RFTYPE_INFO_RES | RFTYPE_MB,
},
/*
* Platform specific which (if any) capabilities are provided by
@@ -1780,7 +1780,7 @@ static struct rftype res_common_files[] = {
.kf_ops = &rdtgroup_kf_single_ops,
.write = max_threshold_occ_write,
.seq_show = max_threshold_occ_show,
- .fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE,
+ .fflags = RFTYPE_INFO_MON | RFTYPE_CACHE,
},
{
.name = "mbm_total_bytes_config",
@@ -1827,7 +1827,7 @@ static struct rftype res_common_files[] = {
.kf_ops = &rdtgroup_kf_single_ops,
.write = rdtgroup_schemata_write,
.seq_show = rdtgroup_schemata_show,
- .fflags = RFTYPE_CTRL_BASE,
+ .fflags = RFTYPE_BASE_CTRL,
},
{
.name = "mode",
@@ -1835,14 +1835,14 @@ static struct rftype res_common_files[] = {
.kf_ops = &rdtgroup_kf_single_ops,
.write = rdtgroup_mode_write,
.seq_show = rdtgroup_mode_show,
- .fflags = RFTYPE_CTRL_BASE,
+ .fflags = RFTYPE_BASE_CTRL,
},
{
.name = "size",
.mode = 0444,
.kf_ops = &rdtgroup_kf_single_ops,
.seq_show = rdtgroup_size_show,
- .fflags = RFTYPE_CTRL_BASE,
+ .fflags = RFTYPE_BASE_CTRL,
},
};
@@ -1899,7 +1899,7 @@ void __init thread_throttle_mode_init(void)
if (!rft)
return;
- rft->fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB;
+ rft->fflags = RFTYPE_INFO_RES | RFTYPE_MB;
}
void __init mbm_config_rftype_init(const char *config)
@@ -1908,7 +1908,7 @@ void __init mbm_config_rftype_init(const char *config)
rft = rdtgroup_get_rftype_by_name(config);
if (rft)
- rft->fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE;
+ rft->fflags = RFTYPE_INFO_MON | RFTYPE_CACHE;
}
/**
@@ -2043,21 +2043,21 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn)
if (IS_ERR(kn_info))
return PTR_ERR(kn_info);
- ret = rdtgroup_add_files(kn_info, RFTYPE_TOP_INFO);
+ ret = rdtgroup_add_files(kn_info, RFTYPE_INFO_TOP);
if (ret)
goto out_destroy;
/* loop over enabled controls, these are all alloc_capable */
list_for_each_entry(s, &resctrl_schema_all, list) {
r = s->res;
- fflags = r->fflags | RFTYPE_CTRL_INFO;
+ fflags = r->fflags | RFTYPE_INFO_RES;
ret = rdtgroup_mkdir_info_resdir(s, s->name, fflags);
if (ret)
goto out_destroy;
}
for_each_mon_capable_rdt_resource(r) {
- fflags = r->fflags | RFTYPE_MON_INFO;
+ fflags = r->fflags | RFTYPE_INFO_MON;
sprintf(name, "%s_MON", r->name);
ret = rdtgroup_mkdir_info_resdir(r, name, fflags);
if (ret)
@@ -3554,7 +3554,7 @@ static int __init rdtgroup_setup_root(void)
list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups);
- ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_CTRL_BASE);
+ ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_BASE_CTRL);
if (ret) {
kernfs_destroy_root(rdt_root);
goto out;