Remove the spin on VCPUF_running from context_switch().
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 17 Jan 2006 13:24:42 +0000 (14:24 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 17 Jan 2006 13:24:42 +0000 (14:24 +0100)
It doesn't work because we already set VCPUF_running
locally, and the scheduler should not pick another CPU's
VCPUF_running VCPU anyway, since it mustn't modify the
processor field.

Instead just add a simple assertion to the scheduler to
ensure the scheduling algorithm is not picking an
inappropriate VCPU.

Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/domain.c
xen/common/schedule.c

index 25746ab4f1c8ab62a965584824b388c9ee14158c..759bbadb21d5106279802ccd36ee0b5d014a3a94 100644 (file)
@@ -738,9 +738,6 @@ void context_switch(struct vcpu *prev, struct vcpu *next)
     ASSERT(cpus_weight(dirty_mask) <= 1);
     if ( unlikely(!cpu_isset(cpu, dirty_mask) && !cpus_empty(dirty_mask)) )
     {
-        /* Make sure the next VCPU is not in a scheduling tail. */
-        while ( test_bit(_VCPUF_running, &next->vcpu_flags) )
-            cpu_relax();
         /* Other cpus call __sync_lazy_execstate from flush ipi handler. */
         if ( !cpus_empty(next->vcpu_dirty_cpumask) )
             flush_tlb_mask(next->vcpu_dirty_cpumask);
index 94b40559da540d142c897bf5c204996ae1dd8bc4..0ffa53a8fa62af10689d978871badac7efc32f48 100644 (file)
@@ -420,6 +420,7 @@ static void __enter_scheduler(void)
     }
 #endif
 
+    ASSERT(!test_bit(_VCPUF_running, &next->vcpu_flags));
     set_bit(_VCPUF_running, &next->vcpu_flags);
 
     spin_unlock_irq(&schedule_data[cpu].schedule_lock);