From patchwork Thu Oct 5 08:18:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sergey Dyasli X-Patchwork-Id: 9986519 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 18DAC602B8 for ; Thu, 5 Oct 2017 08:21:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0913828B2F for ; Thu, 5 Oct 2017 08:21:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1BBE28C57; Thu, 5 Oct 2017 08:21:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8472B28B2F for ; Thu, 5 Oct 2017 08:21:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e01N4-0005eQ-M2; Thu, 05 Oct 2017 08:19:06 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e01N4-0005eK-Ap for xen-devel@lists.xen.org; Thu, 05 Oct 2017 08:19:06 +0000 Received: from [85.158.143.35] by server-6.bemta-6.messagelabs.com id E8/A3-03435-9FAE5D95; Thu, 05 Oct 2017 08:19:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNKsWRWlGSWpSXmKPExsWyU9JRQvfTq6u RBhM2W1gs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBkfthoW/JCsODB3L0sD4xnJLkZODgkBP4lT /56wgNhsAnoSG2e/YgKxRQSSJSYc7gSKc3EwC8xnlvi5qYURJCEsECrxb+FJNoiiMIkPvYeZI Wwnid9zroHVsAioSOz4cA5sKK+AgcSx3w2sILaQwHVGiXtTfEBsTgE7iX0X/4HFGQVkJb40rg abwywgLnHryXwmiOMEJJbsOc8MYYtKvHwMUS8BNP/5zgWMELaOxNnrT6BsA4mtS/cB7eUAmqM psX6XPsRIS4mLHycxQtiKElO6H7JDnCYocXLmE5YJjGKzkGyehdA9C0n3LCTds5B0L2BkXcWo UZxaVJZapGtkqJdUlJmeUZKbmJmja2hgppebWlycmJ6ak5hUrJecn7uJERhZDECwg/HPsoBDj JIcTEqivCLAiBPiS8pPqcxILM6ILyrNSS0+xCjDwaEkwZv3EignWJSanlqRlpkDjHGYtAQHj5 II7x6QNG9xQWJucWY6ROoUoyVHx827f5g4ZoDJJ9fm/WUSYsnLz0uVEuctAWkQAGnIKM2DGwd LQ5cYZaWEeRmBDhTiKUgtys0sQZV/xSjOwagkzNsBMoUnM68EbusroIOYgA6a03QF5KCSRISU VAOj3paA9oWrfxw/13kyY631+iLnnRaGr5IZ2IXChC97HFzHt/g2x6x5ClyLnu49e+TKgg2ux 2f2X9KKVPyekvR+S7dCbedq4y+NVsmL+ibJKylPOVe9ZercJd/tVb+0SXy88k1gs8T/LMdXMQ VWShWrZj6UNLq1u+hYkeSz0pLDycdmHHB0y3+gqcRSnJFoqMVcVJwIAE9+Pmw+AwAA X-Env-Sender: prvs=444335b13=sergey.dyasli@citrix.com X-Msg-Ref: server-12.tower-21.messagelabs.com!1507191538!76429362!1 X-Originating-IP: [185.25.65.24] X-SpamReason: No, hits=0.0 required=7.0 tests=received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 38181 invoked from network); 5 Oct 2017 08:18:58 -0000 Received: from smtp.eu.citrix.com (HELO SMTP.EU.CITRIX.COM) (185.25.65.24) by server-12.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 5 Oct 2017 08:18:58 -0000 X-IronPort-AV: E=Sophos;i="5.42,480,1500940800"; d="scan'208";a="54064991" From: Sergey Dyasli To: Andrew Cooper , "xen-devel@lists.xen.org" Thread-Topic: [PATCH v3 5/9] x86/vvmx: make updating shadow EPTP value more efficient Thread-Index: AQHTPFtB0sv301sWJ0ubfvb1b1REuaLToooAgAAE+oCAASNsgA== Date: Thu, 5 Oct 2017 08:18:57 +0000 Message-ID: <1507191537.3314.3.camel@citrix.com> References: <20171003152104.1432-1-sergey.dyasli@citrix.com> <20171003152104.1432-6-sergey.dyasli@citrix.com> <9f9aad6e-294f-5ed2-36b4-e177e6e48315@citrix.com> <2e7d1d76-978a-6b01-1360-18ffa40282da@citrix.com> In-Reply-To: <2e7d1d76-978a-6b01-1360-18ffa40282da@citrix.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Evolution 3.22.6-1ubuntu1 x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted Content-ID: MIME-Version: 1.0 Cc: Sergey Dyasli , Kevin Tian , "suravee.suthikulpanit@amd.com" , "jun.nakajima@intel.com" , "Tim \(Xen.org\)" , George Dunlap , "jbeulich@suse.com" , "boris.ostrovsky@oracle.com" Subject: Re: [Xen-devel] [PATCH v3 5/9] x86/vvmx: make updating shadow EPTP value more efficient X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Wed, 2017-10-04 at 15:55 +0100, Andrew Cooper wrote: > > > > > > -void vmx_vmenter_helper(const struct cpu_user_regs *regs) > > > +int vmx_vmenter_helper(const struct cpu_user_regs *regs) > > > > ...Andy, did you want a comment here explaining what the return value is > > supposed to mean? (And/or changing this to a bool?) > > Definitely a comment please (especially as it is logically inverted from > what I would have expected originally). > > Bool depending on whether it actually has boolean properties or not > (which will depend on how the comment ends up looking). > > ~Andrew Andrew, Are you happy with the following fixup? --- Thanks, Sergey diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S index 9fb8f89220..24265ebc08 100644 --- a/xen/arch/x86/hvm/vmx/entry.S +++ b/xen/arch/x86/hvm/vmx/entry.S @@ -80,7 +80,7 @@ UNLIKELY_END(realmode)          mov  %rsp,%rdi          call vmx_vmenter_helper          cmp  $0,%eax -        jne .Lvmx_vmentry_restart +        je .Lvmx_vmentry_restart          mov  VCPU_hvm_guest_cr2(%rbx),%rax            pop  %r15 diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index c9a4111267..d9b35202f9 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -4197,7 +4197,8 @@ static void lbr_fixup(void)          bdw_erratum_bdf14_fixup();  }   -int vmx_vmenter_helper(const struct cpu_user_regs *regs) +/* Return false if the vmentry has to be restarted */ +bool vmx_vmenter_helper(const struct cpu_user_regs *regs)  {      struct vcpu *curr = current;      u32 new_asid, old_asid; @@ -4206,7 +4207,7 @@ int vmx_vmenter_helper(const struct cpu_user_regs *regs)        /* Shadow EPTP can't be updated here because irqs are disabled */       if ( nestedhvm_vcpu_in_guestmode(curr) && vcpu_nestedhvm(curr).stale_np2m ) -         return 1; +         return false;        if ( curr->domain->arch.hvm_domain.pi_ops.do_resume )          curr->domain->arch.hvm_domain.pi_ops.do_resume(curr); @@ -4269,7 +4270,7 @@ int vmx_vmenter_helper(const struct cpu_user_regs *regs)      __vmwrite(GUEST_RSP,    regs->rsp);      __vmwrite(GUEST_RFLAGS, regs->rflags | X86_EFLAGS_MBS);   -    return 0; +    return true;  }    /*