[PATCH v1 09/14] fs/resctrl: set configuration based on Control type
Amit Singh Tomar
amitsinght at marvell.com
Wed Jan 17 06:14:00 PST 2024
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 set the control
configuration based on different control types.
Signed-off-by: Amit Singh Tomar <amitsinght at marvell.com>
---
Changes since RFC:
* No change, it's new patch.
---
arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 6 ++++--
drivers/platform/mpam/mpam_resctrl.c | 9 ++++++---
fs/resctrl/ctrlmondata.c | 3 ++-
fs/resctrl/monitor.c | 3 ++-
fs/resctrl/rdtgroup.c | 3 ++-
include/linux/resctrl.h | 6 ++++--
6 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
index b34e86cfc111..4423d8979b5e 100644
--- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
+++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
@@ -39,7 +39,8 @@ static bool apply_config(struct rdt_hw_domain *hw_dom,
}
int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d,
- u32 closid, enum resctrl_conf_type t, u32 cfg_val)
+ u32 closid, enum resctrl_conf_type t, u32 cfg_val,
+ enum resctrl_ctrl_type type)
{
struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r);
struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d);
@@ -59,7 +60,8 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d,
return 0;
}
-int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid)
+int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid,
+ enum resctrl_ctrl_type type)
{
struct resctrl_staged_config *cfg;
struct rdt_hw_domain *hw_dom;
diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/mpam_resctrl.c
index 0de09e9deee5..7a797f9bcaed 100644
--- a/drivers/platform/mpam/mpam_resctrl.c
+++ b/drivers/platform/mpam/mpam_resctrl.c
@@ -920,7 +920,8 @@ u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
}
int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d,
- u32 closid, enum resctrl_conf_type t, u32 cfg_val)
+ u32 closid, enum resctrl_conf_type t, u32 cfg_val,
+ enum resctrl_ctrl_type type)
{
int err;
u32 partid;
@@ -983,7 +984,8 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d,
}
/* TODO: this is IPI heavy */
-int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid)
+int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid,
+ enum resctrl_ctrl_type type)
{
int err = 0;
struct rdt_domain *d;
@@ -1000,7 +1002,8 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid)
continue;
err = resctrl_arch_update_one(r, d, closid, t,
- cfg->new_ctrl);
+ cfg->new_ctrl,
+ type);
if (err)
return err;
}
diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c
index f1f57bbfa094..005a91192847 100644
--- a/fs/resctrl/ctrlmondata.c
+++ b/fs/resctrl/ctrlmondata.c
@@ -405,7 +405,8 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of,
continue;
if (!strcmp(resname, s->name)) {
- ret = resctrl_arch_update_domains(r, rdtgrp->closid);
+ ret = resctrl_arch_update_domains(r, rdtgrp->closid,
+ s->ctrl_type);
if (ret)
goto out;
}
diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
index 6c0804273753..5eccb38cb7d7 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -514,7 +514,8 @@ static void update_mba_bw(struct rdtgroup *rgrp, struct rdt_domain *dom_mbm)
return;
}
- resctrl_arch_update_one(r_mba, dom_mba, closid, CDP_NONE, new_msr_val);
+ resctrl_arch_update_one(r_mba, dom_mba, closid, CDP_NONE, new_msr_val,
+ SCHEMA_BASIC);
/*
* Delta values are updated dynamically package wise for each
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 92d9bee210eb..d71fac0ae4d4 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -3136,7 +3136,8 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp)
return ret;
}
- ret = resctrl_arch_update_domains(r, rdtgrp->closid);
+ ret = resctrl_arch_update_domains(r, rdtgrp->closid,
+ s->ctrl_type);
if (ret < 0) {
rdt_last_cmd_puts("Failed to initialize allocations\n");
return ret;
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index 2c0dc01d070e..f28d4ff737dc 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -334,7 +334,8 @@ int resctrl_rdtgroup_show(struct seq_file *seq, u32 closid, u32 rmid);
u32 resctrl_arch_get_num_closid(struct rdt_resource *r);
struct rdt_domain *resctrl_arch_find_domain(struct rdt_resource *r, int id);
-int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid);
+int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid,
+ enum resctrl_ctrl_type type);
/* For use by arch code that needs to remap resctrl's smaller CDP closid */
static inline u32 resctrl_get_config_index(u32 closid,
@@ -374,7 +375,8 @@ resctrl_get_domain_from_cpu(int cpu, struct rdt_resource *r)
* Must be called on one of the domain's CPUs.
*/
int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d,
- u32 closid, enum resctrl_conf_type t, u32 cfg_val);
+ u32 closid, enum resctrl_conf_type t, u32 cfg_val,
+ enum resctrl_ctrl_type ctrl_type);
u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d,
u32 closid, enum resctrl_conf_type type,
--
2.25.1
More information about the linux-arm-kernel
mailing list