diff mbox

[02/41] fix migration sync

Message ID 1348217255-22441-3-git-send-email-quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela Sept. 21, 2012, 8:46 a.m. UTC
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 arch_init.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Paolo Bonzini Sept. 21, 2012, 12:17 p.m. UTC | #1
Il 21/09/2012 10:46, Juan Quintela ha scritto:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  arch_init.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch_init.c b/arch_init.c
> index f849f9b..cdd8ab7 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -489,6 +489,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
>      ram_addr_t addr;
>      RAMBlock *block;
> 
> +    memory_global_sync_dirty_bitmap(get_system_memory());

Does it make sense to call this function before memory_global_dirty_log_start()?

Also, does this call subsume this loop:

    QLIST_FOREACH(block, &ram_list.blocks, next) {
        for (addr = 0; addr < block->length; addr += TARGET_PAGE_SIZE) {
            if (!memory_region_get_dirty(block->mr, addr, TARGET_PAGE_SIZE,
                                         DIRTY_MEMORY_MIGRATION)) {
                memory_region_set_dirty(block->mr, addr, TARGET_PAGE_SIZE);
            }
        }
    }

so that the right fix is

-    QLIST_FOREACH(block, &ram_list.blocks, next) {
-        for (addr = 0; addr < block->length; addr += TARGET_PAGE_SIZE) {
-            if (!memory_region_get_dirty(block->mr, addr, TARGET_PAGE_SIZE,
-                                         DIRTY_MEMORY_MIGRATION)) {
-                memory_region_set_dirty(block->mr, addr, TARGET_PAGE_SIZE);
-            }
-        }
-    }
-
     memory_global_dirty_log_start();
+    memory_global_sync_dirty_bitmap(get_system_memory());

?

Paolo

>      bytes_transferred = 0;
>      last_block = NULL;
>      last_offset = 0;
>
diff mbox

Patch

diff --git a/arch_init.c b/arch_init.c
index f849f9b..cdd8ab7 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -489,6 +489,7 @@  static int ram_save_setup(QEMUFile *f, void *opaque)
     ram_addr_t addr;
     RAMBlock *block;

+    memory_global_sync_dirty_bitmap(get_system_memory());
     bytes_transferred = 0;
     last_block = NULL;
     last_offset = 0;