summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Borntraeger <borntraeger@de.ibm.com>2019-02-15 13:47:20 +0100
committerChristian Borntraeger <borntraeger@de.ibm.com>2019-10-10 13:18:40 +0200
commitc7b7de63124645089ccf9900b9e5ea08059ccae0 (patch)
treed723a20a594c6f525c56c0988363bddf724cd500
parentKVM: s390: count invalid yields (diff)
downloadlinux-c7b7de63124645089ccf9900b9e5ea08059ccae0.tar.xz
linux-c7b7de63124645089ccf9900b9e5ea08059ccae0.zip
KVM: s390: Do not yield when target is already running
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>
-rw-r--r--arch/s390/kvm/diag.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
index 609c55df3ce8..3fb54ec2cf3e 100644
--- a/arch/s390/kvm/diag.c
+++ b/arch/s390/kvm/diag.c
@@ -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;