diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-06-15 13:18:09 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-06-15 13:18:09 +0100 |
commit | 3aff5e194857d587800365086290e349a1655e3d (patch) | |
tree | 432fb88e1c47821c56d211f26869965701a04f6c /tools/libxc/xc_domain_save.c | |
parent | 11ca89db8514b1c1999dc8ef306e74f523ceb6a9 (diff) | |
download | xen-3aff5e194857d587800365086290e349a1655e3d.tar.gz xen-3aff5e194857d587800365086290e349a1655e3d.tar.bz2 xen-3aff5e194857d587800365086290e349a1655e3d.zip |
Don't save Xen heap pages during domain save
As discussed in the thread starting at
http://lists.xensource.com/archives/html/xen-devel/2010-05/msg01383.html,
don't save Xen heap pages in order to avoid overallocation when the
domain gets restored, as those pages would get (temporarily) backed
with normal RAM pages by the restore code.
This requires making DOMCTL_getpageframeinfo{2,3} usable for HVM
guests, meaning that the input to these must be treated as GMFNs.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'tools/libxc/xc_domain_save.c')
-rw-r--r-- | tools/libxc/xc_domain_save.c | 82 |
1 files changed, 44 insertions, 38 deletions
diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c index 2cc8a8cf23..cc6bd1318e 100644 --- a/tools/libxc/xc_domain_save.c +++ b/tools/libxc/xc_domain_save.c @@ -1288,58 +1288,64 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t dom, uint32_t max_iter goto out; } - if ( hvm ) + /* Get page types */ + if ( xc_get_pfn_type_batch(xch, dom, batch, pfn_type) ) { - /* Look for and skip completely empty batches. */ - for ( j = 0; j < batch; j++ ) - { - if ( !pfn_err[j] ) - break; - pfn_type[j] |= XEN_DOMCTL_PFINFO_XTAB; - } - if ( j == batch ) - { - munmap(region_base, batch*PAGE_SIZE); - continue; /* bail on this batch: no valid pages */ - } - for ( ; j < batch; j++ ) - if ( pfn_err[j] ) - pfn_type[j] |= XEN_DOMCTL_PFINFO_XTAB; + PERROR("get_pfn_type_batch failed"); + goto out; } - else + + for ( run = j = 0; j < batch; j++ ) { - /* Get page types */ - if ( xc_get_pfn_type_batch(xch, dom, batch, pfn_type) ) - { - PERROR("get_pfn_type_batch failed"); - goto out; - } + unsigned long gmfn = pfn_batch[j]; - for ( j = 0; j < batch; j++ ) + if ( !hvm ) + gmfn = pfn_to_mfn(gmfn); + + if ( pfn_err[j] ) { - unsigned long mfn = pfn_to_mfn(pfn_batch[j]); - if ( pfn_type[j] == XEN_DOMCTL_PFINFO_XTAB ) - { - DPRINTF("type fail: page %i mfn %08lx\n", - j, mfn); continue; - } - - if ( debug ) + DPRINTF("map fail: page %i mfn %08lx err %d\n", + j, gmfn, pfn_err[j]); + pfn_type[j] = XEN_DOMCTL_PFINFO_XTAB; + continue; + } + + if ( pfn_type[j] == XEN_DOMCTL_PFINFO_XTAB ) + { + DPRINTF("type fail: page %i mfn %08lx\n", j, gmfn); + continue; + } + + /* canonicalise mfn->pfn */ + pfn_type[j] |= pfn_batch[j]; + ++run; + + if ( debug ) + { + if ( hvm ) + DPRINTF("%d pfn=%08lx sum=%08lx\n", + iter, + pfn_type[j], + csum_page(region_base + (PAGE_SIZE*j))); + else DPRINTF("%d pfn= %08lx mfn= %08lx [mfn]= %08lx" " sum= %08lx\n", iter, - pfn_type[j] | pfn_batch[j], - mfn, - mfn_to_pfn(mfn), + pfn_type[j], + gmfn, + mfn_to_pfn(gmfn), csum_page(region_base + (PAGE_SIZE*j))); - - /* canonicalise mfn->pfn */ - pfn_type[j] |= pfn_batch[j]; } } + if ( !run ) + { + munmap(region_base, batch*PAGE_SIZE); + continue; /* bail on this batch: no valid pages */ + } + if ( wrexact(io_fd, &batch, sizeof(unsigned int)) ) { PERROR("Error when writing to state file (2)"); |