mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
migration: discard non-migratable RAMBlocks
On the POWER9 processor, the XIVE interrupt controller can control interrupt sources using MMIO to trigger events, to EOI or to turn off the sources. Priority management and interrupt acknowledgment is also controlled by MMIO in the presenter sub-engine. These MMIO regions are exposed to guests in QEMU with a set of 'ram device' memory mappings, similarly to VFIO, and the VMAs are populated dynamically with the appropriate pages using a fault handler. But, these regions are an issue for migration. We need to discard the associated RAMBlocks from the RAM state on the source VM and let the destination VM rebuild the memory mappings on the new host in the post_load() operation just before resuming the system. To achieve this goal, the following introduces a new RAMBlock flag RAM_MIGRATABLE which is updated in the vmstate_register_ram() and vmstate_unregister_ram() routines. This flag is then used by the migration to identify RAMBlocks to discard on the source. Some checks are also performed on the destination to make sure nothing invalid was sent. This change impacts the boston, malta and jazz mips boards for which migration compatibility is broken. Signed-off-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
f548222c24
commit
b895de5027
5 changed files with 84 additions and 18 deletions
|
@ -374,7 +374,7 @@ bool postcopy_ram_supported_by_host(MigrationIncomingState *mis)
|
|||
}
|
||||
|
||||
/* We don't support postcopy with shared RAM yet */
|
||||
if (qemu_ram_foreach_block(test_ramblock_postcopiable, NULL)) {
|
||||
if (qemu_ram_foreach_migratable_block(test_ramblock_postcopiable, NULL)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -502,7 +502,7 @@ static int cleanup_range(const char *block_name, void *host_addr,
|
|||
*/
|
||||
int postcopy_ram_incoming_init(MigrationIncomingState *mis, size_t ram_pages)
|
||||
{
|
||||
if (qemu_ram_foreach_block(init_range, NULL)) {
|
||||
if (qemu_ram_foreach_migratable_block(init_range, NULL)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -524,7 +524,7 @@ int postcopy_ram_incoming_cleanup(MigrationIncomingState *mis)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (qemu_ram_foreach_block(cleanup_range, mis)) {
|
||||
if (qemu_ram_foreach_migratable_block(cleanup_range, mis)) {
|
||||
return -1;
|
||||
}
|
||||
/* Let the fault thread quit */
|
||||
|
@ -593,7 +593,7 @@ static int nhp_range(const char *block_name, void *host_addr,
|
|||
*/
|
||||
int postcopy_ram_prepare_discard(MigrationIncomingState *mis)
|
||||
{
|
||||
if (qemu_ram_foreach_block(nhp_range, mis)) {
|
||||
if (qemu_ram_foreach_migratable_block(nhp_range, mis)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -604,7 +604,7 @@ int postcopy_ram_prepare_discard(MigrationIncomingState *mis)
|
|||
|
||||
/*
|
||||
* Mark the given area of RAM as requiring notification to unwritten areas
|
||||
* Used as a callback on qemu_ram_foreach_block.
|
||||
* Used as a callback on qemu_ram_foreach_migratable_block.
|
||||
* host_addr: Base of area to mark
|
||||
* offset: Offset in the whole ram arena
|
||||
* length: Length of the section
|
||||
|
@ -1099,7 +1099,7 @@ int postcopy_ram_enable_notify(MigrationIncomingState *mis)
|
|||
mis->have_fault_thread = true;
|
||||
|
||||
/* Mark so that we get notified of accesses to unwritten areas */
|
||||
if (qemu_ram_foreach_block(ram_block_enable_notify, mis)) {
|
||||
if (qemu_ram_foreach_migratable_block(ram_block_enable_notify, mis)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue