@@ -116,7 +116,8 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid)
}
u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
- u32 closid, enum resctrl_conf_type type)
+ u32 closid, enum resctrl_conf_type type,
+ enum resctrl_conf_type ctrl_type)
{
struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d);
u32 idx = resctrl_get_config_index(closid, type);
@@ -848,7 +848,8 @@ void mpam_resctrl_exit(void)
}
u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
- u32 closid, enum resctrl_conf_type type)
+ u32 closid, enum resctrl_conf_type type,
+ enum resctrl_ctrl_type ctrl_type)
{
u32 partid;
struct mpam_config *cfg;
@@ -373,6 +373,7 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of,
static void show_doms(struct seq_file *s, struct resctrl_schema *schema, int closid)
{
+ enum resctrl_ctrl_type ctrl_type = schema->ctrl_type;
struct rdt_resource *r = schema->res;
struct rdt_domain *dom;
bool sep = false;
@@ -390,9 +391,10 @@ static void show_doms(struct seq_file *s, struct resctrl_schema *schema, int clo
ctrl_val = dom->mbps_val[closid];
else
ctrl_val = resctrl_arch_get_config(r, dom, closid,
- schema->conf_type);
+ schema->conf_type,
+ ctrl_type);
- seq_printf(s, r->format_str, dom->id, max_data_width,
+ seq_printf(s, r->format_str, dom->id, schema->max_data_width,
ctrl_val);
sep = true;
}
@@ -478,7 +478,8 @@ static void update_mba_bw(struct rdtgroup *rgrp, struct rdt_domain *dom_mbm)
delta_bw = pmbm_data->delta_bw;
/* MBA resource doesn't support CDP */
- cur_msr_val = resctrl_arch_get_config(r_mba, dom_mba, closid, CDP_NONE);
+ cur_msr_val = resctrl_arch_get_config(r_mba, dom_mba, closid, CDP_NONE,
+ SCHEMA_BASIC);
/*
* For Ctrl groups read data from child monitor groups.
@@ -1064,7 +1064,8 @@ static int rdt_bit_usage_show(struct kernfs_open_file *of,
if (!closid_allocated(i))
continue;
ctrl_val = resctrl_arch_get_config(r, dom, i,
- s->conf_type);
+ s->conf_type,
+ s->ctrl_type);
mode = rdtgroup_mode_by_closid(i);
switch (mode) {
case RDT_MODE_SHAREABLE:
@@ -1281,7 +1282,7 @@ static bool __rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d
/* Check for overlap with other resource groups */
for (i = 0; i < closids_supported(); i++) {
- ctrl_b = resctrl_arch_get_config(r, d, i, type);
+ ctrl_b = resctrl_arch_get_config(r, d, i, type, SCHEMA_BASIC);
mode = rdtgroup_mode_by_closid(i);
if (closid_allocated(i) && i != closid &&
mode != RDT_MODE_PSEUDO_LOCKSETUP) {
@@ -1365,7 +1366,8 @@ static bool rdtgroup_mode_test_exclusive(struct rdtgroup *rdtgrp)
has_cache = true;
list_for_each_entry(d, &r->domains, list) {
ctrl = resctrl_arch_get_config(r, d, closid,
- s->conf_type);
+ s->conf_type,
+ s->ctrl_type);
if (rdtgroup_cbm_overlaps(s, d, ctrl, closid, false)) {
rdt_last_cmd_puts("Schemata overlaps\n");
return false;
@@ -1499,6 +1501,7 @@ static int rdtgroup_size_show(struct kernfs_open_file *of,
struct seq_file *s, void *v)
{
struct resctrl_schema *schema;
+ enum resctrl_ctrl_type ctrl_type;
enum resctrl_conf_type type;
struct rdtgroup *rdtgrp;
struct rdt_resource *r;
@@ -1536,6 +1539,7 @@ static int rdtgroup_size_show(struct kernfs_open_file *of,
list_for_each_entry(schema, &resctrl_schema_all, list) {
r = schema->res;
type = schema->conf_type;
+ ctrl_type = schema->ctrl_type;
sep = false;
seq_printf(s, "%*s:", max_name_width, schema->name);
list_for_each_entry(d, &r->domains, list) {
@@ -1549,7 +1553,8 @@ static int rdtgroup_size_show(struct kernfs_open_file *of,
else
ctrl = resctrl_arch_get_config(r, d,
closid,
- type);
+ type,
+ ctrl_type);
if (r->rid == RDT_RESOURCE_MBA)
size = ctrl;
else
@@ -3013,11 +3018,13 @@ static int __init_one_rdt_domain(struct rdt_domain *d, struct resctrl_schema *s,
*/
if (resctrl_arch_get_cdp_enabled(r->rid))
peer_ctl = resctrl_arch_get_config(r, d, i,
- peer_type);
+ peer_type,
+ s->ctrl_type);
else
peer_ctl = 0;
ctrl_val = resctrl_arch_get_config(r, d, i,
- s->conf_type);
+ s->conf_type,
+ s->ctrl_type);
used_b |= ctrl_val | peer_ctl;
if (mode == RDT_MODE_SHAREABLE)
cfg->new_ctrl |= ctrl_val | peer_ctl;
@@ -377,7 +377,8 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d,
u32 closid, enum resctrl_conf_type t, u32 cfg_val);
u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
- u32 closid, enum resctrl_conf_type type);
+ u32 closid, enum resctrl_conf_type type,
+ enum resctrl_ctrl_type ctrl_type);
int resctrl_online_domain(struct rdt_resource *r, struct rdt_domain *d);
void resctrl_offline_domain(struct rdt_resource *r, struct rdt_domain *d);
int resctrl_online_cpu(unsigned int cpu);
Now that, we have support for different control types, divided into the BASIC and PRIORITY controls types. Schemata list is pertained to the SCHEMAT_BASIC control type that is used to set up/configure CAT (Cache Allocation Technology) and MBA (Memory Bandwidth Allocation) capabilities, and SCHEMAT_DSPRI used to configure downstream priority partitioning. Let's add boilerplate changes to fetch the control configuration based on different control types. Signed-off-by: Amit Singh Tomar <amitsinght@marvell.com> --- Changes since RFC: * No change, it's new patch. --- arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 3 ++- drivers/platform/mpam/mpam_resctrl.c | 3 ++- fs/resctrl/ctrlmondata.c | 6 ++++-- fs/resctrl/monitor.c | 3 ++- fs/resctrl/rdtgroup.c | 19 +++++++++++++------ include/linux/resctrl.h | 3 ++- 6 files changed, 25 insertions(+), 12 deletions(-)