Fix 'belt + braces' check in xc_linux_save and improve error handling

for live migrate (this includes making shadow enable idempotent). 

Signed-off-by: Steven Hand <steven@xensource.com>
This commit is contained in:
smh22@firebug.cl.cam.ac.uk committed 2005-11-21 16:40:16 +01:00
1 parent daee19a8a7
commit 7cdf0f6407
3 files changed
+19 -5

No files matched your search

+10 -2
View File
@@ -798,6 +798,7 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
pfn_batch = calloc(MAX_BATCH_SIZE, sizeof(unsigned long));
if ((pfn_type == NULL) || (pfn_batch == NULL)) {
ERR("failed to alloc memory for pfn_type and/or pfn_batch arays.");
errno = ENOMEM;
goto out;
}
@@ -817,7 +818,7 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
for (i = 0; i < max_pfn; i++) {
mfn = live_p2m[i];
if((live_m2p[mfn] != i) && (mfn != 0xffffffffUL)) {
if((mfn != 0xffffffffUL) && (live_m2p[mfn] != i)) {
DPRINTF("i=0x%x mfn=%lx live_m2p=%lx\n", i,
mfn, live_m2p[mfn]);
err++;
@@ -912,7 +913,7 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
unless its sent sooner anyhow */
set_bit(n, to_fix);
if(iter > 1)
if( (iter > 1) && IS_REAL_PFN(n) )
DPRINTF("netbuf race: iter %d, pfn %x. mfn %lx\n",
iter, n, pfn_type[batch]);
continue;
@@ -1157,6 +1158,13 @@ int xc_linux_save(int xc_handle, int io_fd, uint32_t dom, uint32_t max_iters,
out:
if (live) {
if(xc_shadow_control(xc_handle, dom, DOM0_SHADOW_CONTROL_OP_OFF,
NULL, 0, NULL ) < 0) {
DPRINTF("Warning - couldn't disable shadow mode");
}
}
if (live_shinfo)
munmap(live_shinfo, PAGE_SIZE);
+6
View File
@@ -125,6 +125,12 @@ static int get_platform_info(int xc_handle, uint32_t dom,
/* Number of entries in the pfn_to_mfn_frame_list_list */
#define P2M_FLL_ENTRIES (((max_pfn)+(ulpp*ulpp)-1)/(ulpp*ulpp))
/* Current guests allow 8MB 'slack' in their P2M */
#define NR_SLACK_ENTRIES ((8 * 1024 * 1024) / PAGE_SIZE)
/* Is the given PFN within the 'slack' region at the top of the P2M? */
#define IS_REAL_PFN(_pfn) ((max_pfn - (_pfn)) > NR_SLACK_ENTRIES)
/* Returns TRUE if the PFN is currently mapped */
#define is_mapped(pfn_type) (!((pfn_type) & 0x80000000UL))
+3 -3
View File
@@ -920,9 +920,9 @@ int __shadow_mode_enable(struct domain *d, unsigned int mode)
struct vcpu *v;
int new_modes = (mode & ~d->arch.shadow_mode);
// Gotta be adding something to call this function.
ASSERT(new_modes);
if(!new_modes) /* Nothing to do - return success */
return 0;
// can't take anything away by calling this function.
ASSERT(!(d->arch.shadow_mode & ~mode));
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.