Return-Path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:15312 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726298AbfJJLF1 (ORCPT ); Thu, 10 Oct 2019 07:05:27 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x9A9RZEb157682 for ; Thu, 10 Oct 2019 07:05:26 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 2vj0kdx4vh-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 10 Oct 2019 07:05:25 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 10 Oct 2019 12:05:24 +0100 From: Christian Borntraeger Subject: [PATCH v2 2/2] KVM: s390: Do not yield when target is already running Date: Thu, 10 Oct 2019 13:05:18 +0200 In-Reply-To: <20191010110518.129256-1-borntraeger@de.ibm.com> References: <20191010110518.129256-1-borntraeger@de.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <20191010110518.129256-3-borntraeger@de.ibm.com> Sender: linux-s390-owner@vger.kernel.org List-ID: To: Janosch Frank Cc: KVM , Cornelia Huck , Christian Borntraeger , David Hildenbrand , linux-s390 , Thomas Huth If the target is already running we do not need to yield. Signed-off-by: Christian Borntraeger Reviewed-by: David Hildenbrand --- arch/s390/kvm/diag.c | 4 ++++ 1 file changed, 4 insertions(+) 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; -- 2.21.0