From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 07/11] KVM: nVMX: Release shadow vmcs Date: Thu, 18 Apr 2013 13:18:00 +0300 Message-ID: <20130418101800.GA8911@redhat.com> References: <1366274066-abelg@il.ibm.com> <20130418083759.C3DFE3806E7@moren.haifa.ibm.com> <20130418091218.GP8997@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dongxiao.xu@intel.com, jun.nakajima@intel.com, kvm@vger.kernel.org, nadav@harel.org.il, owasserm@redhat.com To: Abel Gordon Return-path: Received: from mx1.redhat.com ([209.132.183.28]:27159 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967505Ab3DRKXG (ORCPT ); Thu, 18 Apr 2013 06:23:06 -0400 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Apr 18, 2013 at 01:16:34PM +0300, Abel Gordon wrote: > > > Gleb Natapov wrote on 18/04/2013 12:12:18 PM: > > > On Thu, Apr 18, 2013 at 11:37:59AM +0300, Abel Gordon wrote: > > > Unmap vmcs12 and release the corresponding shadow vmcs > > > > > > Signed-off-by: Abel Gordon > > > --- > > > arch/x86/kvm/vmx.c | 20 ++++++++++++-------- > > > 1 file changed, 12 insertions(+), 8 deletions(-) > > > > > > --- .before/arch/x86/kvm/vmx.c 2013-04-18 11:28:23.000000000 +0300 > > > +++ .after/arch/x86/kvm/vmx.c 2013-04-18 11:28:23.000000000 +0300 > > > @@ -5607,6 +5607,12 @@ static int nested_vmx_check_permission(s > > > return 1; > > > } > > > > > > +static inline void nested_release_vmcs12(struct vcpu_vmx *vmx) > > > +{ > > > + kunmap(vmx->nested.current_vmcs12_page); > > > + nested_release_page(vmx->nested.current_vmcs12_page); > > > +} > > > + > > > /* > > > * Free whatever needs to be freed from vmx->nested when L1 goes down, > or > > > * just stops using VMX. > > > @@ -5617,8 +5623,9 @@ static void free_nested(struct vcpu_vmx > > > return; > > > vmx->nested.vmxon = false; > > > if (vmx->nested.current_vmptr != -1ull) { > > > - kunmap(vmx->nested.current_vmcs12_page); > > > - nested_release_page(vmx->nested.current_vmcs12_page); > > > + nested_release_vmcs12(vmx); > > > + if (enable_shadow_vmcs) > > > + free_vmcs(vmx->nested.current_shadow_vmcs); > > Should be freed even if vmx->nested.current_vmptr == -1, no? > > Yes you are right. Now that we re-use the shadow vmcs we MUST free also > if there is no current vmcs. I will fix this. > Do you have any other comments before I send v5 (hopefully the last > version) ? Nope, no other comments from me. -- Gleb.