From patchwork Thu Oct 5 13:04:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sergey Dyasli X-Patchwork-Id: 9987101 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 10F886029B for ; Thu, 5 Oct 2017 13:07:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0241D28C8E for ; Thu, 5 Oct 2017 13:07:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA6D928C9C; Thu, 5 Oct 2017 13:07:09 +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 E48C328C95 for ; Thu, 5 Oct 2017 13:07:07 +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 1e05pa-00057X-RJ; Thu, 05 Oct 2017 13:04:50 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e05pZ-00057K-AB for xen-devel@lists.xen.org; Thu, 05 Oct 2017 13:04:49 +0000 Received: from [85.158.139.211] by server-10.bemta-5.messagelabs.com id 52/06-00743-0FD26D95; Thu, 05 Oct 2017 13:04:48 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrJKsWRWlGSWpSXmKPExsWyU9JRQve97rV Igwt3DS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oyeO5dZCyZIVTROF29gfCLZxcjJISHgJ/Hw 5w1mEJtNQE9i4+xXTCC2iIC2xMb9K4FsLg5mgbXMEl8n32YESQgLhEr8W3iSDaIoTOJD72GgZ g4g20/i1zsDkDCLgIrEt7VfWEDCvAIGEg83u4OMERLYzCTx7+oEsF2cAvYSbd2d7CA2o4CsxJ fG1WBxZgFxiVtP5jNB3CYgsWTPeWYIW1Ti5eN/rBC2isTznQsYIWwdibPXn0DZBhJbl+4D28s soCmxfpc+xEhLiZlb9jFB2IoSU7ofgq3lFRCUODnzCcsERrFZSDbPQuiehaR7FpLuWUi6FzCy rmJUL04tKkst0jXUSyrKTM8oyU3MzNE1NDDVy00tLk5MT81JTCrWS87P3cQIjKp6BgbGHYxNv c6HGCU5mJREed/oXIsU4kvKT6nMSCzOiC8qzUktPsQow8GhJMH7ESQnWJSanlqRlpkDjG+YtA QHj5IIrxwwxoV4iwsSc4sz0yFSpxgtOTpu3v3DxDEDTD65Nu8vkxBLXn5eqpQ473mQeQIgDRm leXDjYCnoEqOslDAvIwMDgxBPQWpRbmYJqvwrRnEORiVh3qUgU3gy80rgtr4COogJ6KA5TVdA DipJREhJNTDGblqVEyVbpXSIdebOmcYqgr67t6SV8m1zOOYefkJje+M/15uLvuULZD6vkXsq8 PuOhMHSLdZv3mXy+ujnbi5tcN2dYTQvy0nYYt6LLYYMaZclM9M/tU6Z9O4d76qFMblfpXgnn1 7In7Xu5VTbqT8a3a2nXV8amDJvUqRr89YdTLP7VFxzrs5SYinOSDTUYi4qTgQANlJcYjwDAAA = X-Env-Sender: prvs=444335b13=sergey.dyasli@citrix.com X-Msg-Ref: server-16.tower-206.messagelabs.com!1507208687!94715654!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 6176 invoked from network); 5 Oct 2017 13:04:47 -0000 Received: from smtp.eu.citrix.com (HELO SMTP.EU.CITRIX.COM) (185.25.65.24) by server-16.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 5 Oct 2017 13:04:47 -0000 X-IronPort-AV: E=Sophos;i="5.42,481,1500940800"; d="scan'208";a="54079700" From: Sergey Dyasli To: "JBeulich@suse.com" Thread-Topic: [PATCH v3 5/9] x86/vvmx: make updating shadow EPTP value more efficient Thread-Index: AQHTPFtB0sv301sWJ0ubfvb1b1REuaLToooAgAAE+oCAASNsgIAAEzMAgAA8p4A= Date: Thu, 5 Oct 2017 13:04:46 +0000 Message-ID: <1507208685.3314.5.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> <1507191537.3314.3.camel@citrix.com> <59D6172C0200007800182724@prv-mh.provo.novell.com> In-Reply-To: <59D6172C0200007800182724@prv-mh.provo.novell.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: <7D2FC3715F90384EAEA05B5F75BB6573@citrix.com> MIME-Version: 1.0 Cc: Sergey Dyasli , Kevin Tian , "jun.nakajima@intel.com" , Andrew Cooper , "Tim \(Xen.org\)" , George Dunlap , "xen-devel@lists.xen.org" , "suravee.suthikulpanit@amd.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 Thu, 2017-10-05 at 03:27 -0600, Jan Beulich wrote: > > > > On 05.10.17 at 10:18, wrote: > > > > --- 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 > > If you make the function return bool, the cmp above also needs > changing (and then preferably to "test %al, %al", in which case > it would then also better be "jz" instead of "je"). Here's the updated delta: Acked-by: Jun Nakajima --- Thanks, Sergey diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S index 9fb8f89220..47cd674260 100644 --- a/xen/arch/x86/hvm/vmx/entry.S +++ b/xen/arch/x86/hvm/vmx/entry.S @@ -79,8 +79,8 @@ UNLIKELY_END(realmode)            mov  %rsp,%rdi          call vmx_vmenter_helper -        cmp  $0,%eax -        jne .Lvmx_vmentry_restart +        test %al, %al +        jz .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..a5c2bd71cd 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) +/* Returns 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;  }    /*