From: Gleb Natapov <gleb@redhat.com>
To: Abel Gordon <abelg@il.ibm.com>
Cc: kvm@vger.kernel.org, owasserm@redhat.com, nadav@harel.org.il,
jun.nakajima@intel.com, dongxiao.xu@intel.com
Subject: Re: [PATCH 07/11] KVM: nVMX: Release shadow vmcs
Date: Thu, 18 Apr 2013 12:12:18 +0300 [thread overview]
Message-ID: <20130418091218.GP8997@redhat.com> (raw)
In-Reply-To: <20130418083759.C3DFE3806E7@moren.haifa.ibm.com>
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 <abelg@il.ibm.com>
> ---
> 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?
> vmx->nested.current_vmptr = -1ull;
> vmx->nested.current_vmcs12 = NULL;
> }
> @@ -5762,8 +5769,7 @@ static int handle_vmclear(struct kvm_vcp
> }
>
> if (vmptr == vmx->nested.current_vmptr) {
> - kunmap(vmx->nested.current_vmcs12_page);
> - nested_release_page(vmx->nested.current_vmcs12_page);
> + nested_release_vmcs12(vmx);
> vmx->nested.current_vmptr = -1ull;
> vmx->nested.current_vmcs12 = NULL;
> }
> @@ -6045,10 +6051,8 @@ static int handle_vmptrld(struct kvm_vcp
> skip_emulated_instruction(vcpu);
> return 1;
> }
> - if (vmx->nested.current_vmptr != -1ull) {
> - kunmap(vmx->nested.current_vmcs12_page);
> - nested_release_page(vmx->nested.current_vmcs12_page);
> - }
> + if (vmx->nested.current_vmptr != -1ull)
> + nested_release_vmcs12(vmx);
>
> vmx->nested.current_vmptr = vmptr;
> vmx->nested.current_vmcs12 = new_vmcs12;
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Gleb.
next prev parent reply other threads:[~2013-04-18 9:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-18 8:34 [PATCH 0/11] KVM: nVMX: shadow VMCS support, v4 Abel Gordon
2013-04-18 8:34 ` [PATCH 01/11] KVM: nVMX: Shadow-vmcs control fields/bits Abel Gordon
2013-04-18 8:35 ` [PATCH 02/11] KVM: nVMX: Detect shadow-vmcs capability Abel Gordon
2013-04-18 8:35 ` [PATCH 03/11] KVM: nVMX: Introduce vmread and vmwrite bitmaps Abel Gordon
2013-04-18 8:36 ` [PATCH 04/11] KVM: nVMX: Refactor handle_vmwrite Abel Gordon
2013-04-18 8:36 ` [PATCH 05/11] KVM: nVMX: Fix VMXON emulation Abel Gordon
2013-04-18 8:37 ` [PATCH 06/11] KVM: nVMX: Allocate shadow vmcs Abel Gordon
2013-04-18 8:37 ` [PATCH 07/11] KVM: nVMX: Release " Abel Gordon
2013-04-18 9:12 ` Gleb Natapov [this message]
2013-04-18 10:16 ` Abel Gordon
2013-04-18 10:18 ` Gleb Natapov
2013-04-18 8:38 ` [PATCH 08/11] KVM: nVMX: Copy processor-specific shadow-vmcs to VMCS12 Abel Gordon
2013-04-18 8:38 ` [PATCH 09/11] KVM: nVMX: Copy VMCS12 to processor-specific shadow vmcs Abel Gordon
2013-04-18 8:39 ` [PATCH 10/11] KVM: nVMX: Synchronize VMCS12 content with the " Abel Gordon
2013-04-18 8:40 ` [PATCH 11/11] KVM: nVMX: Enable and disable shadow vmcs functionality Abel Gordon
-- strict thread matches above, loose matches on Subject: below --
2013-04-18 11:34 [PATCH 0/11] KVM: nVMX: shadow VMCS support, v5 Abel Gordon
2013-04-18 11:37 ` [PATCH 07/11] KVM: nVMX: Release shadow vmcs Abel Gordon
2013-03-10 16:03 [PATCH 0/11] KVM: nVMX: shadow VMCS support, v1 Abel Gordon
2013-03-10 16:06 ` [PATCH 07/11] KVM: nVMX: Release shadow vmcs Abel Gordon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130418091218.GP8997@redhat.com \
--to=gleb@redhat.com \
--cc=abelg@il.ibm.com \
--cc=dongxiao.xu@intel.com \
--cc=jun.nakajima@intel.com \
--cc=kvm@vger.kernel.org \
--cc=nadav@harel.org.il \
--cc=owasserm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.