x86/xen: disable nosmt in Xen guests
Subsystems (2)
Juergen Gross
maintainerPATCH 1/1 x86/xen: disable nosmt in Xen guests
When running as a Xen guest selecting "nosmt" either via command line or implicitly via default settings makes no sense, as the guest has no clue about the real system topology it is running on. With Xen it is the hypervisor's job to ensure the proper bug mitigations are active regarding smt settings.
So when running as a Xen guest set cpu_smt_control to "not supported" in order to avoid disabling random vcpus.
--- arch/x86/xen/enlighten.c | 8 ++++++++ arch/x86/xen/enlighten_hvm.c | 2 ++ arch/x86/xen/enlighten_pv.c | 2 ++ arch/x86/xen/xen-ops.h | 2 ++ 4 files changed, 14 insertions(+)
arch/x86/xen/enlighten.c +8 -0
@@ -345,3 +345,11 @@ void xen_arch_unregister_cpu(int num) }EXPORT_SYMBOL (xen_arch_unregister_cpu);#endif + +void __init xen_disable_nosmt (void ) +{ +#ifdef CONFIG_HOTPLUG_SMT +/* Don't allow SMT disabling in Xen guests. */ + cpu_smt_control =CPU_SMT_NOT_SUPPORTED ; +#endif +}
arch/x86/xen/enlighten_hvm.c +2 -0
@@ -116,6 +116,8 @@ static void __init init_hvm_pv_info(void)this_cpu_write (xen_vcpu_id, ebx); elsethis_cpu_write (xen_vcpu_id ,smp_processor_id ()); + +xen_disable_nosmt (); }#ifdef CONFIG_KEXEC_CORE
arch/x86/xen/enlighten_pv.c +2 -0
@@ -131,6 +131,8 @@ static void __init xen_pv_init_platform(void)/* pvclock is in shared info area */ xen_init_time_ops (); + +xen_disable_nosmt (); }static void __init xen_pv_guest_late_init (void )
arch/x86/xen/xen-ops.h +2 -0
@@ -161,4 +161,6 @@ void xen_hvm_post_suspend(int suspend_cancelled);static inline void xen_hvm_post_suspend (int suspend_cancelled) {}#endif +void __init xen_disable_nosmt (void ); +#endif /* XEN_OPS_H */
Signature · 1 line
2.16.4
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 12.06.19 at 12:12, <[email protected]> wrote:
When running as a Xen guest selecting "nosmt" either via command line or implicitly via default settings makes no sense, as the guest has no clue about the real system topology it is running on. With Xen it is the hypervisor's job to ensure the proper bug mitigations are active regarding smt settings.
I don't agree with the second sentence: It is in principle fine for the hypervisor to expose HT (i.e. not disable it as bug mitigation), and leave it to the guest kernels to protect themselves. We're just not at the point yet where Xen offers sufficient / reliable data to guest kernels to do so, so _for the time being_ what you say is correct.
Jan
Juergen Gross
maintainerQuoted 7 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 12.06.19 at 12:12, <[email protected]> wrote:
When running as a Xen guest selecting "nosmt" either via command line or implicitly via default settings makes no sense, as the guest has no clue about the real system topology it is running on. With Xen it is the hypervisor's job to ensure the proper bug mitigations are active regarding smt settings.
Quoted 5 lines
I don't agree with the second sentence: It is in principle fine for the hypervisor to expose HT (i.e. not disable it as bug mitigation), and leave it to the guest kernels to protect themselves. We're just not at the point yet where Xen offers sufficient / reliable data to guest kernels to do so, so
_forthe timebeing_what you say is correct.
Okay, I'll add something like:
This is true as long Xen doesn't support core scheduling together with exposing the (then) correct sibling information to the guest and indicating that case via a sutable interface.
Juergen
Quoted 8 lines · Juergen Gross
When running as a Xen guest selecting "nosmt" either via command line or implicitly via default settings makes no sense, as the guest has no clue about the real system topology it is running on. With Xen it is the hypervisor's job to ensure the proper bug mitigations are active regarding smt settings.
So when running as a Xen guest set
cpu_smt_controlto "not supported" in order to avoid disabling random vcpus.
If it doesn't make sense; then the topology should not expose SMT threads and the knob will not have any effect.
If you expose SMT topology info to the guest, then you get what you ask for.
Juergen Gross
maintainerQuoted 7 lines · Peter Zijlstra
Quoted 6 lines · Juergen Gross
When running as a Xen guest selecting "nosmt" either via command line or implicitly via default settings makes no sense, as the guest has no clue about the real system topology it is running on. With Xen it is the hypervisor's job to ensure the proper bug mitigations are active regarding smt settings.
Quoted 5 lines
Quoted 2 lines
So when running as a Xen guest set
cpu_smt_controlto "not supported" in order to avoid disabling random vcpus.If it doesn't make sense; then the topology should not expose SMT threads and the knob will not have any effect.
Yes, that's the theory.
I agree completely, but this is ongoing work which will need some more time. It probably would have been ready for some time now, but some recent processor bugs required a shift in priorities what to do first.
In order to run a new kernel on existing Xen we need that patch to avoid disabling random cpus.
Juergen