kvm,powerpc: Serialize wq active checks in ops->vcpu_kick
authorDavidlohr Bueso <dave@stgolabs.net>
Wed, 13 Sep 2017 20:08:23 +0000 (13:08 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 15 Sep 2017 14:57:13 +0000 (16:57 +0200)
Particularly because kvmppc_fast_vcpu_kick_hv() is a callback,
ensure that we properly serialize wq active checks in order to
avoid potentially missing a wakeup due to racing with the waiter
side.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/powerpc/kvm/book3s_hv.c

index a7177c284f9b6da3da735bcf26baf78396814a4b..73bf1ebfa78fcc7ef74dd51713d800ea12e9e745 100644 (file)
@@ -181,7 +181,7 @@ static void kvmppc_fast_vcpu_kick_hv(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;
        }