Skip to contentSkip to conversation

migration: initialise compression_counters for a new migration

PATCH In review yuxiating 2 participants 2 messages Sep 2, 2021 – Nov 2, 2021

lore
Share & tools
lore

yuxiating

author
#0 lore raw

PATCH 1/1 migration: initialise compression_counters for a new migration

If the compression migration fails or is canceled, the query for the value of compression_counters during the next compression migration is wrong.

---
 migration/migration.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
migration/migration.c +2 -1
index bb909781b7..f20bc560e5 100644
@@ -2252,10 +2252,11 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
 
     migrate_init(s);
     /*
-     * set ram_counters memory to zero for a
+     * set ram_counters compression_counters memory to zero for a
      * new migration
      */
     memset(&ram_counters, 0, sizeof(ram_counters));
+    memset(&compression_counters, 0, sizeof(compression_counters));
 
     return true;
 }
Signature · 1 line
2.24.0.windows.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · yuxiating

If the compression migration fails or is canceled, the query for the value of compression_counters during the next compression migration is wrong.

---
 migration/migration.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
migration/migration.c +0 -0
index bb909781b7..f20bc560e5 100644
@@ -2252,10 +2252,11 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
 
     migrate_init(s);

migration/migration.c static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc, · line 2262

Quoted 10 lines
migration/migration.c +2 -1
     /*
-     * set ram_counters memory to zero for a
+     * set ram_counters compression_counters memory to zero for a
      * new migration
      */
     memset(&ram_counters, 0, sizeof(ram_counters));
+    memset(&compression_counters, 0, sizeof(compression_counters));
 
     return true;
 }

Once here, we are not initializing them on qemu_savevm_state() either.

queue.