]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
xen: sched: refactor the ASSERTs around vcpu_deassing()
authorDario Faggioli <dfaggioli@suse.com>
Mon, 5 Aug 2019 10:50:57 +0000 (11:50 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Mon, 5 Aug 2019 10:50:57 +0000 (11:50 +0100)
It is all the time that we call vcpu_deassing() that the vcpu _must_ be
assigned to a pCPU, and hence that such pCPU can't be free.

Therefore, move the ASSERT-s which check for these properties in that
function, where they belong better.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
Reviewed-by: George Dunlap <george.dunlap@citix.com>
Message-Id: <156412236781.2385.9110155201477198899.stgit@Palanthas>

xen/common/sched_null.c

index 2edac234a596977cc2b93040d44adccd1ffad0db..26c6f0f129da2023315bacecfea29355d92f718b 100644 (file)
@@ -368,6 +368,8 @@ static bool vcpu_deassign(struct null_private *prv, struct vcpu *v)
     struct null_vcpu *wvc;
 
     ASSERT(list_empty(&null_vcpu(v)->waitq_elem));
+    ASSERT(per_cpu(npc, v->processor).vcpu == v);
+    ASSERT(!cpumask_test_cpu(v->processor, &prv->cpus_free));
 
     per_cpu(npc, cpu).vcpu = NULL;
     cpumask_set_cpu(cpu, &prv->cpus_free);
@@ -529,9 +531,6 @@ static void null_vcpu_remove(const struct scheduler *ops, struct vcpu *v)
         goto out;
     }
 
-    ASSERT(per_cpu(npc, v->processor).vcpu == v);
-    ASSERT(!cpumask_test_cpu(v->processor, &prv->cpus_free));
-
     vcpu_deassign(prv, v);
 
  out: