Received: by 10.223.185.116 with SMTP id b49csp950536wrg; Sun, 11 Feb 2018 00:52:28 -0800 (PST) X-Google-Smtp-Source: AH8x224lg0tDw+rxGfaPVtN6J1cAYGql4bWMyIwdJBtiEDfRL0uimavIy9qcZbjeBe7emBvCY+oT X-Received: by 10.99.158.17 with SMTP id s17mr6908790pgd.64.1518339148748; Sun, 11 Feb 2018 00:52:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518339148; cv=none; d=google.com; s=arc-20160816; b=qs1itDNn1hDVAwZP1F5HhCXWxmwTuhFIE0FbgcK+OKF7Qidfsd5RJTa33vUbVWIi5t 60wBxIwtgEK8OKhFhRoKppVQdg3Wj1j6aqTMPpTwV1CzX/bI3qczYT1JHBL/7N4p3dPI 0CU4AgAdzToUIY3ZYH6UwDKV+RvHqYIEmdFHR9QTQwwKwgcPVGhW69rJlkgaHiUOB47W sQC4bmtaARxZqsV+xAYwRdBjpudXBvSsc/j8OBTsbmQ3Oj/2g7iEy32ugn+nHGjCMuY6 Ccr/hFgClzUJvTXB72+LEErGC/Y6hH3s2SwnL7WRH389sai4djUFbBXLa9mgzwcqk6Ka DQvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:subject:cc:to:from:date:message-id :mime-version:dkim-signature:arc-authentication-results; bh=PWvMys4uhGxystJ4PmHNwHfrwB3yf/DiuHwUA5MNy5s=; b=wCE/bVAuKiiIxpdLUp2C9bxn6+TWJPQlMN8TalrVuKoWgmLvFt/a5qMU/OvhigJreG GUOOauj1fNmNevam66ViyE8uKKvgcZGbQEsvxW3mOEwOPEz333THneQOL1nF4vB3r81/ qZQqFE0PU0i1XX6v5CSzE6e4rzlpeB2lJJEtUlKXhhO/uCMDJ1558kt6WVxZtBWu6JD1 nUSf6u/U2CeaZTPz45TJsXmlfuuZqjqrUOIlXm7E/0DQxc5/6zL5ZpnJsLoHg6KfLWe+ b7QXJVmKQYGABwJx3pmPQXIikMZX8wy8FGuiFSubim4SkoBhnTHzcf9JM65zUb+shuiW rWew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=Xa7sK4zO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r7si535045pgq.645.2018.02.11.00.52.13; Sun, 11 Feb 2018 00:52:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=Xa7sK4zO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752679AbeBKIvh (ORCPT + 99 others); Sun, 11 Feb 2018 03:51:37 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:41814 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752085AbeBKIvf (ORCPT ); Sun, 11 Feb 2018 03:51:35 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1B8d5Yh052854; Sun, 11 Feb 2018 08:51:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : to : cc : subject : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=PWvMys4uhGxystJ4PmHNwHfrwB3yf/DiuHwUA5MNy5s=; b=Xa7sK4zO9SUeuRfw4iiKs5siXPgQShrR74FGlHnEdb2WkC6OkpeFq3t1TjWleh4D/33P 5nrHus0YF4LU8XUMCIqll6Jl31LW9KS24p8ijM/o+s7jZh0ut8LpVTomtV/TCX8Lb0Qs L8bhPM8Rsk30WCcdk2y5xGiRnAQs2dGlDsejAb907vrBeEhReGA5RsGRe8qsdZSATIBS i0djAumyRcLDXQaGIrd0ahSiU+vLlcz4AQBXddQgyJLCLeYWp0SoYleI/FQusfDvb8qq T9LEMAaF1sJgL4B7qNXFKgHDw7P8B1ozfe09F7MaxgylGU3mbM/JZUO/u76RdKoJmSYZ jA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2g2ht4r3ds-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 11 Feb 2018 08:51:18 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w1B8pHg9028591 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 11 Feb 2018 08:51:17 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w1B8pEAT012708; Sun, 11 Feb 2018 08:51:14 GMT MIME-Version: 1.0 Message-ID: <3bf7f0af-cfdf-4daa-8230-240e7e63f099@default> Date: Sun, 11 Feb 2018 00:51:14 -0800 (PST) From: Liran Alon To: Cc: , , , , , , , Subject: Re: [PATCH v3] KVM: VMX: Don't halt vcpu when L1 is injecting events to L2 X-Mailer: Zimbra on Oracle Beehive Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8801 signatures=668668 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802110116 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- chao.gao@intel.com wrote: > Although L2 is in halt state, it will be in the active state after > VM entry if the VM entry is vectoring according to SDM 26.6.2 > Activity > State. Halting the vcpu here means the event won't be injected to L2 > and this decision isn't reported to L1. Thus L0 drops an event that > should be injected to L2. >=20 > Cc: Liran Alon > Signed-off-by: Chao Gao > --- > changes in v3: > - s/VECTORING_INFO_VALID_MASK/INTR_INFO_VALID_MASK > - Changes of subject, comments. >=20 > Changes in v2: > - Remove VID stuff. Only handle event injection in this patch. >=20 > Signed-off-by: Chao Gao > --- > arch/x86/kvm/vmx.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) >=20 > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index bb5b488..cf7c2fc 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -10985,7 +10985,12 @@ static int nested_vmx_run(struct kvm_vcpu > *vcpu, bool launch) > =09if (ret) > =09=09return ret; > =20 > -=09if (vmcs12->guest_activity_state =3D=3D GUEST_ACTIVITY_HLT) > +=09/* > +=09 * If we're entering a halted L2 vcpu and the L2 vcpu won't be > woken > +=09 * by event injection, halt vcpu. > +=09 */ > +=09if ((vmcs12->guest_activity_state =3D=3D GUEST_ACTIVITY_HLT) && > +=09 !(vmcs12->vm_entry_intr_info_field & INTR_INFO_VALID_MASK)) > =09=09return kvm_vcpu_halt(vcpu); > =20 > =09vmx->nested.nested_run_pending =3D 1; > --=20 > 1.9.1 Reviewed-by: Liran Alon (Paolo: I would recommend changing commit title from "KVM: VMX: ..." to "KV= M: nVMX: ..." when applying for convention. Easier to grep nVMX changes.)