aboutsummaryrefslogtreecommitdiff
path: root/arch_init.c
diff options
context:
space:
mode:
authorChenLiang <chenliang88@huawei.com>2014-03-20 20:15:03 +0800
committerAmit Shah <amit.shah@redhat.com>2014-11-20 18:17:22 +0530
commit6c1b663c4c3725bc4bc33f78ed266ddef80a2ca8 (patch)
treec8330e51c4044d2c1545d3274d3817423895b2fb /arch_init.c
parentaf3ff19b48f0bbf3a8bd35c47460358e8c6ae5e5 (diff)
migration: static variables will not be reset at second migration
The static variables in migration_bitmap_sync will not be reset in the case of a second attempted migration. Signed-off-by: ChenLiang <chenliang88@huawei.com> Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'arch_init.c')
-rw-r--r--arch_init.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/arch_init.c b/arch_init.c
index 593a990b6d..7680d28be4 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -486,15 +486,23 @@ static void migration_bitmap_sync_range(ram_addr_t start, ram_addr_t length)
/* Needs iothread lock! */
+/* Fix me: there are too many global variables used in migration process. */
+static int64_t start_time;
+static int64_t bytes_xfer_prev;
+static int64_t num_dirty_pages_period;
+
+static void migration_bitmap_sync_init(void)
+{
+ start_time = 0;
+ bytes_xfer_prev = 0;
+ num_dirty_pages_period = 0;
+}
static void migration_bitmap_sync(void)
{
RAMBlock *block;
uint64_t num_dirty_pages_init = migration_dirty_pages;
MigrationState *s = migrate_get_current();
- static int64_t start_time;
- static int64_t bytes_xfer_prev;
- static int64_t num_dirty_pages_period;
int64_t end_time;
int64_t bytes_xfer_now;
static uint64_t xbzrle_cache_miss_prev;
@@ -774,6 +782,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
mig_throttle_on = false;
dirty_rate_high_cnt = 0;
bitmap_sync_count = 0;
+ migration_bitmap_sync_init();
if (migrate_use_xbzrle()) {
XBZRLE_cache_lock();