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-changelog

[Xen-changelog] [xen-unstable] Check m2p/compat m2p table for new added

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Check m2p/compat m2p table for new added memory.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 Dec 2009 03:05:19 -0800
Delivery-date: Mon, 21 Dec 2009 03:05:51 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1261392481 0
# Node ID 2a48c1b68d51edc3ec46e3fd659068f9aafc3560
# Parent  261e985e8c492f1dc130093cb819bb4f2b270032
Check m2p/compat m2p table for new added memory.

As we allocate m2p/compat m2p/frametable page tables from new added
memory, we want to make sure the new range can hold up the new page
tables, this is because m2p/frametable need be aligned and cover more
than the new-added range.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@xxxxxxxxx>
---
 xen/arch/x86/x86_64/mm.c |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletion(-)

diff -r 261e985e8c49 -r 2a48c1b68d51 xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c  Mon Dec 21 10:47:34 2009 +0000
+++ b/xen/arch/x86/x86_64/mm.c  Mon Dec 21 10:48:01 2009 +0000
@@ -1332,6 +1332,8 @@ int transfer_pages_to_heap(struct mem_ho
 
 int mem_hotadd_check(unsigned long spfn, unsigned long epfn)
 {
+    unsigned long s, e, length;
+
     if ( (spfn >= epfn) || (spfn < max_page) )
         return 0;
 
@@ -1341,7 +1343,31 @@ int mem_hotadd_check(unsigned long spfn,
     if ( (spfn | epfn) & pfn_hole_mask )
         return 0;
 
-    /* TBD: Need make sure cover to m2p/ft page table */
+    /* Caculate at most required m2p/compat m2p/frametable pages */
+    s = (spfn & ~((1UL << (L2_PAGETABLE_SHIFT - 3)) - 1));
+    e = (epfn + (1UL << (L2_PAGETABLE_SHIFT - 3)) - 1) &
+            ~((1UL << (L2_PAGETABLE_SHIFT - 3)) - 1);
+
+    length = (e - s) * sizeof(unsigned long);
+
+    s = (spfn & ~((1UL << (L2_PAGETABLE_SHIFT - 2)) - 1));
+    e = (epfn + (1UL << (L2_PAGETABLE_SHIFT - 2)) - 1) &
+            ~((1UL << (L2_PAGETABLE_SHIFT - 2)) - 1);
+
+    e = min_t(unsigned long, e,
+            (RDWR_COMPAT_MPT_VIRT_END - RDWR_COMPAT_MPT_VIRT_START) >> 2);
+
+    if ( e > s )
+        length += (e -s) * sizeof(unsigned int);
+
+    s = pfn_to_pdx(spfn) & ~(PDX_GROUP_COUNT - 1);
+    e = ( pfn_to_pdx(epfn) + (PDX_GROUP_COUNT - 1) ) & ~(PDX_GROUP_COUNT - 1);
+
+    length += (e - s) * sizeof(struct page_info);
+
+    if ((length >> PAGE_SHIFT) > (epfn - spfn))
+        return 0;
+
     return 1;
 }
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Check m2p/compat m2p table for new added memory., Xen patchbot-unstable <=