mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
Fix the logic in vcpu_sleep_sync(): we must wait until
the running flag is cleared *and* the scheduler lock is released. Not just one or the other. Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
This commit is contained in:
1 parent
1f0c99978f
commit
5bcdcd40ec
1 file changed
+5
-4
@@ -211,11 +211,12 @@ void vcpu_sleep_sync(struct vcpu *v)
|
||||
|
||||
/*
|
||||
* We can be sure that the VCPU is finally descheduled after the running
|
||||
* flag is cleared and the scheduler lock is released.
|
||||
* flag is cleared and the scheduler lock is released. We also check that
|
||||
* the domain continues to be unrunnable, in case someone else wakes it.
|
||||
*/
|
||||
while ( test_bit(_VCPUF_running, &v->vcpu_flags)
|
||||
&& !domain_runnable(v)
|
||||
&& spin_is_locked(&schedule_data[v->processor].schedule_lock) )
|
||||
while ( !domain_runnable(v) &&
|
||||
(test_bit(_VCPUF_running, &v->vcpu_flags) ||
|
||||
spin_is_locked(&schedule_data[v->processor].schedule_lock)) )
|
||||
cpu_relax();
|
||||
|
||||
sync_vcpu_execstate(v);
|
||||
|
||||