From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kai Huang Subject: [PATCH 08/10] VMX: disable PML in vmx_vcpu_destroy Date: Fri, 27 Mar 2015 10:35:52 +0800 Message-ID: <1427423754-11841-9-git-send-email-kai.huang@linux.intel.com> References: <1427423754-11841-1-git-send-email-kai.huang@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1427423754-11841-1-git-send-email-kai.huang@linux.intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: jbeulich@suse.com, andrew.cooper3@citrix.com, tim@xen.org, kevin.tian@intel.com, yang.z.zhang@intel.com, xen-devel@lists.xen.org Cc: Kai Huang List-Id: xen-devel@lists.xenproject.org It's possible domain still remains in log-dirty mode when it is about to be destroyed, in which case we should manually disable PML for it. Signed-off-by: Kai Huang --- xen/arch/x86/hvm/vmx/vmx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index fce3aa2..75ac44b 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -153,6 +153,15 @@ static int vmx_vcpu_initialise(struct vcpu *v) static void vmx_vcpu_destroy(struct vcpu *v) { + /* + * There are cases that domain still remains in log-dirty mode when it is + * about to be destroyed (ex, user types 'xl destroy '), in which case + * we should disable PML manually here. Note that vmx_vcpu_destroy is called + * prior to vmx_domain_destroy so we need to disable PML for each vcpu + * separately here. + */ + if ( vmx_vcpu_pml_enabled(v) ) + vmx_vcpu_disable_pml(v); vmx_destroy_vmcs(v); vpmu_destroy(v); passive_domain_destroy(v); -- 2.1.0