aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_dom_x86.c
diff options
context:
space:
mode:
authorDan Magenheimer <dan.magenheimer@oracle.com>2013-02-25 15:19:14 -0500
committerIan Jackson <Ian.Jackson@eu.citrix.com>2013-04-16 16:21:50 +0100
commitfc67e9dc0c1fe0cebbc2d77fae5aa721e7089615 (patch)
treec2cec935ac2fc27724fa14bb8045bd1b4ebafbb5 /tools/libxc/xc_dom_x86.c
parent749bc93f7a1ad47640cc7876d27641e98a08bf61 (diff)
downloadxen-fc67e9dc0c1fe0cebbc2d77fae5aa721e7089615.tar.gz
xen-fc67e9dc0c1fe0cebbc2d77fae5aa721e7089615.tar.bz2
xen-fc67e9dc0c1fe0cebbc2d77fae5aa721e7089615.zip
xc: use XENMEM_claim_pages hypercall during guest creation.
We add an extra parameter to the structures passed to the PV routine (arch_setup_meminit) and HVM routine (setup_guest) that determines whether the claim hypercall is to be done. The contents of the 'claim_enabled' is defined as an 'int' in case the hypercall expands in the future with extra flags (for example for per-NUMA allocation). For right now the proper values are: 0 to disable it or 1 to enable it. If the hypervisor does not support this function, the xc_domain_claim_pages and xc_domain_get_outstanding_pages will silently return 0 (and set errno to zero). Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com> [v2: Updated per Ian's recommendations] [v3: Added support for out-of-sync hypervisor] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_dom_x86.c')
-rw-r--r--tools/libxc/xc_dom_x86.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c
index eb9ac07434..d89526d789 100644
--- a/tools/libxc/xc_dom_x86.c
+++ b/tools/libxc/xc_dom_x86.c
@@ -706,6 +706,13 @@ int arch_setup_meminit(struct xc_dom_image *dom)
}
else
{
+ /* try to claim pages for early warning of insufficient memory avail */
+ if ( dom->claim_enabled ) {
+ rc = xc_domain_claim_pages(dom->xch, dom->guest_domid,
+ dom->total_pages);
+ if ( rc )
+ return rc;
+ }
/* setup initial p2m */
for ( pfn = 0; pfn < dom->total_pages; pfn++ )
dom->p2m_host[pfn] = pfn;
@@ -722,6 +729,11 @@ int arch_setup_meminit(struct xc_dom_image *dom)
dom->xch, dom->guest_domid, allocsz,
0, 0, &dom->p2m_host[i]);
}
+
+ /* Ensure no unclaimed pages are left unused.
+ * OK to call if hadn't done the earlier claim call. */
+ (void)xc_domain_claim_pages(dom->xch, dom->guest_domid,
+ 0 /* cancels the claim */);
}
return rc;