KVM: s390: Do not yield when target is already running
authorChristian Borntraeger <borntraeger@de.ibm.com>
Fri, 15 Feb 2019 12:47:20 +0000 (13:47 +0100)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Thu, 10 Oct 2019 11:18:40 +0000 (13:18 +0200)
If the target is already running we do not need to yield.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
arch/s390/kvm/diag.c

index 609c55df3ce862be7a3884a90a27446a5e61d3f2..3fb54ec2cf3e1f0ea364bc6590a8c5059e35cec4 100644 (file)
@@ -168,6 +168,10 @@ static int __diag_time_slice_end_directed(struct kvm_vcpu *vcpu)
        if (!tcpu)
                goto no_yield;
 
+       /* target already running */
+       if (READ_ONCE(tcpu->cpu) >= 0)
+               goto no_yield;
+
        if (kvm_vcpu_yield_to(tcpu) <= 0)
                goto no_yield;