nvmx: fix resource relinquish for nested VMX
authorDongxiao Xu <dongxiao.xu@intel.com>
Thu, 30 Aug 2012 16:55:31 +0000 (17:55 +0100)
committerDongxiao Xu <dongxiao.xu@intel.com>
Thu, 30 Aug 2012 16:55:31 +0000 (17:55 +0100)
commita5ba0ff7c7527aa58dce32e6db8c9ee63e1560ca
treec9f7ff4c4f12562075c1439a6640518ffc70a853
parent4eae16a077bb6d30a499efe78170b521e6e5e879
nvmx: fix resource relinquish for nested VMX

The previous order of relinquish resource is:
relinquish_domain_resources() -> vcpu_destroy() ->
nvmx_vcpu_destroy().  However some L1 resources like nv_vvmcx and
io_bitmaps are free in nvmx_vcpu_destroy(), therefore the
relinquish_domain_resources() will not reduce the refcnt of the domain
to 0, therefore the latter vcpu release functions will not be called.

To fix this issue, we need to release the nv_vvmcx and io_bitmaps in
relinquish_domain_resources().

Besides, after destroy the nested vcpu, we need to switch the
vmx->vmcs back to the L1 and let the vcpu_destroy() logic to free the
L1 VMCS page.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
Committed-by: Keir Fraser <keir@xen.org>
xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/vmx/vmx.c
xen/arch/x86/hvm/vmx/vvmx.c
xen/include/asm-x86/hvm/hvm.h
xen/include/asm-x86/hvm/vmx/vvmx.h