From: "Jiang, Yunhong" Subject: RE: [PATCH][VT] Patch to allow VMX domainsto be destroyedor shut down cleanly Date: Tue, 20 Sep 2005 16:51:19 +0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Return-path: Content-class: urn:content-classes:message List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: Khoa Huynh , xen-devel@lists.xensource.com, xen-devel-bounces@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Hi, Keir Do you mean a patch like this? Thanks Yunhong Jiang --- a/xen/arch/x86/vmx.c Mon Sep 19 13:24:31 2005 +++ b/xen/arch/x86/vmx.c Tue Sep 20 16:47:34 2005 @@ -1100,6 +1100,10 @@ d->arch.arch_vmx.cpu_cr3, mfn); } + if(!((value & X86_CR0_PE) && (value & X86_CR0_PG)) && = paging_enabled) + if(d->arch.arch_vmx.cpu_cr3) + put_page(pfn_to_page(get_mfn_from_pfn( + d->arch.arch_vmx.cpu_cr3 >> PAGE_SHIFT))); /* * VMX does not implement real-mode virtualization. We emulate * real-mode by performing a world switch to VMXAssist whenever Keir Fraser wrote: > On 19 Sep 2005, at 11:52, Jiang, Yunhong wrote: >=20 >>> I think it's more correct to do get/put in vmx_set_cr0 (at that >>> point we can know what format the pagetables should be, for example >>> (32/32p/64). But I think it's a bigger cleanup patch. >>=20 >> Do you mean put all get/put on vmx_set_cr0 ? even for paging enabled >> case? >=20 > No, I mean that get/put on cr3 change (or guest destruction) should be > gated on CR0_PG. Then, additionally, get or put is required when > CR0_PG is toggled. >=20 >> And there is one more issue .If the guest is destroyed before the >> kernel enabling paging, how about the page pointed by cr3? It may >> cause one referece count left. The reason is, currently when destroy >> domain, only domain->guest_table is released. However, if the paging >> is not enabled, then the get_page on vmx_set_cr0 has no corresponding >> put_page, which may cause problem. Hope comments on this point. >=20 > Doing what I describe above would fix this: CR0_PG would be clear, so > put_page() would not happen. >=20 >>>=20 >>> Whatever you go for: please send a complete tested patch. :-) >>=20 >> Sure=A3=A1 >=20 > Thanks! >=20 > -- Keir