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

[Xen-devel] [PATCH] x86/mm: don't override an existing shadow memory all

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] x86/mm: don't override an existing shadow memory allocation
From: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Date: Thu, 18 Nov 2010 13:08:41 +0000
Delivery-date: Thu, 18 Nov 2010 05:09:32 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.20 (2009-06-14)
x86/mm: don't override an existing shadow memory allocation when enabling 
log-dirty shadows on a PV guest.

Signed-off-by: Tim Deegan <Tim.Deegan@xxxxxxxxxx>

diff -r 9f1257be88ad xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c   Thu Nov 18 12:42:07 2010 +0000
+++ b/xen/arch/x86/mm/shadow/common.c   Thu Nov 18 12:45:44 2010 +0000
@@ -3328,11 +3328,10 @@ static int shadow_one_bit_enable(struct 
 
     mode |= PG_SH_enable;
 
-    if ( d->arch.paging.mode == 0 )
+    if ( d->arch.paging.shadow.total_pages == 0 )
     {
-        /* Init the shadow memory allocation and the hash table */
-        if ( sh_set_allocation(d, 1, NULL) != 0 
-             || shadow_hash_alloc(d) != 0 )
+        /* Init the shadow memory allocation if the user hasn't done so */
+        if ( sh_set_allocation(d, 1, NULL) != 0 )
         {
             sh_set_allocation(d, 0, NULL);
             return -ENOMEM;
@@ -3343,6 +3342,13 @@ static int shadow_one_bit_enable(struct 
         d->arch.paging.free_page = shadow_free_p2m_page;
     }
 
+    if ( d->arch.paging.mode == 0 )
+    {
+        /* Init the shadow hash table */
+        if ( shadow_hash_alloc(d) != 0 )
+            return -ENOMEM;
+    }
+
     /* Update the bits */
     sh_new_mode(d, d->arch.paging.mode | mode);
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] x86/mm: don't override an existing shadow memory allocation, Tim Deegan <=