diff options
author | iap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk> | 2004-05-11 14:57:44 +0000 |
---|---|---|
committer | iap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk> | 2004-05-11 14:57:44 +0000 |
commit | 07588dc73f0be59b52b968f7b88e43798bbe5e51 (patch) | |
tree | 1efd062adfd783ffd2d9e6a9bbcc7cdc858c9cdf /tools/xc/lib/xc_linux_restore.c | |
parent | a8e33843ee074cd479e0cb69a7e379587cdca5bb (diff) | |
download | xen-07588dc73f0be59b52b968f7b88e43798bbe5e51.tar.gz xen-07588dc73f0be59b52b968f7b88e43798bbe5e51.tar.bz2 xen-07588dc73f0be59b52b968f7b88e43798bbe5e51.zip |
bitkeeper revision 1.896 (40a0e9e8M0uaTwE5LBe9sIhr2vdX7Q)
Live migration initial checkin.
Diffstat (limited to 'tools/xc/lib/xc_linux_restore.c')
-rw-r--r-- | tools/xc/lib/xc_linux_restore.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/tools/xc/lib/xc_linux_restore.c b/tools/xc/lib/xc_linux_restore.c index 861d38a5f7..9b1532159f 100644 --- a/tools/xc/lib/xc_linux_restore.c +++ b/tools/xc/lib/xc_linux_restore.c @@ -230,9 +230,16 @@ int xc_linux_restore(int xc_handle, goto out; } - //printf("batch=%d\n",j); + printf("batch %d\n",j); - if(j==0) break; // our work here is done + if (j == 0) + break; // our work here is done + + if( j > MAX_BATCH_SIZE ) + { + ERROR("Max batch size exceeded. Giving up."); + goto out; + } if ( (*readerfn)(readerst, region_pfn_type, j*sizeof(unsigned long)) ) { @@ -242,6 +249,9 @@ int xc_linux_restore(int xc_handle, for(i=0;i<j;i++) { + if ((region_pfn_type[i]>>29) == 7) + continue; + pfn = region_pfn_type[i] & ~PGT_type_mask; mfn = pfn_to_mfn_table[pfn]; @@ -261,9 +271,15 @@ int xc_linux_restore(int xc_handle, unsigned long *ppage; pfn = region_pfn_type[i] & ~PGT_type_mask; + +//if(n>=nr_pfns || ((region_pfn_type[i] & PGT_type_mask) == L2TAB) ) printf("pfn=%08lx mfn=%x\n",region_pfn_type[i],pfn_to_mfn_table[pfn]); + //if(pfn_type[i])printf("^pfn=%d %08lx\n",pfn,pfn_type[i]); + if ((region_pfn_type[i]>>29) == 7) + continue; + if (pfn>nr_pfns) { ERROR("pfn out of range"); @@ -304,7 +320,7 @@ int xc_linux_restore(int xc_handle, if ( xpfn >= nr_pfns ) { - ERROR("Frame number in type %d page table is out of range. i=%d k=%d pfn=%d nr_pfns=%d",region_pfn_type[i]>>29,i,k,xpfn,nr_pfns); + ERROR("Frame number in type %d page table is out of range. i=%d k=%d pfn=0x%x nr_pfns=%d",region_pfn_type[i]>>29,i,k,xpfn,nr_pfns); goto out; } #if 0 @@ -355,17 +371,19 @@ int xc_linux_restore(int xc_handle, default: ERROR("Bogus page type %x page table is out of range. i=%d nr_pfns=%d",region_pfn_type[i],i,nr_pfns); goto out; - } + + } // end of page type switch statement if ( add_mmu_update(xc_handle, mmu, (mfn<<PAGE_SHIFT) | MMU_MACHPHYS_UPDATE, pfn) ) goto out; - } + } // end of 'batch' for loop n+=j; // crude stats } +printf("RECEIVED ALL PAGES\n"); mfn_mapper_close( region_mapper ); @@ -381,7 +399,10 @@ int xc_linux_restore(int xc_handle, (pfn_to_mfn_table[i]<<PAGE_SHIFT) | MMU_EXTENDED_COMMAND, MMUEXT_PIN_L1_TABLE) ) + { + printf("ERR pin L1 pfn=%lx mfn=%lx\n"); goto out; + } } else if ( pfn_type[i] == L2TAB ) { @@ -389,7 +410,10 @@ int xc_linux_restore(int xc_handle, (pfn_to_mfn_table[i]<<PAGE_SHIFT) | MMU_EXTENDED_COMMAND, MMUEXT_PIN_L2_TABLE) ) + { + printf("ERR pin L2 pfn=%lx mfn=%lx\n"); goto out; + } } } @@ -421,6 +445,8 @@ int xc_linux_restore(int xc_handle, p_srec->resume_info.flags = 0; unmap_pfn(pm_handle, p_srec); +printf("new shared info is %lx\n", shared_info_frame); + /* Uncanonicalise each GDT frame number. */ if ( ctxt.gdt_ents > 8192 ) { @@ -451,7 +477,7 @@ int xc_linux_restore(int xc_handle, /* Copy saved contents of shared-info page. No checking needed. */ ppage = map_pfn_writeable(pm_handle, shared_info_frame); - memcpy(ppage, shared_info, PAGE_SIZE); + memcpy(ppage, shared_info, sizeof(shared_info_t)); unmap_pfn(pm_handle, ppage); @@ -528,7 +554,9 @@ int xc_linux_restore(int xc_handle, op.u.builddomain.ctxt = &ctxt; rc = do_dom0_op(xc_handle, &op); +printf("NORMAL EXIT RESTORE\n"); out: +printf("EXIT RESTORE\n"); if ( mmu != NULL ) free(mmu); |