aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_dom_x86.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-03-19 10:04:15 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-03-19 10:04:15 +0000
commitd046c2261f88fd7dd5eb274f2847eb66f0dae1c9 (patch)
treee48914d89a27b363ab1632307d354ecab7ad949b /tools/libxc/xc_dom_x86.c
parent4b031bb5b7bc277a85521eaf4c11adde5dce719f (diff)
downloadxen-d046c2261f88fd7dd5eb274f2847eb66f0dae1c9.tar.gz
xen-d046c2261f88fd7dd5eb274f2847eb66f0dae1c9.tar.bz2
xen-d046c2261f88fd7dd5eb274f2847eb66f0dae1c9.zip
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>
Diffstat (limited to 'tools/libxc/xc_dom_x86.c')
-rw-r--r--tools/libxc/xc_dom_x86.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c
index 9306636ba8..6ae9487656 100644
--- a/tools/libxc/xc_dom_x86.c
+++ b/tools/libxc/xc_dom_x86.c
@@ -694,7 +694,7 @@ static int x86_shadow(int xc, domid_t domid)
int arch_setup_meminit(struct xc_dom_image *dom)
{
int rc;
- xen_pfn_t pfn;
+ xen_pfn_t pfn, allocsz, i;
rc = x86_compat(dom->guest_xc, dom->guest_domid, dom->guest_type);
if ( rc )
@@ -713,9 +713,15 @@ int arch_setup_meminit(struct xc_dom_image *dom)
dom->p2m_host[pfn] = pfn;
/* allocate guest memory */
- rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid,
- dom->total_pages, 0, 0,
- dom->p2m_host);
+ 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]);
+ }
+
return rc;
}