sched: fix onlining cpu with core scheduling active
authorJuergen Gross <jgross@suse.com>
Tue, 24 Mar 2020 16:36:44 +0000 (17:36 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 24 Mar 2020 16:36:44 +0000 (17:36 +0100)
When onlining a cpu cpupool_cpu_add() checks whether all siblings of
the new cpu are free in order to decide whether to add it to cpupool0.
In case the added cpu is not the last sibling to be onlined this test
is wrong as it only checks for all online siblings to be free. The
test should include the check for the number of siblings having
reached the scheduling granularity of cpupool0, too.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>
xen/common/sched/cpupool.c

index 9f70c7ec17f3ac91fcd14c1765691c587525af7f..d40345b5858caffd56da9614272f218c3a12dc23 100644 (file)
@@ -616,7 +616,8 @@ static int cpupool_cpu_add(unsigned int cpu)
     get_sched_res(cpu)->cpupool = NULL;
 
     cpus = sched_get_opt_cpumask(cpupool0->gran, cpu);
-    if ( cpumask_subset(cpus, &cpupool_free_cpus) )
+    if ( cpumask_subset(cpus, &cpupool_free_cpus) &&
+         cpumask_weight(cpus) == cpupool_get_granularity(cpupool0) )
         ret = cpupool_assign_cpu_locked(cpupool0, cpu);
 
     rcu_read_unlock(&sched_res_rculock);