Received: by 10.223.176.5 with SMTP id f5csp1286459wra; Fri, 9 Feb 2018 16:32:38 -0800 (PST) X-Google-Smtp-Source: AH8x225BbcYk2J1SUiiIFbyUyIa0UirMWdr3PvFwdAhbrz30CMT05/PCq16QtS3oLGs6b2KO/0Zm X-Received: by 2002:a17:902:b709:: with SMTP id d9-v6mr4219849pls.119.1518222758447; Fri, 09 Feb 2018 16:32:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518222758; cv=none; d=google.com; s=arc-20160816; b=sFKaqaFc0UbRxzBNPXWP3aPGQ+XjaKKqSTiSX8m+5f2MeBTo6f9M/Vo7rmJiyW1WCg sKYvjTUEMCU2njKgdf8crG4ixBSwvIucTYtNEt82h/m2f8FH+vjbhDwt/OMaCDNU32+p gNnK/Py2BKzOfBYv80mTuIRARJPpk5jAp2Ox1roJQnUaRCdeTUqKqPV7RM8KH3vFsSJD uwjHdXYOtgfiKQNLwQkXTSThBuu3UkdKfNVj2A1mREhTX+Yt+Cq/eGFfLPgLUAGVjPin OFCkRt8KUE7bNWyRBLfavPWaCNI3ENoOk6UcVSntHruIQjyc24MsrJhXjMKRuXeyiYfi bP3A== 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=KNeX+/RRdURtEbTy8P4j3zXH7W3s7cA+Fthhss58BP4=; b=k2V9X83gqAWM0IXuEOhF4O5J+YAWblZkCo1RZlRyJm+BfTC8wMQI+vyxQtdUKUO7OO fCceZLwZtRXlSsJE8bb2llz2QiZkLmxj07RZS5m7IniLMe1996BfLKa5HxVCzF4A0scF aEhHqZnVBcjghlNZPCiSBN0kCifGgrADQwvp/zyjkxSIEi6gYNhkpwidmBxRizVzwmod KQCQOiwBuROj/iI6shJaJbuBGxK2oBwZhYmR/Va7BeHgj6oB2r7mMvQJm3YZEUzooAXc MRwZ0+NFRgGlOYL4VSNV/FmOpxjNSS22il3+xopoFK02+v17qtFouz7mwuUNy3xye0yc iY1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=JY0V0VSg; 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 61-v6si2235537plb.203.2018.02.09.16.32.22; Fri, 09 Feb 2018 16:32:38 -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=JY0V0VSg; 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 S1753347AbeBJAbn (ORCPT + 99 others); Fri, 9 Feb 2018 19:31:43 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:47786 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753300AbeBJAbl (ORCPT ); Fri, 9 Feb 2018 19:31:41 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w1A0VPvH161308; Sat, 10 Feb 2018 00:31:25 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=KNeX+/RRdURtEbTy8P4j3zXH7W3s7cA+Fthhss58BP4=; b=JY0V0VSgo9C3/E/v1uCuzKqBSiCPL3x+bSljZlV4vST/2rnzIJhriWk7OA2rylHVD81a tkTpGH+vrVmMyiSQtF4Qzy6sVUpIq8p8zM4koZ3S7yfKA+whZj5L6twi3S3OTpkBTTOM uaUMfEE+U8yHkK+LHeO7V+EuKGAZFVnsXR6Q7l+urdk5mtGHa81Vu8nSFdIJ67+NpPJ5 /jBK6nNB3aThxb3Hoq7seRtqxd3dYys7kqXGc/+mU/W26QWdV0Ctj/LDAtsUlUwKUckR mouN+VkxIwUYFlq3jcNJ87bLTE5rSamunxKjEqNtVOuC5HIdZ/Rme7znv/tAUcoLmpca nQ== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2g1p93g00a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 10 Feb 2018 00:31:25 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w1A0VNhg030819 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 10 Feb 2018 00:31:23 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 w1A0VMEf007212; Sat, 10 Feb 2018 00:31:22 GMT MIME-Version: 1.0 Message-ID: <806c274d-5d9a-432a-bf04-f154be89cb7f@default> Date: Fri, 9 Feb 2018 16:31:22 -0800 (PST) From: Liran Alon To: Cc: , , , , , , , Subject: Re: [PATCH v2] x86/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=8800 signatures=668666 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-1802100003 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 v2: > - Remove VID stuff. Only handle event injection in this patch. > --- > 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..42f39d9 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 for optimization. I would remove the "for optimization." from the comment. > +=09 */ > +=09if ((vmcs12->guest_activity_state =3D=3D GUEST_ACTIVITY_HLT) && > +=09 !(vmcs12->vm_entry_intr_info_field & > VECTORING_INFO_VALID_MASK)) VECTORING_INFO_VALID_MASK is used in KVM code against vmcs12->idt_vectoring= _info_field. I think you should use INTR_INFO_VALID_MASK to be consistent with rest of c= ode. > =09=09return kvm_vcpu_halt(vcpu); > =20 > =09vmx->nested.nested_run_pending =3D 1; > --=20 > 1.9.1 In addition, commit title should be written in format of: "KVM: VMX: Don't halt vcpu when L1 is injecting events to L2" (Makes it easier to grep in git log). Other than that, seems good to me. :) Reviewed-by: Liran Alon Thanks, -Liran