Skip to content

Commit 8205a07

Browse files
Vikas ShivappaKAGA-KOKO
authored andcommitted
x86/intel_rdt/mba_sc: Add schemata support
Currently when user updates the "schemata" with new MBA percentage values, kernel writes the corresponding bandwidth percentage values to the IA32_MBA_THRTL_MSR. When MBA is expressed in MBps, the schemata format is changed to have the per package memory bandwidth in MBps instead of being specified in percentage. Do not write the IA32_MBA_THRTL_MSRs when the schemata is updated as that is handled separately. Signed-off-by: Vikas Shivappa <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent 1bd2a63 commit 8205a07

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

arch/x86/kernel/cpu/intel_rdt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ struct rdt_resource rdt_resources_all[] = {
179179
.msr_update = mba_wrmsr,
180180
.cache_level = 3,
181181
.parse_ctrlval = parse_bw,
182-
.format_str = "%d=%*d",
182+
.format_str = "%d=%*u",
183183
.fflags = RFTYPE_RES_MB,
184184
},
185185
};

arch/x86/kernel/cpu/intel_rdt_ctrlmondata.c

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ static bool bw_validate(char *buf, unsigned long *data, struct rdt_resource *r)
5353
return false;
5454
}
5555

56-
if (bw < r->membw.min_bw || bw > r->default_ctrl) {
56+
if ((bw < r->membw.min_bw || bw > r->default_ctrl) &&
57+
!is_mba_sc(r)) {
5758
rdt_last_cmd_printf("MB value %ld out of range [%d,%d]\n", bw,
5859
r->membw.min_bw, r->default_ctrl);
5960
return false;
@@ -179,6 +180,8 @@ static int update_domains(struct rdt_resource *r, int closid)
179180
struct msr_param msr_param;
180181
cpumask_var_t cpu_mask;
181182
struct rdt_domain *d;
183+
bool mba_sc;
184+
u32 *dc;
182185
int cpu;
183186

184187
if (!zalloc_cpumask_var(&cpu_mask, GFP_KERNEL))
@@ -188,13 +191,20 @@ static int update_domains(struct rdt_resource *r, int closid)
188191
msr_param.high = msr_param.low + 1;
189192
msr_param.res = r;
190193

194+
mba_sc = is_mba_sc(r);
191195
list_for_each_entry(d, &r->domains, list) {
192-
if (d->have_new_ctrl && d->new_ctrl != d->ctrl_val[closid]) {
196+
dc = !mba_sc ? d->ctrl_val : d->mbps_val;
197+
if (d->have_new_ctrl && d->new_ctrl != dc[closid]) {
193198
cpumask_set_cpu(cpumask_any(&d->cpu_mask), cpu_mask);
194-
d->ctrl_val[closid] = d->new_ctrl;
199+
dc[closid] = d->new_ctrl;
195200
}
196201
}
197-
if (cpumask_empty(cpu_mask))
202+
203+
/*
204+
* Avoid writing the control msr with control values when
205+
* MBA software controller is enabled
206+
*/
207+
if (cpumask_empty(cpu_mask) || mba_sc)
198208
goto done;
199209
cpu = get_cpu();
200210
/* Update CBM on this cpu if it's in cpu_mask. */
@@ -282,13 +292,17 @@ static void show_doms(struct seq_file *s, struct rdt_resource *r, int closid)
282292
{
283293
struct rdt_domain *dom;
284294
bool sep = false;
295+
u32 ctrl_val;
285296

286297
seq_printf(s, "%*s:", max_name_width, r->name);
287298
list_for_each_entry(dom, &r->domains, list) {
288299
if (sep)
289300
seq_puts(s, ";");
301+
302+
ctrl_val = (!is_mba_sc(r) ? dom->ctrl_val[closid] :
303+
dom->mbps_val[closid]);
290304
seq_printf(s, r->format_str, dom->id, max_data_width,
291-
dom->ctrl_val[closid]);
305+
ctrl_val);
292306
sep = true;
293307
}
294308
seq_puts(s, "\n");

0 commit comments

Comments
 (0)