dirty = test_bit(page, block->bmap);
if (!dirty) {
trace_get_queued_page_not_dirty(block->idstr, (uint64_t)offset,
- page, test_bit(page, block->unsentmap));
+ page, test_bit(page, block->bmap));
} else {
trace_get_queued_page(block->idstr, (uint64_t)offset, page);
}
}
pages += tmppages;
- if (pss->block->unsentmap) {
- clear_bit(pss->page, pss->block->unsentmap);
- }
-
pss->page++;
} while ((pss->page & (pagesize_bits - 1)) &&
offset_in_ramblock(pss->block, pss->page << TARGET_PAGE_BITS));
block->clear_bmap = NULL;
g_free(block->bmap);
block->bmap = NULL;
- g_free(block->unsentmap);
- block->unsentmap = NULL;
}
xbzrle_cleanup();
* Returns zero on success
*
* Callback from postcopy_each_ram_send_discard for each RAMBlock
- * Note: At this point the 'unsentmap' is the processed bitmap combined
- * with the dirtymap; so a '1' means it's either dirty or unsent.
*
* @ms: current migration state
* @block: RAMBlock to discard
{
unsigned long end = block->used_length >> TARGET_PAGE_BITS;
unsigned long current;
- unsigned long *unsentmap = block->unsentmap;
+ unsigned long *bitmap = block->bmap;
for (current = 0; current < end; ) {
- unsigned long one = find_next_bit(unsentmap, end, current);
+ unsigned long one = find_next_bit(bitmap, end, current);
unsigned long zero, discard_length;
if (one >= end) {
break;
}
- zero = find_next_zero_bit(unsentmap, end, one + 1);
+ zero = find_next_zero_bit(bitmap, end, one + 1);
if (zero >= end) {
discard_length = end - one;
* clean, not a mix. This function canonicalizes the bitmaps.
*
* @ms: current migration state
- * @unsent_pass: if true we need to canonicalize partially unsent host pages
- * otherwise we need to canonicalize partially dirty host pages
* @block: block that contains the page we want to canonicalize
*/
-static void postcopy_chunk_hostpages_pass(MigrationState *ms, bool unsent_pass,
- RAMBlock *block)
+static void postcopy_chunk_hostpages_pass(MigrationState *ms, RAMBlock *block)
{
RAMState *rs = ram_state;
unsigned long *bitmap = block->bmap;
- unsigned long *unsentmap = block->unsentmap;
unsigned int host_ratio = block->page_size / TARGET_PAGE_SIZE;
unsigned long pages = block->used_length >> TARGET_PAGE_BITS;
unsigned long run_start;
return;
}
- if (unsent_pass) {
- /* Find a sent page */
- run_start = find_next_zero_bit(unsentmap, pages, 0);
- } else {
- /* Find a dirty page */
- run_start = find_next_bit(bitmap, pages, 0);
- }
+ /* Find a dirty page */
+ run_start = find_next_bit(bitmap, pages, 0);
while (run_start < pages) {
*/
if (QEMU_IS_ALIGNED(run_start, host_ratio)) {
/* Find the end of this run */
- if (unsent_pass) {
- run_start = find_next_bit(unsentmap, pages, run_start + 1);
- } else {
- run_start = find_next_zero_bit(bitmap, pages, run_start + 1);
- }
+ run_start = find_next_zero_bit(bitmap, pages, run_start + 1);
/*
* If the end isn't at the start of a host page, then the
* run doesn't finish at the end of a host page
/* Clean up the bitmap */
for (page = fixup_start_addr;
page < fixup_start_addr + host_ratio; page++) {
- /* All pages in this host page are now not sent */
- set_bit(page, unsentmap);
-
/*
* Remark them as dirty, updating the count for any pages
* that weren't previously dirty.
}
}
- if (unsent_pass) {
- /* Find the next sent page for the next iteration */
- run_start = find_next_zero_bit(unsentmap, pages, run_start);
- } else {
- /* Find the next dirty page for the next iteration */
- run_start = find_next_bit(bitmap, pages, run_start);
- }
+ /* Find the next dirty page for the next iteration */
+ run_start = find_next_bit(bitmap, pages, run_start);
}
}
{
postcopy_discard_send_init(ms, block->idstr);
- /* First pass: Discard all partially sent host pages */
- postcopy_chunk_hostpages_pass(ms, true, block);
/*
- * Second pass: Ensure that all partially dirty host pages are made
- * fully dirty.
+ * Ensure that all partially dirty host pages are made fully dirty.
*/
- postcopy_chunk_hostpages_pass(ms, false, block);
+ postcopy_chunk_hostpages_pass(ms, block);
postcopy_discard_send_finish(ms);
return 0;
rs->last_page = 0;
RAMBLOCK_FOREACH_NOT_IGNORED(block) {
- unsigned long pages = block->used_length >> TARGET_PAGE_BITS;
- unsigned long *bitmap = block->bmap;
- unsigned long *unsentmap = block->unsentmap;
-
- if (!unsentmap) {
- /* We don't have a safe way to resize the sentmap, so
- * if the bitmap was resized it will be NULL at this
- * point.
- */
- error_report("migration ram resized during precopy phase");
- rcu_read_unlock();
- return -EINVAL;
- }
/* Deal with TPS != HPS and huge pages */
ret = postcopy_chunk_hostpages(ms, block);
if (ret) {
return ret;
}
- /*
- * Update the unsentmap to be unsentmap = unsentmap | dirty
- */
- bitmap_or(unsentmap, unsentmap, bitmap, pages);
#ifdef DEBUG_POSTCOPY
- ram_debug_dump_bitmap(unsentmap, true, pages);
+ ram_debug_dump_bitmap(block->bmap, true,
+ block->used_length >> TARGET_PAGE_BITS);
#endif
}
trace_ram_postcopy_send_discard_bitmap();
bitmap_set(block->bmap, 0, pages);
block->clear_bmap_shift = shift;
block->clear_bmap = bitmap_new(clear_bmap_size(pages, shift));
- if (migrate_postcopy_ram()) {
- block->unsentmap = bitmap_new(pages);
- bitmap_set(block->unsentmap, 0, pages);
- }
}
}
}