ia64/xen-unstable

changeset 19395:f0d033f0a319

x86 dom builder: Allocate domU pages in batches.

Allows a 32-bit dom0 to create very large guests.

Signed-off-by: Mukesh Rathor <mukesh.rathor@oracle.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Mar 19 10:04:15 2009 +0000 (2009-03-19)
parents 2039e8271051
children 4b2d8b1c395a
files tools/libxc/xc_dom_x86.c
line diff
     1.1 --- a/tools/libxc/xc_dom_x86.c	Wed Mar 18 17:30:13 2009 +0000
     1.2 +++ b/tools/libxc/xc_dom_x86.c	Thu Mar 19 10:04:15 2009 +0000
     1.3 @@ -694,7 +694,7 @@ static int x86_shadow(int xc, domid_t do
     1.4  int arch_setup_meminit(struct xc_dom_image *dom)
     1.5  {
     1.6      int rc;
     1.7 -    xen_pfn_t pfn;
     1.8 +    xen_pfn_t pfn, allocsz, i;
     1.9  
    1.10      rc = x86_compat(dom->guest_xc, dom->guest_domid, dom->guest_type);
    1.11      if ( rc )
    1.12 @@ -713,9 +713,15 @@ int arch_setup_meminit(struct xc_dom_ima
    1.13          dom->p2m_host[pfn] = pfn;
    1.14  
    1.15      /* allocate guest memory */
    1.16 -    rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
    1.17 -                                           dom->total_pages, 0, 0,
    1.18 -                                           dom->p2m_host);
    1.19 +    for ( i = rc = allocsz = 0; (i < dom->total_pages) && !rc; i += allocsz )
    1.20 +    {
    1.21 +        allocsz = dom->total_pages - i;
    1.22 +        if ( allocsz > 1024*1024 )
    1.23 +            allocsz = 1024*1024;
    1.24 +        rc = xc_domain_memory_populate_physmap(
    1.25 +            dom->guest_xc, dom->guest_domid, allocsz, 0, 0, &dom->p2m_host[i]);
    1.26 +    }
    1.27 +
    1.28      return rc;
    1.29  }
    1.30