* [PATCH 1 of 2] Unbreak live migration with tapdisk2 after 20691:054042ba73b6
2010-01-20 23:44 [PATCH 0 of 2] HVM live migration fixes Brendan Cully
@ 2010-01-20 23:44 ` Brendan Cully
2010-01-20 23:44 ` [PATCH 2 of 2] Unbreak HVM live migration after 0b138a019292 Brendan Cully
1 sibling, 0 replies; 3+ messages in thread
From: Brendan Cully @ 2010-01-20 23:44 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Brendan Cully <brendan@cs.ubc.ca>
# Date 1264027323 28800
# Node ID 3a6f73240fbd5e66cb7b4c8f84a91513615cc806
# Parent fe58c98dd43f370b5461e3ad451b2520dd6b9e2e
Unbreak live migration with tapdisk2 after 20691:054042ba73b6
vm.image does not exist at this point in the restore process.
I haven't looked at the memory_sharing code. It's likely something
better is needed to make that work across relocation.
diff --git a/tools/python/xen/xend/server/BlktapController.py b/tools/python/xen/xend/server/BlktapController.py
--- a/tools/python/xen/xend/server/BlktapController.py
+++ b/tools/python/xen/xend/server/BlktapController.py
@@ -198,7 +198,7 @@
self.deviceClass = 'tap2'
return devid
- if self.vm.image.memory_sharing:
+ if self.vm.image and self.vm.image.memory_sharing:
cmd = [ TAPDISK_BINARY, '-n', '%s:%s' % (params, file), '-s', '%d' % self.vm.getDomid() ]
else:
cmd = [ TAPDISK_BINARY, '-n', '%s:%s' % (params, file) ]
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 2 of 2] Unbreak HVM live migration after 0b138a019292
2010-01-20 23:44 [PATCH 0 of 2] HVM live migration fixes Brendan Cully
2010-01-20 23:44 ` [PATCH 1 of 2] Unbreak live migration with tapdisk2 after 20691:054042ba73b6 Brendan Cully
@ 2010-01-20 23:44 ` Brendan Cully
1 sibling, 0 replies; 3+ messages in thread
From: Brendan Cully @ 2010-01-20 23:44 UTC (permalink / raw)
To: xen-devel
# HG changeset patch
# User Brendan Cully <brendan@cs.ubc.ca>
# Date 1264031014 28800
# Node ID 7ba22c778aac4e4041eba86c32916694deeeabf7
# Parent 3a6f73240fbd5e66cb7b4c8f84a91513615cc806
Unbreak HVM live migration after 0b138a019292.
0b138a019292 was a little too ambitious replacing xc_map_foreign_batch
with xc_map_foreign_pages in xc_domain_restore. With HVM, some of the
mappings are expected to fail (as "XTAB" pages).
Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c
+++ b/tools/libxc/xc_domain_restore.c
@@ -1171,6 +1171,8 @@
unsigned long *page = NULL;
int nraces = 0;
struct domain_info_context *dinfo = &ctx->dinfo;
+ int* pfn_err = NULL;
+ int rc = -1;
unsigned long mfn, pfn, pagetype;
@@ -1186,12 +1188,14 @@
}
/* Map relevant mfns */
- region_base = xc_map_foreign_pages(
- xc_handle, dom, PROT_WRITE, region_mfn, j);
+ pfn_err = calloc(j, sizeof(*pfn_err));
+ region_base = xc_map_foreign_bulk(
+ xc_handle, dom, PROT_WRITE, region_mfn, pfn_err, j);
if ( region_base == NULL )
{
ERROR("map batch failed");
+ free(pfn_err);
return -1;
}
@@ -1204,12 +1208,18 @@
/* a bogus/unmapped page: skip it */
continue;
+ if (pfn_err[i])
+ {
+ ERROR("unexpected PFN mapping failure");
+ goto err_mapped;
+ }
+
++curpage;
if ( pfn > dinfo->p2m_size )
{
ERROR("pfn out of range");
- return -1;
+ goto err_mapped;
}
pfn_type[pfn] = pagetype;
@@ -1257,7 +1267,7 @@
{
ERROR("Bogus page type %lx page table is out of range: "
"i=%d p2m_size=%lu", pagetype, i, dinfo->p2m_size);
- return -1;
+ goto err_mapped;
}
if ( pagebuf->verify )
@@ -1288,13 +1298,17 @@
| MMU_MACHPHYS_UPDATE, pfn) )
{
ERROR("failed machpys update mfn=%lx pfn=%lx", mfn, pfn);
- return -1;
+ goto err_mapped;
}
} /* end of 'batch' for loop */
+ rc = nraces;
+
+ err_mapped:
munmap(region_base, j*PAGE_SIZE);
+ free(pfn_err);
- return nraces;
+ return rc;
}
int xc_domain_restore(int xc_handle, int io_fd, uint32_t dom,
^ permalink raw reply [flat|nested] 3+ messages in thread