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

[Xen-changelog] [xen-unstable] HAP 1GB: Add corner case handling for 1GB super page.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1271925696 -3600
# Node ID 11d20f17f82c1c6fc6c003c363835a964338b311
# Parent  a4489cf8de22418a9ad4376d5fc09a75559efd7b
HAP 1GB: Add corner case handling for 1GB super page.

 - Without the check, guest memory allocation will never reach the
   boundary of a 1GB super page.

Signed-off-by: Dongxiao Xu <dongxiao.xu@xxxxxxxxx>
---
 tools/libxc/xc_hvm_build.c |    8 ++++++++
 1 files changed, 8 insertions(+)

diff -r a4489cf8de22 -r 11d20f17f82c tools/libxc/xc_hvm_build.c
--- a/tools/libxc/xc_hvm_build.c        Thu Apr 22 09:39:58 2010 +0100
+++ b/tools/libxc/xc_hvm_build.c        Thu Apr 22 09:41:36 2010 +0100
@@ -203,6 +203,14 @@ static int setup_guest(int xc_handle,
         if ( count > max_pages )
             count = max_pages;
         
+        /* Take care the corner cases of super page tails */
+        if ( ((cur_pages & (SUPERPAGE_1GB_NR_PFNS-1)) != 0) &&
+             (count > (-cur_pages & (SUPERPAGE_1GB_NR_PFNS-1))) )
+            count = -cur_pages & (SUPERPAGE_1GB_NR_PFNS-1);
+        else if ( ((count & (SUPERPAGE_1GB_NR_PFNS-1)) != 0) &&
+                  (count > SUPERPAGE_1GB_NR_PFNS) )
+            count &= ~(SUPERPAGE_1GB_NR_PFNS - 1);
+
         /* Attemp to allocate 1GB super page. Because in each pass we only
          * allocate at most 1GB, we don't have to clip super page boundaries.
          */

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


 


Rackspace

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