All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen: postpone updating domains' node affinity when removing a CPU from a cpupool
@ 2015-03-09 16:49 Dario Faggioli
  2015-03-11 10:32 ` Dario Faggioli
  2015-03-11 15:01 ` George Dunlap
  0 siblings, 2 replies; 10+ messages in thread
From: Dario Faggioli @ 2015-03-09 16:49 UTC (permalink / raw)
  To: Xen-devel
  Cc: Juergen Gross, George Dunlap, Keir Fraser, Justin Weaver,
	Jan Beulich

93be8285 ("update domU's node-affinity on the cpupool_unassign_cpu()
path")  does the right thing, but does it too early. In fact, it
is necessary to call domain_update_node_affinity() when a pCPU is
removed from a cpupool, but that must happen after the pCPU is
really gone from there.

More specifically, it is important that the update happens not
before cpu_disable_scheduler() is called on that pCPU, to give
that function the chance to fixup the vCPU affinity of the
domains residing in the cpupool, if that is necessary.

Calling it earlier, as it happens before this change, causes
(although only in rather awkward circumstances), the following:

(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Assertion '!cpumask_empty(dom_cpumask)' failed at domain.c:460
(XEN) ****************************************

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Keir Fraser <keir.xen@gmail.com>
Cc: Juergen Gross <JGross@suse.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Cc: Justin Weaver <jtweaver@hawaii.edu>
---
 xen/common/cpupool.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/xen/common/cpupool.c b/xen/common/cpupool.c
index a758a8b..ad7bbb5 100644
--- a/xen/common/cpupool.c
+++ b/xen/common/cpupool.c
@@ -296,6 +296,8 @@ static int cpupool_assign_cpu_locked(struct cpupool *c, unsigned int cpu)
 static long cpupool_unassign_cpu_helper(void *info)
 {
     int cpu = cpupool_moving_cpu;
+    struct cpupool *c = info;
+    struct domain *d;
     long ret;
 
     cpupool_dprintk("cpupool_unassign_cpu(pool=%d,cpu=%d)\n",
@@ -318,6 +320,11 @@ static long cpupool_unassign_cpu_helper(void *info)
         cpupool_cpu_moving = NULL;
     }
 
+    rcu_read_lock(&domlist_read_lock);
+    for_each_domain_in_cpupool(d, c)
+        domain_update_node_affinity(d);
+    rcu_read_unlock(&domlist_read_lock);
+
 out:
     spin_unlock(&cpupool_lock);
     cpupool_dprintk("cpupool_unassign_cpu ret=%ld\n", ret);
@@ -379,12 +386,6 @@ static int cpupool_unassign_cpu(struct cpupool *c, unsigned int cpu)
     atomic_inc(&c->refcnt);
     cpupool_cpu_moving = c;
     cpumask_clear_cpu(cpu, c->cpu_valid);
-
-    rcu_read_lock(&domlist_read_lock);
-    for_each_domain_in_cpupool(d, c)
-        domain_update_node_affinity(d);
-    rcu_read_unlock(&domlist_read_lock);
-
     spin_unlock(&cpupool_lock);
 
     work_cpu = smp_processor_id();

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-03-13 11:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-09 16:49 [PATCH] xen: postpone updating domains' node affinity when removing a CPU from a cpupool Dario Faggioli
2015-03-11 10:32 ` Dario Faggioli
2015-03-11 15:01 ` George Dunlap
2015-03-11 16:04   ` Dario Faggioli
2015-03-12 13:45     ` [PATCH] xen: avoid updating node affinity twice " Dario Faggioli
2015-03-12 14:51       ` Jan Beulich
2015-03-12 15:52         ` Dario Faggioli
2015-03-13 11:15           ` George Dunlap
2015-03-12 14:52       ` George Dunlap
2015-03-12 15:56         ` Dario Faggioli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.