yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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