Skip to contentSkip to conversation

xen/sched: fix onlining cpu with core scheduling active

PATCH In review Juergen Gross 2 participants 3 messages Mar 10, 2020 – Mar 24, 2020

v2 of 3 In review Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xen/sched: fix onlining cpu with core scheduling active

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.

---
V2:
- modify condition form >= to == (Jan Beulich)

---
 xen/common/sched/cpupool.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/common/sched/cpupool.c +2 -1
index 9f70c7ec17..d40345b585 100644
@@ -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);
Signature · 7 lines
2.16.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

Ping?

Quoted 30 lines · Juergen Gross

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.

---
V2:
- modify condition form >= to == (Jan Beulich)

---
  xen/common/sched/cpupool.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
xen/common/sched/cpupool.c +2 -1
index 9f70c7ec17..d40345b585 100644
@@ -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);
Reviewed-by on v2 1/1
#2 lore raw
In reply to Juergen Gross
Quoted 10 lines · Juergen Gross

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.

Regards

Signature · 6 lines
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)