]> xenbits.xensource.com Git - people/larsk/xen.git/commitdiff
xen/sched: reject switching smt on/off with core scheduling active
authorJuergen Gross <jgross@suse.com>
Wed, 2 Oct 2019 07:27:36 +0000 (09:27 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 4 Oct 2019 10:59:45 +0000 (12:59 +0200)
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>
Acked-by: Dario Faggioli <dfaggioli@suse.com>
xen/arch/x86/sysctl.c
xen/common/schedule.c
xen/include/xen/sched.h

index 3742ede61bdf3593b3660b6051a99a57350e105f..4a76f0f47fa2ba0b4accf5bfcd084aac362b71d7 100644 (file)
@@ -209,6 +209,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);
index ab9b573a92ca8a2abc355cfaf0ed73c9fd0fcc1a..3fa2f21a342edc7970778d7d8a1be68818675de6 100644 (file)
@@ -63,6 +63,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. */
index f97303668abeaea32797816838d7559a2e9168dc..aa8257edc9986d6911ed917fda8f564cb5e2cc93 100644 (file)
@@ -1037,6 +1037,7 @@ static inline bool is_iommu_enabled(const struct domain *d)
 }
 
 extern bool sched_smt_power_savings;
+extern bool sched_disable_smt_switching;
 
 extern enum cpufreq_controller {
     FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen