WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] 15142:78389dbb08bb and domain state
From: John Levon <levon@xxxxxxxxxxxxxxxxx>
Date: Mon, 19 Nov 2007 10:19:20 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx, jbeulich@xxxxxxxxxx
Delivery-date: Mon, 19 Nov 2007 02:20:09 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <C3628E62.1886C%Keir.Fraser@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20071109160631.GA3320@xxxxxxxxxxxxxxxxxxxxxxx> <C3628E62.1886C%Keir.Fraser@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
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