[v2,4/4] xen: sched: refactor the ASSERTs around vcpu_deassing()
diff mbox series

Message ID 156412236781.2385.9110155201477198899.stgit@Palanthas
State New, archived
Headers show
  • xen: sched: support vcpu hotplug/hotunplug in the 'null scheduler'
Related show

Commit Message

Dario Faggioli July 26, 2019, 6:26 a.m. UTC
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>
 xen/common/sched_null.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff mbox series

diff --git a/xen/common/sched_null.c b/xen/common/sched_null.c
index 1bbcaf92b9..c72335e5fa 100644
--- a/xen/common/sched_null.c
+++ b/xen/common/sched_null.c
@@ -368,6 +368,8 @@  static bool vcpu_deassign(struct null_private *prv, struct vcpu *v)
     struct null_vcpu *wvc;
+    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);