Blame SOURCES/kvm-migration-static-variables-will-not-be-reset-at-seco.patch

958e1b
From bf03ba87d891a3f0f2aad8d05b5770c1ac09e800 Mon Sep 17 00:00:00 2001
958e1b
From: Amit Shah <amit.shah@redhat.com>
958e1b
Date: Fri, 21 Nov 2014 08:27:51 +0100
958e1b
Subject: [PATCH 1/7] migration: static variables will not be reset at second
958e1b
 migration
958e1b
958e1b
Message-id: <20e4d11148c43174056cdd0e3be03480fe51ccc7.1416557860.git.amit.shah@redhat.com>
958e1b
Patchwork-id: 62517
958e1b
O-Subject: [RHEL-7.1 qemu-kvm PATCH 1/1] migration: static variables will not be reset at second migration
958e1b
Bugzilla: 1071776
958e1b
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
958e1b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
958e1b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
958e1b
958e1b
From: ChenLiang <chenliang88@huawei.com>
958e1b
958e1b
The static variables in migration_bitmap_sync will not be reset in
958e1b
the case of a second attempted migration.
958e1b
958e1b
Signed-off-by: ChenLiang <chenliang88@huawei.com>
958e1b
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
958e1b
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
958e1b
Signed-off-by: Amit Shah <amit.shah@redhat.com>
958e1b
(cherry picked from commit 6c1b663c4c3725bc4bc33f78ed266ddef80a2ca8)
958e1b
Signed-off-by: Amit Shah <amit.shah@redhat.com>
958e1b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
958e1b
Conflicts:
958e1b
	arch_init.c
958e1b
(Trivial context conflict)
958e1b
---
958e1b
 arch_init.c | 15 ++++++++++++---
958e1b
 1 file changed, 12 insertions(+), 3 deletions(-)
958e1b
958e1b
diff --git a/arch_init.c b/arch_init.c
958e1b
index b88d686..0c2bde9 100644
958e1b
--- a/arch_init.c
958e1b
+++ b/arch_init.c
958e1b
@@ -476,15 +476,23 @@ static void migration_bitmap_sync_range(ram_addr_t start, ram_addr_t length)
958e1b
 
958e1b
 
958e1b
 /* Needs iothread lock! */
958e1b
+/* Fix me: there are too many global variables used in migration process. */
958e1b
+static int64_t start_time;
958e1b
+static int64_t bytes_xfer_prev;
958e1b
+static int64_t num_dirty_pages_period;
958e1b
+
958e1b
+static void migration_bitmap_sync_init(void)
958e1b
+{
958e1b
+    start_time = 0;
958e1b
+    bytes_xfer_prev = 0;
958e1b
+    num_dirty_pages_period = 0;
958e1b
+}
958e1b
 
958e1b
 static void migration_bitmap_sync(void)
958e1b
 {
958e1b
     RAMBlock *block;
958e1b
     uint64_t num_dirty_pages_init = migration_dirty_pages;
958e1b
     MigrationState *s = migrate_get_current();
958e1b
-    static int64_t start_time;
958e1b
-    static int64_t bytes_xfer_prev;
958e1b
-    static int64_t num_dirty_pages_period;
958e1b
     int64_t end_time;
958e1b
     int64_t bytes_xfer_now;
958e1b
 
958e1b
@@ -732,6 +740,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
958e1b
 
958e1b
     mig_throttle_on = false;
958e1b
     dirty_rate_high_cnt = 0;
958e1b
+    migration_bitmap_sync_init();
958e1b
 
958e1b
     if (migrate_use_xbzrle()) {
958e1b
         XBZRLE_cache_lock();
958e1b
-- 
958e1b
1.8.3.1
958e1b