[v2,2/2] KVM: s390: Do not yield when target is already running
diff mbox series

Message ID 20191010110518.129256-3-borntraeger@de.ibm.com
State New
Headers show
Series
  • diag 9c improvements
Related show

Commit Message

Christian Borntraeger Oct. 10, 2019, 11:05 a.m. UTC
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>
---
 arch/s390/kvm/diag.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Cornelia Huck Oct. 10, 2019, 11:16 a.m. UTC | #1
On Thu, 10 Oct 2019 13:05:18 +0200
Christian Borntraeger <borntraeger@de.ibm.com> wrote:

> 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>
> ---
>  arch/s390/kvm/diag.c | 4 ++++
>  1 file changed, 4 insertions(+)

Reviewed-by: Cornelia Huck <cohuck@redhat.com>

Patch
diff mbox series

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;