mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
migration/multifd: Support outgoing mapped-ram stream format
The new mapped-ram stream format uses a file transport and puts ram pages in the migration file at their respective offsets and can be done in parallel by using the pwritev system call which takes iovecs and an offset. Add support to enabling the new format along with multifd to make use of the threading and page handling already in place. This requires multifd to stop sending headers and leaving the stream format to the mapped-ram code. When it comes time to write the data, we need to call a version of qio_channel_write that can take an offset. Usage on HMP is: (qemu) stop (qemu) migrate_set_capability multifd on (qemu) migrate_set_capability mapped-ram on (qemu) migrate_set_parameter max-bandwidth 0 (qemu) migrate_set_parameter multifd-channels 8 (qemu) migrate file:migfile Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20240229153017.2221-21-farosas@suse.de Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
parent
9d01778af8
commit
f427d90b98
8 changed files with 125 additions and 16 deletions
|
@ -1148,7 +1148,7 @@ static int save_zero_page(RAMState *rs, PageSearchStatus *pss,
|
|||
|
||||
if (migrate_mapped_ram()) {
|
||||
/* zero pages are not transferred with mapped-ram */
|
||||
clear_bit(offset >> TARGET_PAGE_BITS, pss->block->file_bmap);
|
||||
clear_bit_atomic(offset >> TARGET_PAGE_BITS, pss->block->file_bmap);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2445,8 +2445,6 @@ static void ram_save_cleanup(void *opaque)
|
|||
block->clear_bmap = NULL;
|
||||
g_free(block->bmap);
|
||||
block->bmap = NULL;
|
||||
g_free(block->file_bmap);
|
||||
block->file_bmap = NULL;
|
||||
}
|
||||
|
||||
xbzrle_cleanup();
|
||||
|
@ -3135,9 +3133,22 @@ static void ram_save_file_bmap(QEMUFile *f)
|
|||
qemu_put_buffer_at(f, (uint8_t *)block->file_bmap, bitmap_size,
|
||||
block->bitmap_offset);
|
||||
ram_transferred_add(bitmap_size);
|
||||
|
||||
/*
|
||||
* Free the bitmap here to catch any synchronization issues
|
||||
* with multifd channels. No channels should be sending pages
|
||||
* after we've written the bitmap to file.
|
||||
*/
|
||||
g_free(block->file_bmap);
|
||||
block->file_bmap = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void ramblock_set_file_bmap_atomic(RAMBlock *block, ram_addr_t offset)
|
||||
{
|
||||
set_bit_atomic(offset >> TARGET_PAGE_BITS, block->file_bmap);
|
||||
}
|
||||
|
||||
/**
|
||||
* ram_save_iterate: iterative stage for migration
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue