Commit a0cff57b authored by Davidlohr Bueso's avatar Davidlohr Bueso Committed by Paolo Bonzini

kvm,x86: Fix apf_task_wake_one() wq serialization

During code inspection, the following potential race was seen:

CPU0   	    		    	     	CPU1
kvm_async_pf_task_wait			apf_task_wake_one
					  [L] swait_active(&n->wq)
  [S] prepare_to_swait(&n.wq)
  [L] if (!hlist_unhahed(&
	schedule()			  [S] hlist_del_init(&n->link);

Properly serialize swait_active() checks such that a wakeup is
not missed.
Signed-off-by: default avatarDavidlohr Bueso <[email protected]>
Signed-off-by: default avatarPaolo Bonzini <[email protected]>
parent cc1b4680
......@@ -180,7 +180,7 @@ static void apf_task_wake_one(struct kvm_task_sleep_node *n)
if (n->halted)
else if (swait_active(&n->wq))
else if (swq_has_sleeper(&n->wq))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment