Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5e0018b3 authored by Davidlohr Bueso's avatar Davidlohr Bueso Committed by Paolo Bonzini
Browse files

kvm: Serialize wq active checks in kvm_vcpu_wake_up()



This is a generic call and can be suceptible to races
in reading the wq task_list while another task is adding
itself to the list. Add a full barrier by using the
swq_has_sleeper() helper.

Signed-off-by: default avatarDavidlohr Bueso <dbueso@suse.de>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent a0cff57b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2187,7 +2187,7 @@ bool kvm_vcpu_wake_up(struct kvm_vcpu *vcpu)
	struct swait_queue_head *wqp;

	wqp = kvm_arch_vcpu_wq(vcpu);
	if (swait_active(wqp)) {
	if (swq_has_sleeper(wqp)) {
		swake_up(wqp);
		++vcpu->stat.halt_wakeup;
		return true;