Re: [PATCH v2 13/23] x86/resctrl: Allow update_mba_bw() to update controls directly

From: Reinette Chatre
Date: Fri Oct 15 2021 - 18:28:36 EST


Hi James,

On 10/1/2021 9:02 AM, James Morse wrote:

...

diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
index 9f45207a6c74..25baacd331e0 100644
--- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
+++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c
@@ -282,6 +282,27 @@ static bool apply_config(struct rdt_hw_domain *hw_dom,
return false;
}
+int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d,
+ u32 closid, enum resctrl_conf_type t, u32 cfg_val)
+{
+ struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d);
+ u32 idx = get_config_index(closid, t);
+ struct msr_param msr_param;
+
+ if (!cpumask_test_cpu(smp_processor_id(), &d->cpu_mask))
+ return -EINVAL;
+
+ hw_dom->ctrl_val[idx] = cfg_val;
+
+ msr_param.res = r;
+ msr_param.low = idx;
+ msr_param.high = idx + 1;
+
+ rdt_ctrl_update(&msr_param);
+

rdt_ctrl_update() will take its parameters and recompute the domain that is already available here ... seems to take a few steps back and then do the needed. Could msr_update be called directly here instead?

Reinette