[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] 15142:78389dbb08bb and domain state



On Fri, Nov 16, 2007 at 12:01:38AM +0000, Keir Fraser wrote:

> Reference counting for l4 pagetable entries happens in
> get_page_from_l4e(),

The circular reference was a red herring - I was looking at Xen's own
mapping in its private PTEs (d'oh).

However, I did notice that we leak a ref count per VCPU, which gave me a
big clue. Changeset 13302:7c5eea5feebd from Jan added this code:

+#ifdef __x86_64__
+            if ( pfn == pagetable_get_pfn(v->arch.guest_table_user) )
+                v->arch.guest_table_user = pagetable_null();
+#endif

Presumably for the benefit of compat guests where this is always true.

However, it can be true on native Solaris guests too - when we switch
to the kernel L4 we also load it into _USER_BASEPTR.

The patch below fixes it for me (though I'm not positive it's correct).
Assuming this or something like it is the right thing, that will still
leave the 'xm list' problem, which I see with both Solaris and Linux
domU's. Still looking at that.

cheers,
john

# HG changeset patch
# User john.levon@xxxxxxx
# Date 1195467196 28800
# Node ID b972585a05838dc3a622438299572423a7a8de8d
# Parent  00c6696dcc8b17cd9ea2325f260899e489e262e0
Fix VCPU pagetable cleanup

Solaris can have the same PT in guest_table and guest_table_user without
it being a compat domain. Be more careful when cleaning up.

Signed-off-by: John Levon <john.levon@xxxxxxx>

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1625,7 +1625,8 @@ static void vcpu_destroy_pagetables(stru
         else
             put_page_and_type(mfn_to_page(pfn));
 #ifdef __x86_64__
-        if ( pfn == pagetable_get_pfn(v->arch.guest_table_user) )
+        if ( is_pv_32on64_vcpu(v) &&
+            pfn == pagetable_get_pfn(v->arch.guest_table_user) )
             v->arch.guest_table_user = pagetable_null();
 #endif
         v->arch.guest_table = pagetable_null();

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.