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

[Xen-changelog] [xen-unstable] libxenguest: Revert domain builder interface changes for 'superpages'



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1248101150 -3600
# Node ID 5333e6497af69f98a11c4c4c3bd9d9d473f3c6d5
# Parent  6d41644623de6d8f1bab853031a72e23f53d94b2
libxenguest: Revert domain builder interface changes for 'superpages'
parameter, and place the flag in a pad byte of 'struct xc_dom_image'
instead.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 tools/libxc/xc_dom.h              |    5 ++--
 tools/libxc/xc_dom_boot.c         |    4 +--
 tools/libxc/xc_dom_compat_linux.c |   22 ++++++++----------
 tools/libxc/xc_dom_ia64.c         |    2 -
 tools/libxc/xc_dom_x86.c          |   45 ++++++++++++++++++--------------------
 tools/libxc/xenguest.h            |   11 ++-------
 tools/python/xen/lowlevel/xc/xc.c |    4 ++-
 7 files changed, 44 insertions(+), 49 deletions(-)

diff -r 6d41644623de -r 5333e6497af6 tools/libxc/xc_dom.h
--- a/tools/libxc/xc_dom.h      Mon Jul 20 10:58:06 2009 +0100
+++ b/tools/libxc/xc_dom.h      Mon Jul 20 15:45:50 2009 +0100
@@ -96,6 +96,7 @@ struct xc_dom_image {
     int guest_xc;
     domid_t guest_domid;
     int8_t vhpt_size_log2; /* for IA64 */
+    int8_t superpages;
     int shadow_enabled;
 
     int xen_version;
@@ -174,7 +175,7 @@ int xc_dom_update_guest_p2m(struct xc_do
 int xc_dom_update_guest_p2m(struct xc_dom_image *dom);
 
 int xc_dom_boot_xen_init(struct xc_dom_image *dom, int xc, domid_t domid);
-int xc_dom_boot_mem_init(struct xc_dom_image *dom, int superpages);
+int xc_dom_boot_mem_init(struct xc_dom_image *dom);
 void *xc_dom_boot_domU_map(struct xc_dom_image *dom, xen_pfn_t pfn,
                            xen_pfn_t count);
 int xc_dom_boot_image(struct xc_dom_image *dom);
@@ -260,7 +261,7 @@ static inline xen_pfn_t xc_dom_p2m_guest
 
 /* --- arch bits --------------------------------------------------- */
 
-int arch_setup_meminit(struct xc_dom_image *dom, int superpages);
+int arch_setup_meminit(struct xc_dom_image *dom);
 int arch_setup_bootearly(struct xc_dom_image *dom);
 int arch_setup_bootlate(struct xc_dom_image *dom);
 
diff -r 6d41644623de -r 5333e6497af6 tools/libxc/xc_dom_boot.c
--- a/tools/libxc/xc_dom_boot.c Mon Jul 20 10:58:06 2009 +0100
+++ b/tools/libxc/xc_dom_boot.c Mon Jul 20 15:45:50 2009 +0100
@@ -129,13 +129,13 @@ int xc_dom_boot_xen_init(struct xc_dom_i
     return 0;
 }
 
-int xc_dom_boot_mem_init(struct xc_dom_image *dom, int superpages)
+int xc_dom_boot_mem_init(struct xc_dom_image *dom)
 {
     long rc;
 
     xc_dom_printf("%s: called\n", __FUNCTION__);
 
-    rc = arch_setup_meminit(dom, superpages);
+    rc = arch_setup_meminit(dom);
     if ( rc != 0 )
     {
         xc_dom_panic(XC_OUT_OF_MEMORY,
diff -r 6d41644623de -r 5333e6497af6 tools/libxc/xc_dom_compat_linux.c
--- a/tools/libxc/xc_dom_compat_linux.c Mon Jul 20 10:58:06 2009 +0100
+++ b/tools/libxc/xc_dom_compat_linux.c Mon Jul 20 15:45:50 2009 +0100
@@ -28,8 +28,7 @@ static int xc_linux_build_internal(struc
                                    unsigned int store_evtchn,
                                    unsigned long *store_mfn,
                                    unsigned int console_evtchn,
-                                   unsigned long *console_mfn,
-                                                          int superpages)
+                                   unsigned long *console_mfn)
 {
     int rc;
 
@@ -43,7 +42,7 @@ static int xc_linux_build_internal(struc
         goto out;
     if ( (rc = xc_dom_mem_init(dom, mem_mb)) != 0 )
         goto out;
-    if ( (rc = xc_dom_boot_mem_init(dom, superpages)) != 0 )
+    if ( (rc = xc_dom_boot_mem_init(dom)) != 0 )
         goto out;
     if ( (rc = xc_dom_build_image(dom)) != 0 )
         goto out;
@@ -68,8 +67,8 @@ int xc_linux_build_mem(int xc_handle, ui
                        unsigned long flags,
                        unsigned int store_evtchn,
                        unsigned long *store_mfn,
-                       unsigned int console_evtchn, unsigned long *console_mfn,
-                       int superpages)
+                       unsigned int console_evtchn,
+                       unsigned long *console_mfn)
 {
     struct xc_dom_image *dom;
     int rc;
@@ -84,7 +83,7 @@ int xc_linux_build_mem(int xc_handle, ui
     rc = xc_linux_build_internal(dom, xc_handle, domid,
                                  mem_mb, flags,
                                  store_evtchn, store_mfn,
-                                 console_evtchn, console_mfn, superpages);
+                                 console_evtchn, console_mfn);
 
  out:
     xc_dom_release(dom);
@@ -100,8 +99,8 @@ int xc_linux_build(int xc_handle, uint32
                    unsigned long flags,
                    unsigned int store_evtchn,
                    unsigned long *store_mfn,
-                   unsigned int console_evtchn, unsigned long *console_mfn,
-                   int superpages)
+                   unsigned int console_evtchn,
+                   unsigned long *console_mfn)
 {
     struct xc_dom_image *dom;
     int rc;
@@ -117,7 +116,7 @@ int xc_linux_build(int xc_handle, uint32
     rc = xc_linux_build_internal(dom, xc_handle, domid,
                                  mem_mb, flags,
                                  store_evtchn, store_mfn,
-                                 console_evtchn, console_mfn, superpages);
+                                 console_evtchn, console_mfn);
 
  out:
     xc_dom_release(dom);
@@ -133,8 +132,7 @@ int xc_dom_linux_build(int xc_handle,
                        unsigned long flags,
                        unsigned int store_evtchn,
                        unsigned long *store_mfn,
-                       unsigned int console_evtchn, unsigned long *console_mfn,
-                       int superpages)
+                       unsigned int console_evtchn, unsigned long *console_mfn)
 {
     int rc;
 
@@ -147,7 +145,7 @@ int xc_dom_linux_build(int xc_handle,
     return xc_linux_build_internal(dom, xc_handle, domid,
                                    mem_mb, flags,
                                    store_evtchn, store_mfn,
-                                   console_evtchn, console_mfn, superpages);
+                                   console_evtchn, console_mfn);
 }
 
 /*
diff -r 6d41644623de -r 5333e6497af6 tools/libxc/xc_dom_ia64.c
--- a/tools/libxc/xc_dom_ia64.c Mon Jul 20 10:58:06 2009 +0100
+++ b/tools/libxc/xc_dom_ia64.c Mon Jul 20 15:45:50 2009 +0100
@@ -149,7 +149,7 @@ static void __init register_arch_hooks(v
 
 #include "xc_efi.h"
 
-int arch_setup_meminit(struct xc_dom_image *dom, int superpages)
+int arch_setup_meminit(struct xc_dom_image *dom)
 {
     xen_pfn_t pfn;
     int rc;
diff -r 6d41644623de -r 5333e6497af6 tools/libxc/xc_dom_x86.c
--- a/tools/libxc/xc_dom_x86.c  Mon Jul 20 10:58:06 2009 +0100
+++ b/tools/libxc/xc_dom_x86.c  Mon Jul 20 15:45:50 2009 +0100
@@ -694,10 +694,10 @@ static int x86_shadow(int xc, domid_t do
     return rc;
 }
 
-int arch_setup_meminit(struct xc_dom_image *dom, int superpages)
+int arch_setup_meminit(struct xc_dom_image *dom)
 {
     int rc;
-    xen_pfn_t pfn, allocsz, i;
+    xen_pfn_t pfn, allocsz, i, j, mfn;
 
     rc = x86_compat(dom->guest_xc, dom->guest_domid, dom->guest_type);
     if ( rc )
@@ -711,47 +711,46 @@ int arch_setup_meminit(struct xc_dom_ima
     }
 
     dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * dom->total_pages);
-    if (superpages)
+    if ( dom->superpages )
     {
         int count = dom->total_pages >> SUPERPAGE_PFN_SHIFT;
         xen_pfn_t extents[count];
 
         xc_dom_printf("Populating memory with %d superpages\n", count);
-        for (pfn = 0; pfn < count; pfn++)
+        for ( pfn = 0; pfn < count; pfn++ )
             extents[pfn] = pfn << SUPERPAGE_PFN_SHIFT;
         rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
                                                count, SUPERPAGE_PFN_SHIFT, 0,
                                                extents);
-        if (!rc)
-        {
-            int i, j;
-            xen_pfn_t mfn;
-
-            /* Expand the returned mfn into the p2m array */
-            pfn = 0;
-            for (i = 0; i < count; i++)
-            {
-                mfn = extents[i];
-                for (j = 0; j < SUPERPAGE_NR_PFNS; j++, pfn++)
-                {
-                    dom->p2m_host[pfn] = mfn + j;
-                }
-            }
-        }
-    } else
+        if ( rc )
+            return rc;
+
+        /* Expand the returned mfn into the p2m array */
+        pfn = 0;
+        for ( i = 0; i < count; i++ )
+        {
+            mfn = extents[i];
+            for ( j = 0; j < SUPERPAGE_NR_PFNS; j++, pfn++ )
+                dom->p2m_host[pfn] = mfn + j;
+        }
+    }
+    else
     {
         /* setup initial p2m */
         for ( pfn = 0; pfn < dom->total_pages; pfn++ )
             dom->p2m_host[pfn] = pfn;
         
         /* allocate guest memory */
-        for ( i = rc = allocsz = 0; (i < dom->total_pages) && !rc; i += 
allocsz )
+        for ( i = rc = allocsz = 0;
+              (i < dom->total_pages) && !rc;
+              i += allocsz )
         {
             allocsz = dom->total_pages - i;
             if ( allocsz > 1024*1024 )
                 allocsz = 1024*1024;
             rc = xc_domain_memory_populate_physmap(
-                dom->guest_xc, dom->guest_domid, allocsz, 0, 0, 
&dom->p2m_host[i]);
+                dom->guest_xc, dom->guest_domid, allocsz,
+                0, 0, &dom->p2m_host[i]);
         }
     }
 
diff -r 6d41644623de -r 5333e6497af6 tools/libxc/xenguest.h
--- a/tools/libxc/xenguest.h    Mon Jul 20 10:58:06 2009 +0100
+++ b/tools/libxc/xenguest.h    Mon Jul 20 15:45:50 2009 +0100
@@ -63,7 +63,6 @@ int xc_domain_restore(int xc_handle, int
  * @parm store_mfn returned with the mfn of the store page
  * @parm console_evtchn the console event channel for this domain to use
  * @parm conole_mfn returned with the mfn of the console page
- * @parm superpages populate memory in guest with superpages
  * @return 0 on success, -1 on failure
  */
 int xc_linux_build(int xc_handle,
@@ -77,8 +76,7 @@ int xc_linux_build(int xc_handle,
                    unsigned int store_evtchn,
                    unsigned long *store_mfn,
                    unsigned int console_evtchn,
-                   unsigned long *console_mfn,
-                  int superpages);
+                   unsigned long *console_mfn);
 
 /** The same interface, but the dom structure is managed by the caller */
 struct xc_dom_image;
@@ -92,8 +90,7 @@ int xc_dom_linux_build(int xc_handle,
                       unsigned int store_evtchn,
                       unsigned long *store_mfn,
                       unsigned int console_evtchn,
-                      unsigned long *console_mfn,
-                       int superpages);
+                      unsigned long *console_mfn);
 
 /**
  * This function will create a domain for a paravirtualized Linux
@@ -112,7 +109,6 @@ int xc_dom_linux_build(int xc_handle,
  * @parm store_mfn returned with the mfn of the store page
  * @parm console_evtchn the console event channel for this domain to use
  * @parm conole_mfn returned with the mfn of the console page
- * @parm superpages populate memory in guest with superpages
  * @return 0 on success, -1 on failure
  */
 int xc_linux_build_mem(int xc_handle,
@@ -128,8 +124,7 @@ int xc_linux_build_mem(int xc_handle,
                        unsigned int store_evtchn,
                        unsigned long *store_mfn,
                        unsigned int console_evtchn,
-                       unsigned long *console_mfn,
-                       int superpages);
+                       unsigned long *console_mfn);
 
 int xc_hvm_build(int xc_handle,
                  uint32_t domid,
diff -r 6d41644623de -r 5333e6497af6 tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Mon Jul 20 10:58:06 2009 +0100
+++ b/tools/python/xen/lowlevel/xc/xc.c Mon Jul 20 15:45:50 2009 +0100
@@ -436,9 +436,11 @@ static PyObject *pyxc_linux_build(XcObje
     /* for IA64 */
     dom->vhpt_size_log2 = vhpt;
 
+    dom->superpages = superpages;
+
     if ( xc_dom_linux_build(self->xc_handle, dom, domid, mem_mb, image,
                             ramdisk, flags, store_evtchn, &store_mfn,
-                            console_evtchn, &console_mfn, superpages) != 0 ) {
+                            console_evtchn, &console_mfn) != 0 ) {
         goto out;
     }
 

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