[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240117141405.3063506-6-amitsinght@marvell.com>
Date: Wed, 17 Jan 2024 19:43:56 +0530
From: Amit Singh Tomar <amitsinght@...vell.com>
To: <linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>
CC: <fenghua.yu@...el.com>, <reinette.chatre@...el.com>, <james.morse@....com>,
<gcherian@...vell.com>, <robh@...nel.org>, <peternewman@...gle.com>,
<dfustini@...libre.com>, <jonathan.cameron@...wei.com>,
Amit Singh Tomar <amitsinght@...vell.com>
Subject: [PATCH v1 05/14] fs/resctrl: fetch configuration based on control type
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@...vell.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(-)
diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
index 0d10107eab62..b34e86cfc111 100644
--- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
+++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
@@ -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);
diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/mpam_resctrl.c
index 02efec42bbe2..4c44d65e6047 100644
--- a/drivers/platform/mpam/mpam_resctrl.c
+++ b/drivers/platform/mpam/mpam_resctrl.c
@@ -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;
diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c
index 27d8bc25a4cb..451cbb7357fb 100644
--- a/fs/resctrl/ctrlmondata.c
+++ b/fs/resctrl/ctrlmondata.c
@@ -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;
}
diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
index 885b0ca177b0..6c0804273753 100644
--- a/fs/resctrl/monitor.c
+++ b/fs/resctrl/monitor.c
@@ -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.
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index d57eb2c7afa7..92d9bee210eb 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -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;
diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
index 93b3e3b21d5d..2c0dc01d070e 100644
--- a/include/linux/resctrl.h
+++ b/include/linux/resctrl.h
@@ -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);
--
2.25.1
Powered by blists - more mailing lists