x86/resctrl: Preserve CDP enable over cpuhp
Subsystems (3)
James Morse
reviewerPATCH v3 1/1 x86/resctrl: Preserve CDP enable over cpuhp
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.
--- arch/x86/kernel/cpu/resctrl/core.c | 2 ++ arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 13 +++++++++++++ 3 files changed, 16 insertions(+)
arch/x86/kernel/cpu/resctrl/core.c +2 -0
@@ -578,6 +578,8 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r) d->id = id;cpumask_set_cpu (cpu, &d->cpu_mask); +rdt_domain_reconfigure_cdp (r); +if (r->alloc_capable &&domain_setup_ctrlval (r, d)) {kfree (d);return ;
arch/x86/kernel/cpu/resctrl/internal.h +1 -0
@@ -601,5 +601,6 @@ bool has_busy_rmid(struct rdt_resource *r, struct rdt_domain *d);void __check_limbo (struct rdt_domain *d,bool force_free);bool cbm_validate_intel (char *buf,u32 *data,struct rdt_resource *r);bool cbm_validate_amd (char *buf,u32 *data,struct rdt_resource *r); +void rdt_domain_reconfigure_cdp (struct rdt_resource *r);#endif /* _ASM_X86_RESCTRL_INTERNAL_H */
arch/x86/kernel/cpu/resctrl/rdtgroup.c +13 -0
@@ -1859,6 +1859,19 @@ static int set_cache_qos_cfg(int level, bool enable)return 0 ; } +/* Restore the qos cfg state when a domain comes online */ +void rdt_domain_reconfigure_cdp (struct rdt_resource *r) +{ +if (!r->alloc_capable) +return ; + +if (r == &rdt_resources_all[RDT_RESOURCE_L2DATA ]) +l2_qos_cfg_update (&r->alloc_enabled); + +if (r == &rdt_resources_all[RDT_RESOURCE_L3DATA ]) +l3_qos_cfg_update (&r->alloc_enabled); +} +/* * Enable or disable the MBA software controller * which helps user specify bandwidth in MBps.
Signature · 1 line
2.24.1
Hi James,
Quoted 58 lines · James Morse
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 5ff193fbde20 ("x86/intel_rdt: Add basic resctrl filesystem support")Suggested-by Reinette Chatre <[email protected]>Signed-off-by James Morse <[email protected]>--- arch/x86/kernel/cpu/resctrl/core.c | 2 ++ arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 13 +++++++++++++ 3 files changed, 16 insertions(+)arch/x86/kernel/cpu/resctrl/core.c +2
-0@@ -578,6 +578,8 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r) d->id = id;cpumask_set_cpu (cpu, &d->cpu_mask); +rdt_domain_reconfigure_cdp (r); +if (r->alloc_capable &&domain_setup_ctrlval (r, d)) {kfree (d);return ;arch/x86/kernel/cpu/resctrl/internal.h +1
-0@@ -601,5 +601,6 @@ bool has_busy_rmid(struct rdt_resource *r, struct rdt_domain *d);void __check_limbo (struct rdt_domain *d,bool force_free);bool cbm_validate_intel (char *buf,u32 *data,struct rdt_resource *r);bool cbm_validate_amd (char *buf,u32 *data,struct rdt_resource *r); +void rdt_domain_reconfigure_cdp (struct rdt_resource *r);#endif /* _ASM_X86_RESCTRL_INTERNAL_H */ arch/x86/kernel/cpu/resctrl/rdtgroup.c +6
-0@@ -1859,6 +1859,19 @@ static int set_cache_qos_cfg(int level, bool enable)return 0 ; } +/* Restore the qos cfg state when a domain comes online */ +void rdt_domain_reconfigure_cdp (struct rdt_resource *r) +{ +if (!r->alloc_capable) +return ; +
arch/x86/kernel/cpu/resctrl/rdtgroup.c static int set_cache_qos_cfg(int level, bool enable) · line 1877
Quoted 10 lines
arch/x86/kernel/cpu/resctrl/rdtgroup.c +7
-0+if (r == &rdt_resources_all[RDT_RESOURCE_L2DATA ]) +l2_qos_cfg_update (&r->alloc_enabled); + +if (r == &rdt_resources_all[RDT_RESOURCE_L3DATA ]) +l3_qos_cfg_update (&r->alloc_enabled); +} +/* * Enable or disable the MBA software controller * which helps user specify bandwidth in MBps.
As mentioned in my response to v2 the lockdep annotation that formed part of this fix is welcome. It is not clear to me if you will be submitting again with the annotation added back. Since it is not required for this fix I will add my tag here and you could include it if you do decide to resubmit.
Thank you
Reinette
Reinette Chatre
maintainerHi Thomas and Borislav,
Could you please consider this patch for inclusion as a fix for v5.7?
Thank you
Reinette
Quoted 84 lines · Reinette Chatre
Hi James,
Quoted 58 lines · James Morse
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 5ff193fbde20 ("x86/intel_rdt: Add basic resctrl filesystem support")Suggested-by Reinette Chatre <[email protected]>Signed-off-by James Morse <[email protected]>--- arch/x86/kernel/cpu/resctrl/core.c | 2 ++ arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 13 +++++++++++++ 3 files changed, 16 insertions(+)arch/x86/kernel/cpu/resctrl/core.c +2
-0@@ -578,6 +578,8 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r) d->id = id;cpumask_set_cpu (cpu, &d->cpu_mask); +rdt_domain_reconfigure_cdp (r); +if (r->alloc_capable &&domain_setup_ctrlval (r, d)) {kfree (d);return ;arch/x86/kernel/cpu/resctrl/internal.h +1
-0@@ -601,5 +601,6 @@ bool has_busy_rmid(struct rdt_resource *r, struct rdt_domain *d);void __check_limbo (struct rdt_domain *d,bool force_free);bool cbm_validate_intel (char *buf,u32 *data,struct rdt_resource *r);bool cbm_validate_amd (char *buf,u32 *data,struct rdt_resource *r); +void rdt_domain_reconfigure_cdp (struct rdt_resource *r);#endif /* _ASM_X86_RESCTRL_INTERNAL_H */ arch/x86/kernel/cpu/resctrl/rdtgroup.c +6
-0@@ -1859,6 +1859,19 @@ static int set_cache_qos_cfg(int level, bool enable)return 0 ; } +/* Restore the qos cfg state when a domain comes online */ +void rdt_domain_reconfigure_cdp (struct rdt_resource *r) +{ +if (!r->alloc_capable) +return ; +arch/x86/kernel/cpu/resctrl/rdtgroup.c static int set_cache_qos_cfg(int level, bool enable) · line 1877
Quoted 10 lines
arch/x86/kernel/cpu/resctrl/rdtgroup.c +7
-0+if (r == &rdt_resources_all[RDT_RESOURCE_L2DATA ]) +l2_qos_cfg_update (&r->alloc_enabled); + +if (r == &rdt_resources_all[RDT_RESOURCE_L3DATA ]) +l3_qos_cfg_update (&r->alloc_enabled); +} +/* * Enable or disable the MBA software controller * which helps user specify bandwidth in MBps. As mentioned in my response to v2 the lockdep annotation that formed part of this fix is welcome. It is not clear to me if you will be submitting again with the annotation added back. Since it is not required for this fix I will add my tag here and you could include it if you do decide to resubmit.
Thank you
Reviewed-by Reinette Chatre <[email protected]>Reinette
Borislav Petkov
maintainerQuoted 3 lines · Reinette Chatre
Hi Thomas and Borislav,
Could you please consider this patch for inclusion as a fix for v5.7?
Do you mean by that that I should add
so that it goes to stable?
The commit in Fixes: is from 4.10-ish times...
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteReinette Chatre
maintainerHi Borislav and James,
Quoted 5 lines · Borislav Petkov
Quoted 3 lines · Reinette Chatre
Hi Thomas and Borislav,
Could you please consider this patch for inclusion as a fix for v5.7?
Quoted 8 lines
Do you mean by that that I should add
Cc <[email protected]>so that it goes to stable?
The commit in Fixes: is from 4.10-ish times...
Borislav: Sorry about that and thank you very much for catching this omission. Yes, this patch needs to go to stable.
James: would you be able to do the backports to stable? Please note that support for L2 and L3 CDP was added across Linux versions and the resctrl files moved around since then so the backport would need some changes to address this issue in all versions.
Reinette
James Morse
reviewerHi guys,
Quoted 11 lines · Reinette Chatre
Quoted 10 lines · Borislav Petkov
Quoted 3 lines · Reinette Chatre
Hi Thomas and Borislav,
Could you please consider this patch for inclusion as a fix for v5.7?
Do you mean by that that I should add
Cc <[email protected]>so that it goes to stable?
Is the CC-stable still required? I've seen a 'Fixes' tag on its own cause patches to get picked up...
Quoted 10 lines
Quoted 2 lines
The commit in Fixes: is from 4.10-ish times...
Borislav: Sorry about that and thank you very much for catching this omission. Yes, this patch needs to go to stable.
James: would you be able to do the backports to stable? Please note that support for L2 and L3 CDP was added across Linux versions and the resctrl files moved around since then so the backport would need some changes to address this issue in all versions.
Yes, certainly!
Thanks,
James
Borislav Petkov
maintainerQuoted 2 lines · James Morse
Is the CC-stable still required? I've seen a 'Fixes' tag on its own cause patches to get picked up...
AFAIK that is the ultimate plan but it does not happen for every patch ATM. It will though, eventually. IOW, currently, if you want a patch in stable, make sure to Cc it. :)
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette[tip: x86/urgent] x86/resctrl: Preserve CDP enable over CPU hotplug
In reply to James MorseThe following commit has been merged into the x86/urgent branch of tip:
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: 9fe0450785abbc04b0ed5d3cf61fcdb8ab656b4b Gitweb: https://git.kernel.org/tip/9fe0450785abbc04b0ed5d3cf61fcdb8ab656b4b Author: James Morse <[email protected]> AuthorDate: Fri, 21 Feb 2020 16:21:05 Committer: Borislav Petkov <[email protected]> CommitterDate: Fri, 17 Apr 2020 19:35:01 +02:00
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.
--- arch/x86/kernel/cpu/resctrl/core.c | 2 ++ arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 13 +++++++++++++ 3 files changed, 16 insertions(+)
arch/x86/kernel/cpu/resctrl/core.c +2 -0
@@ -578,6 +578,8 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r) d->id = id;cpumask_set_cpu (cpu, &d->cpu_mask); +rdt_domain_reconfigure_cdp (r); +if (r->alloc_capable &&domain_setup_ctrlval (r, d)) {kfree (d);return ;
arch/x86/kernel/cpu/resctrl/internal.h +1 -0
@@ -601,5 +601,6 @@ bool has_busy_rmid(struct rdt_resource *r, struct rdt_domain *d);void __check_limbo (struct rdt_domain *d,bool force_free);bool cbm_validate_intel (char *buf,u32 *data,struct rdt_resource *r);bool cbm_validate_amd (char *buf,u32 *data,struct rdt_resource *r); +void rdt_domain_reconfigure_cdp (struct rdt_resource *r);#endif /* _ASM_X86_RESCTRL_INTERNAL_H */
arch/x86/kernel/cpu/resctrl/rdtgroup.c +13 -0
@@ -1859,6 +1859,19 @@ static int set_cache_qos_cfg(int level, bool enable)return 0 ; } +/* Restore the qos cfg state when a domain comes online */ +void rdt_domain_reconfigure_cdp (struct rdt_resource *r) +{ +if (!r->alloc_capable) +return ; + +if (r == &rdt_resources_all[RDT_RESOURCE_L2DATA ]) +l2_qos_cfg_update (&r->alloc_enabled); + +if (r == &rdt_resources_all[RDT_RESOURCE_L3DATA ]) +l3_qos_cfg_update (&r->alloc_enabled); +} +/* * Enable or disable the MBA software controller * which helps user specify bandwidth in MBps.
Sasha Levin
maintainerRe: [tip: x86/urgent] x86/resctrl: Preserve CDP enable over CPU hotplug
Hi
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag fixing commit: 5ff193fbde20 ("x86/intel_rdt: Add basic resctrl filesystem support").
The bot has tested the following trees: v5.6.5, v5.5.18, v5.4.33, v4.19.116, v4.14.176.
v5.6.5: Build OK!
v5.5.18: Build OK!
v5.4.33: Build OK!
v4.19.116: Failed to apply! Possible dependencies:
0f00717ecce4 ("x86/resctrl: Re-arrange the RDT init code")
1ad4fa41d99f ("x86/resctrl: Initialize the vendor-specific resource functions")
4d05bf71f157 ("x86/resctrl: Introduce AMD QOS feature")
a36c5ff560fb ("x86/resctrl: Bring cbm_validate() into the resource structure")
aa50453a448a ("x86/resctrl: Move all the macros to resctrl/internal.h")v4.14.176: Failed to apply! Possible dependencies:
0af6a48da481 ("x86/intel_rdt: Ensure RDT cleanup on exit")
0f00717ecce4 ("x86/resctrl: Re-arrange the RDT init code")
19c635ab24a1 ("x86/intel_rdt/mba_sc: Enable/disable MBA software controller") 1ad4fa41d99f ("x86/resctrl: Initialize the vendor-specific resource functions") 1bd2a63b4f0d ("x86/intel_rdt/mba_sc: Add initialization support")
2244645ab194 ("x86/intel_rdt: Fix a silent failure when writing zero value schemata") 472ef09b40c5 ("x86/intel_rdt: Associate mode with each RDT resource group") 49f7b4efa110 ("x86/intel_rdt: Enable setting of exclusive mode")
4d05bf71f157 ("x86/resctrl: Introduce AMD QOS feature")
753694a8df31 ("x86/intel_rdt: Fix data type in parsing callbacks")
7604df6e16ae ("x86/intel_rdt: Support flexible data to parsing callbacks") 8205a078ba78 ("x86/intel_rdt/mba_sc: Add schemata support")
99adde9b370d ("x86/intel_rdt: Enable L2 CDP in MSR IA32_L2_QOS_CFG") 9ab9aa15c309 ("x86/intel_rdt: Ensure requested schemata respects mode") 9af4c0a6dc1a ("x86/intel_rdt: Making CBM name and type more explicit") aa50453a448a ("x86/resctrl: Move all the macros to resctrl/internal.h") c377dcfbee80 ("x86/intel_rdt: Add diagnostics when writing the schemata file") d48d7a57f718 ("x86/intel_rdt: Introduce resource group's mode resctrl file") de73f38f7680 ("x86/intel_rdt/mba_sc: Feedback loop to dynamically update mem bandwidth") def10853930a ("x86/intel_rdt: Add two new resources for L2 Code and Data Prioritization (CDP)")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
Signature · 2 lines
Thanks Sasha