direct-io.hg

changeset 6682:12ff9c954ace

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@xensource.com
author iap10@freefall.cl.cam.ac.uk
date Thu Sep 08 01:07:15 2005 +0000 (2005-09-08)
parents 006efe128837
children c2705e74efba
files tools/libxc/xc_domain.c tools/libxc/xc_linux_build.c tools/libxc/xc_linux_restore.c tools/libxc/xenctrl.h tools/python/xen/lowlevel/xc/xc.c tools/python/xen/xend/image.py xen/common/memory.c
line diff
     1.1 --- a/tools/libxc/xc_domain.c	Thu Sep 08 01:00:04 2005 +0000
     1.2 +++ b/tools/libxc/xc_domain.c	Thu Sep 08 01:07:15 2005 +0000
     1.3 @@ -262,13 +262,16 @@ int xc_domain_setmaxmem(int xc_handle,
     1.4  
     1.5  int xc_domain_memory_increase_reservation(int xc_handle,
     1.6                                            u32 domid, 
     1.7 -                                          unsigned int mem_kb)
     1.8 +                                          unsigned long mem_kb,
     1.9 +                                          unsigned int extent_order,
    1.10 +                                          unsigned int address_bits)
    1.11  {
    1.12      int err;
    1.13      unsigned int npages = mem_kb / (PAGE_SIZE/1024);
    1.14      struct xen_memory_reservation reservation = {
    1.15          .nr_extents   = npages,
    1.16 -        .extent_order = 0,
    1.17 +        .extent_order = extent_order,
    1.18 +        .address_bits = address_bits,
    1.19          .domid        = domid
    1.20      };
    1.21  
    1.22 @@ -277,6 +280,8 @@ int xc_domain_memory_increase_reservatio
    1.23          return 0;
    1.24  
    1.25      if (err > 0) {
    1.26 +        fprintf(stderr,"Failed alocation for dom %d : %d pages order %d addr_bits %d\n",
    1.27 +                                 domid, npages, extent_order, address_bits);
    1.28          errno = ENOMEM;
    1.29          err = -1;
    1.30      }
     2.1 --- a/tools/libxc/xc_linux_build.c	Thu Sep 08 01:00:04 2005 +0000
     2.2 +++ b/tools/libxc/xc_linux_build.c	Thu Sep 08 01:07:15 2005 +0000
     2.3 @@ -270,6 +270,11 @@ static int setup_pg_tables_64(int xc_han
     2.4  }
     2.5  #endif
     2.6  
     2.7 +static int compare (const void * a, const void * b)
     2.8 +{
     2.9 +  return ( *(long*)a - *(long*)b );
    2.10 +}
    2.11 +
    2.12  #ifdef __ia64__
    2.13  #include <asm/fpu.h> /* for FPSR_DEFAULT */
    2.14  static int setup_guest(int xc_handle,
    2.15 @@ -483,6 +488,9 @@ static int setup_guest(int xc_handle,
    2.16          goto error_out;
    2.17      }
    2.18  
    2.19 +    qsort( page_array, nr_pages, sizeof(*page_array), compare );
    2.20 +
    2.21 +
    2.22      (load_funcs.loadimage)(image, image_size, xc_handle, dom, page_array,
    2.23                             &dsi);
    2.24  
     3.1 --- a/tools/libxc/xc_linux_restore.c	Thu Sep 08 01:00:04 2005 +0000
     3.2 +++ b/tools/libxc/xc_linux_restore.c	Thu Sep 08 01:07:15 2005 +0000
     3.3 @@ -149,9 +149,9 @@ int xc_linux_restore(int xc_handle, int 
     3.4      }
     3.5  
     3.6      err = xc_domain_memory_increase_reservation(xc_handle, dom,
     3.7 -                                                nr_pfns * PAGE_SIZE / 1024);
     3.8 +                                                nr_pfns * PAGE_SIZE / 1024, 0, 0); //FIX ME
     3.9      if (err != 0) {
    3.10 -        ERR("Failed to increate reservation by %lx\n", 
    3.11 +        ERR("Failed to increase reservation by %lx\n", 
    3.12              nr_pfns * PAGE_SIZE / 1024); 
    3.13          errno = ENOMEM;
    3.14          goto out;
     4.1 --- a/tools/libxc/xenctrl.h	Thu Sep 08 01:00:04 2005 +0000
     4.2 +++ b/tools/libxc/xenctrl.h	Thu Sep 08 01:07:15 2005 +0000
     4.3 @@ -387,7 +387,9 @@ int xc_domain_setmaxmem(int xc_handle,
     4.4  
     4.5  int xc_domain_memory_increase_reservation(int xc_handle,
     4.6                                            u32 domid, 
     4.7 -                                          unsigned int mem_kb);
     4.8 +                                          unsigned long mem_kb,
     4.9 +                                          unsigned int extent_order,
    4.10 +                                          unsigned int address_bits);
    4.11  
    4.12  typedef dom0_perfc_desc_t xc_perfc_desc_t;
    4.13  /* IMPORTANT: The caller is responsible for mlock()'ing the @desc array. */
     5.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Thu Sep 08 01:00:04 2005 +0000
     5.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Thu Sep 08 01:07:15 2005 +0000
     5.3 @@ -841,14 +841,16 @@ static PyObject *pyxc_domain_memory_incr
     5.4  
     5.5      u32 dom;
     5.6      unsigned long mem_kb;
     5.7 -
     5.8 -    static char *kwd_list[] = { "dom", "mem_kb", NULL };
     5.9 +    unsigned int extent_order = 0 , address_bits = 0;
    5.10  
    5.11 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list, 
    5.12 -                                      &dom, &mem_kb) )
    5.13 +    static char *kwd_list[] = { "dom", "mem_kb", "extent_order", "address_bits", NULL };
    5.14 +
    5.15 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii|ii", kwd_list, 
    5.16 +                                      &dom, &mem_kb, &extent_order, &address_bits) )
    5.17          return NULL;
    5.18  
    5.19 -    if ( xc_domain_memory_increase_reservation(xc->xc_handle, dom, mem_kb) )
    5.20 +    if ( xc_domain_memory_increase_reservation(xc->xc_handle, dom, 
    5.21 +                                     mem_kb, extent_order, address_bits) )
    5.22          return PyErr_SetFromErrno(xc_error);
    5.23      
    5.24      Py_INCREF(zero);
     6.1 --- a/tools/python/xen/xend/image.py	Thu Sep 08 01:00:04 2005 +0000
     6.2 +++ b/tools/python/xen/xend/image.py	Thu Sep 08 01:07:15 2005 +0000
     6.3 @@ -159,7 +159,11 @@ class ImageHandler:
     6.4          xc.domain_setmaxmem(dom, mem_kb)
     6.5  
     6.6          try:
     6.7 -            xc.domain_memory_increase_reservation(dom, mem_kb)
     6.8 +            # Give the domain some memory below 4GB
     6.9 +            lmem_kb = 4096
    6.10 +            xc.domain_memory_increase_reservation(dom, min(lmem_kb,mem_kb), 0, 32)
    6.11 +            if mem_kb > lmem_kb:
    6.12 +                xc.domain_memory_increase_reservation(dom, mem_kb-lmem_kb, 0, 0)
    6.13          except:
    6.14              xc.domain_destroy(dom)
    6.15              raise
     7.1 --- a/xen/common/memory.c	Thu Sep 08 01:00:04 2005 +0000
     7.2 +++ b/xen/common/memory.c	Thu Sep 08 01:07:15 2005 +0000
     7.3 @@ -52,7 +52,7 @@ increase_reservation(
     7.4          if ( unlikely((page = alloc_domheap_pages(
     7.5              d, extent_order, flags)) == NULL) )
     7.6          {
     7.7 -            DPRINTK("Could not allocate a frame\n");
     7.8 +            DPRINTK("Could not allocate a frame id=%d %d flags=%x\n", d->domain_id, extent_order, flags);
     7.9              return i;
    7.10          }
    7.11