aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_domain_restore.c
diff options
context:
space:
mode:
authorGeorge Dunlap <george.dunlap@eu.citrix.com>2011-05-26 15:27:33 +0100
committerGeorge Dunlap <george.dunlap@eu.citrix.com>2011-05-26 15:27:33 +0100
commitf35c8f6857b19f2278b73b55bb64d4fc8fb56c75 (patch)
treefd767602ffdefe4205122ee551052aeef3e22875 /tools/libxc/xc_domain_restore.c
parentbc14571cb1c03ed1691a520f444828f36b605116 (diff)
downloadxen-f35c8f6857b19f2278b73b55bb64d4fc8fb56c75.tar.gz
xen-f35c8f6857b19f2278b73b55bb64d4fc8fb56c75.tar.bz2
xen-f35c8f6857b19f2278b73b55bb64d4fc8fb56c75.zip
tools: Introduce "allocate-only" page type for migration
To detect presence of superpages on the receiver side, we need to have strings of sequential pfns sent across on the first iteration through the memory. However, as we go through the memory, more and more of it will be marked dirty, making it wasteful to send those pages. This patch introduces a new PFINFO type, "XALLOC". Like PFINFO_XTAB, it indicates that there is no corresponding page present in the subsquent page buffer. However, unlike PFINFO_XTAB, it contains a pfn which should be allocated. This new type is only used for migration; but it's placed in xen/public/domctl.h so that the value isn't reused. Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools/libxc/xc_domain_restore.c')
-rw-r--r--tools/libxc/xc_domain_restore.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c
index 1a39c2cebc..5cf099c92e 100644
--- a/tools/libxc/xc_domain_restore.c
+++ b/tools/libxc/xc_domain_restore.c
@@ -839,7 +839,8 @@ static int pagebuf_get_one(xc_interface *xch, struct restore_ctx *ctx,
countpages = count;
for (i = oldcount; i < buf->nr_pages; ++i)
- if ((buf->pfn_types[i] & XEN_DOMCTL_PFINFO_LTAB_MASK) == XEN_DOMCTL_PFINFO_XTAB)
+ if ((buf->pfn_types[i] & XEN_DOMCTL_PFINFO_LTAB_MASK) == XEN_DOMCTL_PFINFO_XTAB
+ ||(buf->pfn_types[i] & XEN_DOMCTL_PFINFO_LTAB_MASK) == XEN_DOMCTL_PFINFO_XALLOC)
--countpages;
if (!countpages)
@@ -917,6 +918,7 @@ static int apply_batch(xc_interface *xch, uint32_t dom, struct restore_ctx *ctx,
pfn = pagebuf->pfn_types[i + curbatch] & ~XEN_DOMCTL_PFINFO_LTAB_MASK;
pagetype = pagebuf->pfn_types[i + curbatch] & XEN_DOMCTL_PFINFO_LTAB_MASK;
+ /* For allocation purposes, treat XEN_DOMCTL_PFINFO_XALLOC as a normal page */
if ( (pagetype != XEN_DOMCTL_PFINFO_XTAB) &&
(ctx->p2m[pfn] == INVALID_P2M_ENTRY) )
{
@@ -1028,21 +1030,21 @@ static int apply_batch(xc_interface *xch, uint32_t dom, struct restore_ctx *ctx,
pfn = pagebuf->pfn_types[i + curbatch] & ~XEN_DOMCTL_PFINFO_LTAB_MASK;
pagetype = pagebuf->pfn_types[i + curbatch] & XEN_DOMCTL_PFINFO_LTAB_MASK;
- if ( pagetype == XEN_DOMCTL_PFINFO_XTAB )
- region_mfn[i] = ~0UL; /* map will fail but we don't care */
- else
+ if ( pagetype != XEN_DOMCTL_PFINFO_XTAB
+ && ctx->p2m[pfn] == (INVALID_P2M_ENTRY-1) )
{
- if ( ctx->p2m[pfn] == (INVALID_P2M_ENTRY-1) )
- {
- /* We just allocated a new mfn above; update p2m */
- ctx->p2m[pfn] = ctx->p2m_batch[nr_mfns++];
- ctx->nr_pfns++;
- }
+ /* We just allocated a new mfn above; update p2m */
+ ctx->p2m[pfn] = ctx->p2m_batch[nr_mfns++];
+ ctx->nr_pfns++;
+ }
- /* setup region_mfn[] for batch map.
- * For HVM guests, this interface takes PFNs, not MFNs */
+ /* setup region_mfn[] for batch map, if necessary.
+ * For HVM guests, this interface takes PFNs, not MFNs */
+ if ( pagetype == XEN_DOMCTL_PFINFO_XTAB
+ || pagetype == XEN_DOMCTL_PFINFO_XALLOC )
+ region_mfn[i] = ~0UL; /* map will fail but we don't care */
+ else
region_mfn[i] = hvm ? pfn : ctx->p2m[pfn];
- }
}
/* Map relevant mfns */
@@ -1062,8 +1064,9 @@ static int apply_batch(xc_interface *xch, uint32_t dom, struct restore_ctx *ctx,
pfn = pagebuf->pfn_types[i + curbatch] & ~XEN_DOMCTL_PFINFO_LTAB_MASK;
pagetype = pagebuf->pfn_types[i + curbatch] & XEN_DOMCTL_PFINFO_LTAB_MASK;
- if ( pagetype == XEN_DOMCTL_PFINFO_XTAB )
- /* a bogus/unmapped page: skip it */
+ if ( pagetype == XEN_DOMCTL_PFINFO_XTAB
+ || pagetype == XEN_DOMCTL_PFINFO_XALLOC)
+ /* a bogus/unmapped/allocate-only page: skip it */
continue;
if (pfn_err[i])