Skip to content

Commit 9fe0450

Browse files
James Morsesuryasaimadhu
authored andcommitted
x86/resctrl: Preserve CDP enable over CPU hotplug
Resctrl assumes that all CPUs are online when the filesystem is mounted, and that CPUs remember their CDP-enabled state over CPU hotplug. This goes wrong when resctrl's CDP-enabled state changes while all the CPUs in a domain are offline. When a domain comes online, enable (or disable!) CDP to match resctrl's current setting. Fixes: 5ff193f ("x86/intel_rdt: Add basic resctrl filesystem support") Suggested-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Borislav Petkov <bp@suse.de> Cc: <stable@vger.kernel.org> Link: https://lkml.kernel.org/r/20200221162105.154163-1-james.morse@arm.com
1 parent b0151da commit 9fe0450

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

‎arch/x86/kernel/cpu/resctrl/core.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,8 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r)
578578
d->id = id;
579579
cpumask_set_cpu(cpu, &d->cpu_mask);
580580

581+
rdt_domain_reconfigure_cdp(r);
582+
581583
if (r->alloc_capable && domain_setup_ctrlval(r, d)) {
582584
kfree(d);
583585
return;

‎arch/x86/kernel/cpu/resctrl/internal.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,5 +601,6 @@ bool has_busy_rmid(struct rdt_resource *r, struct rdt_domain *d);
601601
void __check_limbo(struct rdt_domain *d, bool force_free);
602602
bool cbm_validate_intel(char *buf, u32 *data, struct rdt_resource *r);
603603
bool cbm_validate_amd(char *buf, u32 *data, struct rdt_resource *r);
604+
void rdt_domain_reconfigure_cdp(struct rdt_resource *r);
604605

605606
#endif /* _ASM_X86_RESCTRL_INTERNAL_H */

‎arch/x86/kernel/cpu/resctrl/rdtgroup.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,6 +1859,19 @@ static int set_cache_qos_cfg(int level, bool enable)
18591859
return 0;
18601860
}
18611861

1862+
/* Restore the qos cfg state when a domain comes online */
1863+
void rdt_domain_reconfigure_cdp(struct rdt_resource *r)
1864+
{
1865+
if (!r->alloc_capable)
1866+
return;
1867+
1868+
if (r == &rdt_resources_all[RDT_RESOURCE_L2DATA])
1869+
l2_qos_cfg_update(&r->alloc_enabled);
1870+
1871+
if (r == &rdt_resources_all[RDT_RESOURCE_L3DATA])
1872+
l3_qos_cfg_update(&r->alloc_enabled);
1873+
}
1874+
18621875
/*
18631876
* Enable or disable the MBA software controller
18641877
* which helps user specify bandwidth in MBps.

0 commit comments

Comments
 (0)