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

[Xen-changelog] [xen-unstable] x86: Allow guests to allocate up to 2MB (superpage) memory extents.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1245157455 -3600
# Node ID 2d68d518038b70bdb1cdb3eb078f1d394dd08437
# Parent  67a0ffade665e23c784613e7f34c6ac07867bb02
x86: Allow guests to allocate up to 2MB (superpage) memory extents.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
---
 xen/common/memory.c          |   12 ++++++------
 xen/include/asm-ia64/iocap.h |    5 +++++
 xen/include/asm-x86/iocap.h  |    5 +++++
 xen/include/xen/iocap.h      |    4 ----
 4 files changed, 16 insertions(+), 10 deletions(-)

diff -r 67a0ffade665 -r 2d68d518038b xen/common/memory.c
--- a/xen/common/memory.c       Tue Jun 16 13:57:18 2009 +0100
+++ b/xen/common/memory.c       Tue Jun 16 14:04:15 2009 +0100
@@ -50,8 +50,7 @@ static void increase_reservation(struct 
                                      a->nr_extents-1) )
         return;
 
-    if ( (a->extent_order != 0) &&
-         !multipage_allocation_permitted(current->domain) )
+    if ( !multipage_allocation_permitted(current->domain, a->extent_order) )
         return;
 
     for ( i = a->nr_done; i < a->nr_extents; i++ )
@@ -96,8 +95,7 @@ static void populate_physmap(struct memo
                                      a->nr_extents-1) )
         return;
 
-    if ( (a->extent_order != 0) &&
-         !multipage_allocation_permitted(current->domain) )
+    if ( !multipage_allocation_permitted(current->domain, a->extent_order) )
         return;
 
     for ( i = a->nr_done; i < a->nr_extents; i++ )
@@ -247,8 +245,10 @@ static long memory_exchange(XEN_GUEST_HA
     }
 
     /* Only privileged guests can allocate multi-page contiguous extents. */
-    if ( ((exch.in.extent_order != 0) || (exch.out.extent_order != 0)) &&
-         !multipage_allocation_permitted(current->domain) )
+    if ( !multipage_allocation_permitted(current->domain,
+                                         exch.in.extent_order) ||
+         !multipage_allocation_permitted(current->domain,
+                                         exch.out.extent_order) )
     {
         rc = -EPERM;
         goto fail_early;
diff -r 67a0ffade665 -r 2d68d518038b xen/include/asm-ia64/iocap.h
--- a/xen/include/asm-ia64/iocap.h      Tue Jun 16 13:57:18 2009 +0100
+++ b/xen/include/asm-ia64/iocap.h      Tue Jun 16 14:04:15 2009 +0100
@@ -15,4 +15,9 @@ extern int ioports_deny_access(struct do
 #define ioports_access_permitted(d, s, e)               \
     rangeset_contains_range((d)->arch.ioport_caps, s, e)
 
+#define multipage_allocation_permitted(d, order)        \
+    (((order) == 0) ||                                  \
+     !rangeset_is_empty((d)->iomem_caps) ||             \
+     !rangeset_is_empty((d)->arch.ioport_caps))
+
 #endif /* __IA64_IOCAP_H__ */
diff -r 67a0ffade665 -r 2d68d518038b xen/include/asm-x86/iocap.h
--- a/xen/include/asm-x86/iocap.h       Tue Jun 16 13:57:18 2009 +0100
+++ b/xen/include/asm-x86/iocap.h       Tue Jun 16 14:04:15 2009 +0100
@@ -18,4 +18,9 @@
     (!rangeset_is_empty((d)->iomem_caps) ||             \
      !rangeset_is_empty((d)->arch.ioport_caps))
 
+#define multipage_allocation_permitted(d, order)        \
+    (((order) <= 9) || /* allow 2MB superpages */       \
+     !rangeset_is_empty((d)->iomem_caps) ||             \
+     !rangeset_is_empty((d)->arch.ioport_caps))
+
 #endif /* __X86_IOCAP_H__ */
diff -r 67a0ffade665 -r 2d68d518038b xen/include/xen/iocap.h
--- a/xen/include/xen/iocap.h   Tue Jun 16 13:57:18 2009 +0100
+++ b/xen/include/xen/iocap.h   Tue Jun 16 14:04:15 2009 +0100
@@ -28,8 +28,4 @@
 #define irq_access_permitted(d, i)                      \
     rangeset_contains_singleton((d)->irq_caps, i)
 
-#define multipage_allocation_permitted(d)               \
-    (!rangeset_is_empty((d)->iomem_caps) ||             \
-     !rangeset_is_empty((d)->arch.ioport_caps))
-
 #endif /* __XEN_IOCAP_H__ */

_______________________________________________
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®.