diff mbox series

[v2,40/48] xen/sched: reject switching smt on/off with core scheduling active

Message ID 20190809145833.1020-41-jgross@suse.com (mailing list archive)
State Superseded
Headers show
Series xen: add core scheduling support | expand

Commit Message

Jürgen Groß Aug. 9, 2019, 2:58 p.m. UTC
When core or socket scheduling are active enabling or disabling smt is
not possible as that would require a major host reconfiguration.

Add a bool sched_disable_smt_switching which will be set for core or
socket scheduling.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
V1:
- new patch
V2:
- EBUSY as return code (Jan Beulich, Dario Faggioli)
- __read_mostly for sched_disable_smt_switching (Jan Beulich)
---
 xen/arch/x86/sysctl.c   | 5 +++++
 xen/common/schedule.c   | 1 +
 xen/include/xen/sched.h | 1 +
 3 files changed, 7 insertions(+)

Comments

Jan Beulich Sept. 10, 2019, 3:47 p.m. UTC | #1
On 09.08.2019 16:58, Juergen Gross wrote:
> When core or socket scheduling are active enabling or disabling smt is
> not possible as that would require a major host reconfiguration.
> 
> Add a bool sched_disable_smt_switching which will be set for core or
> socket scheduling.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Acked-by: Jan Beulich <jbeulich@suse.com>
diff mbox series

Patch

diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index c50d910a1c..a4c4d868b6 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -204,6 +204,11 @@  long arch_do_sysctl(
                 ret = -EOPNOTSUPP;
                 break;
             }
+            if ( sched_disable_smt_switching )
+            {
+                ret = -EBUSY;
+                break;
+            }
             plug = op == XEN_SYSCTL_CPU_HOTPLUG_SMT_ENABLE;
             fn = smt_up_down_helper;
             hcpu = _p(plug);
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index afd4170730..b94fd2431a 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -57,6 +57,7 @@  integer_param("sched_ratelimit_us", sched_ratelimit_us);
 
 /* Number of vcpus per struct sched_unit. */
 static unsigned int __read_mostly sched_granularity = 1;
+bool __read_mostly sched_disable_smt_switching;
 const cpumask_t *sched_res_mask = &cpumask_all;
 
 /* Common lock for free cpus. */
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index e868646f0e..39355f5d67 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -1021,6 +1021,7 @@  static inline bool is_vcpu_online(const struct vcpu *v)
 }
 
 extern bool sched_smt_power_savings;
+extern bool sched_disable_smt_switching;
 
 extern enum cpufreq_controller {
     FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen