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] Give each domain some memory below 4GB. This solves the

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Give each domain some memory below 4GB. This solves the "PGD's must be below 4GB" for the initial page tables. I'm not sure we'll stick with this approach, but this is good enough for the time being.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 08 Sep 2005 01:34:11 +0000
Delivery-date: Thu, 08 Sep 2005 01:32:39 +0000
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/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/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 iap10@xxxxxxxxxxxxxxxxxxxxx
# Node ID 12ff9c954aceb9c84c9e730886d3cd538a6ec56a
# Parent  006efe128837570db5beb25ad19f311c67a4de4c
Give each domain some memory below 4GB. This solves the "PGD's must be below 
4GB" for the initial page tables. I'm not sure we'll stick with this approach, 
but this is good enough for the time being. 

PAE should be a *lot* more robust on systems that actually have more than 4GB 
thanks to all the various patches that went in today. I find it astounding that 
it ever appeared to work at all!

Signed-off-by: ian@xxxxxxxxxxxxx

diff -r 006efe128837 -r 12ff9c954ace tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   Thu Sep  8 01:00:04 2005
+++ b/tools/libxc/xc_domain.c   Thu Sep  8 01:07:15 2005
@@ -262,13 +262,16 @@
 
 int xc_domain_memory_increase_reservation(int xc_handle,
                                           u32 domid, 
-                                          unsigned int mem_kb)
+                                          unsigned long mem_kb,
+                                          unsigned int extent_order,
+                                          unsigned int address_bits)
 {
     int err;
     unsigned int npages = mem_kb / (PAGE_SIZE/1024);
     struct xen_memory_reservation reservation = {
         .nr_extents   = npages,
-        .extent_order = 0,
+        .extent_order = extent_order,
+        .address_bits = address_bits,
         .domid        = domid
     };
 
@@ -277,6 +280,8 @@
         return 0;
 
     if (err > 0) {
+        fprintf(stderr,"Failed alocation for dom %d : %d pages order %d 
addr_bits %d\n",
+                                 domid, npages, extent_order, address_bits);
         errno = ENOMEM;
         err = -1;
     }
diff -r 006efe128837 -r 12ff9c954ace tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c      Thu Sep  8 01:00:04 2005
+++ b/tools/libxc/xc_linux_build.c      Thu Sep  8 01:07:15 2005
@@ -269,6 +269,11 @@
     return -1;
 }
 #endif
+
+static int compare (const void * a, const void * b)
+{
+  return ( *(long*)a - *(long*)b );
+}
 
 #ifdef __ia64__
 #include <asm/fpu.h> /* for FPSR_DEFAULT */
@@ -482,6 +487,9 @@
         PERROR("Could not get the page frame list");
         goto error_out;
     }
+
+    qsort( page_array, nr_pages, sizeof(*page_array), compare );
+
 
     (load_funcs.loadimage)(image, image_size, xc_handle, dom, page_array,
                            &dsi);
diff -r 006efe128837 -r 12ff9c954ace tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c    Thu Sep  8 01:00:04 2005
+++ b/tools/libxc/xc_linux_restore.c    Thu Sep  8 01:07:15 2005
@@ -149,9 +149,9 @@
     }
 
     err = xc_domain_memory_increase_reservation(xc_handle, dom,
-                                                nr_pfns * PAGE_SIZE / 1024);
+                                                nr_pfns * PAGE_SIZE / 1024, 0, 
0); //FIX ME
     if (err != 0) {
-        ERR("Failed to increate reservation by %lx\n", 
+        ERR("Failed to increase reservation by %lx\n", 
             nr_pfns * PAGE_SIZE / 1024); 
         errno = ENOMEM;
         goto out;
diff -r 006efe128837 -r 12ff9c954ace tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Thu Sep  8 01:00:04 2005
+++ b/tools/libxc/xenctrl.h     Thu Sep  8 01:07:15 2005
@@ -387,7 +387,9 @@
 
 int xc_domain_memory_increase_reservation(int xc_handle,
                                           u32 domid, 
-                                          unsigned int mem_kb);
+                                          unsigned long mem_kb,
+                                          unsigned int extent_order,
+                                          unsigned int address_bits);
 
 typedef dom0_perfc_desc_t xc_perfc_desc_t;
 /* IMPORTANT: The caller is responsible for mlock()'ing the @desc array. */
diff -r 006efe128837 -r 12ff9c954ace tools/python/xen/lowlevel/xc/xc.c
--- a/tools/python/xen/lowlevel/xc/xc.c Thu Sep  8 01:00:04 2005
+++ b/tools/python/xen/lowlevel/xc/xc.c Thu Sep  8 01:07:15 2005
@@ -841,14 +841,16 @@
 
     u32 dom;
     unsigned long mem_kb;
-
-    static char *kwd_list[] = { "dom", "mem_kb", NULL };
-
-    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, 
-                                      &dom, &mem_kb) )
-        return NULL;
-
-    if ( xc_domain_memory_increase_reservation(xc->xc_handle, dom, mem_kb) )
+    unsigned int extent_order = 0 , address_bits = 0;
+
+    static char *kwd_list[] = { "dom", "mem_kb", "extent_order", 
"address_bits", NULL };
+
+    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii|ii", kwd_list, 
+                                      &dom, &mem_kb, &extent_order, 
&address_bits) )
+        return NULL;
+
+    if ( xc_domain_memory_increase_reservation(xc->xc_handle, dom, 
+                                     mem_kb, extent_order, address_bits) )
         return PyErr_SetFromErrno(xc_error);
     
     Py_INCREF(zero);
diff -r 006efe128837 -r 12ff9c954ace tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Thu Sep  8 01:00:04 2005
+++ b/tools/python/xen/xend/image.py    Thu Sep  8 01:07:15 2005
@@ -159,7 +159,11 @@
         xc.domain_setmaxmem(dom, mem_kb)
 
         try:
-            xc.domain_memory_increase_reservation(dom, mem_kb)
+            # Give the domain some memory below 4GB
+            lmem_kb = 4096
+            xc.domain_memory_increase_reservation(dom, min(lmem_kb,mem_kb), 0, 
32)
+            if mem_kb > lmem_kb:
+                xc.domain_memory_increase_reservation(dom, mem_kb-lmem_kb, 0, 
0)
         except:
             xc.domain_destroy(dom)
             raise
diff -r 006efe128837 -r 12ff9c954ace xen/common/memory.c
--- a/xen/common/memory.c       Thu Sep  8 01:00:04 2005
+++ b/xen/common/memory.c       Thu Sep  8 01:07:15 2005
@@ -52,7 +52,7 @@
         if ( unlikely((page = alloc_domheap_pages(
             d, extent_order, flags)) == NULL) )
         {
-            DPRINTK("Could not allocate a frame\n");
+            DPRINTK("Could not allocate a frame id=%d %d flags=%x\n", 
d->domain_id, extent_order, flags);
             return i;
         }
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Give each domain some memory below 4GB. This solves the "PGD's must be below 4GB" for the initial page tables. I'm not sure we'll stick with this approach, but this is good enough for the time being., Xen patchbot -unstable <=