163148b426
OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=87c8ac43897718b61dbcbca0296d6c2a
164 lines
6.2 KiB
Diff
164 lines
6.2 KiB
Diff
# HG changeset patch
|
|
# User Keir Fraser <keir.fraser@citrix.com>
|
|
# Date 1276604289 -3600
|
|
# Node ID a2cc1db1af9c8f9b148c80f8b2c3f64bde7542f9
|
|
# Parent 094b826a2b8e2c17fe7004923352d459e0c23f13
|
|
Don't save Xen heap pages during domain save
|
|
References: bnc#609153
|
|
|
|
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>
|
|
|
|
Index: xen-4.0.1-testing/tools/libxc/xc_domain_save.c
|
|
===================================================================
|
|
--- xen-4.0.1-testing.orig/tools/libxc/xc_domain_save.c
|
|
+++ xen-4.0.1-testing/tools/libxc/xc_domain_save.c
|
|
@@ -1282,58 +1282,64 @@ int xc_domain_save(int xc_handle, int io
|
|
goto out;
|
|
}
|
|
|
|
- if ( hvm )
|
|
+ /* Get page types */
|
|
+ if ( xc_get_pfn_type_batch(xc_handle, 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;
|
|
+ ERROR("get_pfn_type_batch failed");
|
|
+ goto out;
|
|
}
|
|
- else
|
|
+
|
|
+ for ( run = j = 0; j < batch; j++ )
|
|
{
|
|
- /* Get page types */
|
|
- if ( xc_get_pfn_type_batch(xc_handle, dom, batch, pfn_type) )
|
|
- {
|
|
- ERROR("get_pfn_type_batch failed");
|
|
- goto out;
|
|
- }
|
|
+ unsigned long gmfn = pfn_batch[j];
|
|
+
|
|
+ if ( !hvm )
|
|
+ gmfn = pfn_to_mfn(gmfn);
|
|
|
|
- for ( j = 0; j < batch; j++ )
|
|
+ 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 ( write_exact(io_fd, &batch, sizeof(unsigned int)) )
|
|
{
|
|
PERROR("Error when writing to state file (2)");
|
|
Index: xen-4.0.1-testing/xen/arch/x86/domctl.c
|
|
===================================================================
|
|
--- xen-4.0.1-testing.orig/xen/arch/x86/domctl.c
|
|
+++ xen-4.0.1-testing/xen/arch/x86/domctl.c
|
|
@@ -206,11 +206,12 @@ long arch_do_domctl(
|
|
|
|
for ( j = 0; j < k; j++ )
|
|
{
|
|
- unsigned long type = 0, mfn = arr[j];
|
|
+ unsigned long type = 0, mfn = gmfn_to_mfn(d, arr[j]);
|
|
|
|
page = mfn_to_page(mfn);
|
|
|
|
- if ( unlikely(!mfn_valid(mfn)) )
|
|
+ if ( unlikely(!mfn_valid(mfn)) ||
|
|
+ unlikely(is_xen_heap_mfn(mfn)) )
|
|
type = XEN_DOMCTL_PFINFO_XTAB;
|
|
else if ( xsm_getpageframeinfo(page) != 0 )
|
|
;
|
|
@@ -305,14 +306,15 @@ long arch_do_domctl(
|
|
for ( j = 0; j < k; j++ )
|
|
{
|
|
struct page_info *page;
|
|
- unsigned long mfn = arr32[j];
|
|
+ unsigned long mfn = gmfn_to_mfn(d, arr32[j]);
|
|
|
|
page = mfn_to_page(mfn);
|
|
|
|
if ( domctl->cmd == XEN_DOMCTL_getpageframeinfo3)
|
|
arr32[j] = 0;
|
|
|
|
- if ( unlikely(!mfn_valid(mfn)) )
|
|
+ if ( unlikely(!mfn_valid(mfn)) ||
|
|
+ unlikely(is_xen_heap_mfn(mfn)) )
|
|
arr32[j] |= XEN_DOMCTL_PFINFO_XTAB;
|
|
else if ( xsm_getpageframeinfo(page) != 0 )
|
|
continue;
|