qemu-kvm/SOURCES/kvm-migration-Move-more-initializations-to-migrate_init.patch
eabdullin 214c1e4174 - dump: Add arch cleanup function
- target/s390x/arch_dump: Add arch cleanup function for PV
 dumps
- target/s390x/dump: Remove unneeded dump info function pointer
 init
2024-01-25 14:58:15 +03:00

69 lines
2.3 KiB
Diff

From f543aa222da183ac37424d1ea3a65e5fb6202732 Mon Sep 17 00:00:00 2001
From: Avihai Horon <avihaih@nvidia.com>
Date: Wed, 6 Sep 2023 18:08:50 +0300
Subject: [PATCH] migration: Move more initializations to migrate_init()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Initialization of mig_stats, compression_counters and VFIO bytes
transferred is hard-coded in migration code path and snapshot code path.
Make the code cleaner by initializing them in migrate_init().
Suggested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
migration/migration.c | 14 +++++++-------
migration/savevm.c | 3 ---
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 92866a8f49d3..ce01a3ba6af7 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1422,6 +1422,13 @@ void migrate_init(MigrationState *s)
s->iteration_initial_bytes = 0;
s->threshold_size = 0;
s->switchover_acked = false;
+ /*
+ * set mig_stats compression_counters memory to zero for a
+ * new migration
+ */
+ memset(&ram_counters, 0, sizeof(ram_counters));
+ memset(&compression_counters, 0, sizeof(compression_counters));
+ migration_reset_vfio_bytes_transferred();
}
int migrate_add_blocker_internal(Error *reason, Error **errp)
@@ -1632,13 +1639,6 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
}
migrate_init(s);
- /*
- * 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));
- migration_reset_vfio_bytes_transferred();
return true;
}
diff --git a/migration/savevm.c b/migration/savevm.c
index 5bf8b59a7dfc..e14efeced0fb 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1618,9 +1618,6 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
}
migrate_init(ms);
- memset(&ram_counters, 0, sizeof(ram_counters));
- memset(&compression_counters, 0, sizeof(compression_counters));
- migration_reset_vfio_bytes_transferred();
ms->to_dst_file = f;
qemu_mutex_unlock_iothread();