cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-migration-move-calling-control_save_page-to-the-comm.patch

26ba25
From c378bddd4b750773a7e8e4987806d08248bc239d Mon Sep 17 00:00:00 2001
26ba25
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
26ba25
Date: Wed, 1 Aug 2018 13:55:11 +0100
26ba25
Subject: [PATCH 07/21] migration: move calling control_save_page to the common
26ba25
 place
26ba25
26ba25
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
26ba25
Message-id: <20180801135522.11658-8-dgilbert@redhat.com>
26ba25
Patchwork-id: 81580
26ba25
O-Subject: [qemu-kvm RHEL8/virt212 PATCH 07/18] migration: move calling control_save_page to the common place
26ba25
Bugzilla: 1594384
26ba25
RH-Acked-by: Peter Xu <peterx@redhat.com>
26ba25
RH-Acked-by: John Snow <jsnow@redhat.com>
26ba25
RH-Acked-by: Juan Quintela <quintela@redhat.com>
26ba25
26ba25
From: Xiao Guangrong <xiaoguangrong@tencent.com>
26ba25
26ba25
The function is called by both ram_save_page and ram_save_target_page,
26ba25
so move it to the common caller to cleanup the code
26ba25
26ba25
Reviewed-by: Peter Xu <peterx@redhat.com>
26ba25
Signed-off-by: Xiao Guangrong <xiaoguangrong@tencent.com>
26ba25
Message-Id: <20180330075128.26919-8-xiaoguangrong@tencent.com>
26ba25
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
26ba25
(cherry picked from commit a8ec91f941c5f83123796331c09333d3557eb5fc)
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 migration/ram.c | 16 ++++++++--------
26ba25
 1 file changed, 8 insertions(+), 8 deletions(-)
26ba25
26ba25
diff --git a/migration/ram.c b/migration/ram.c
26ba25
index 106fcf1..9d6c41c 100644
26ba25
--- a/migration/ram.c
26ba25
+++ b/migration/ram.c
26ba25
@@ -1038,10 +1038,6 @@ static int ram_save_page(RAMState *rs, PageSearchStatus *pss, bool last_stage)
26ba25
     p = block->host + offset;
26ba25
     trace_ram_save_page(block->idstr, (uint64_t)offset, p);
26ba25
 
26ba25
-    if (control_save_page(rs, block, offset, &pages)) {
26ba25
-        return pages;
26ba25
-    }
26ba25
-
26ba25
     XBZRLE_cache_lock();
26ba25
     pages = save_zero_page(rs, block, offset);
26ba25
     if (pages > 0) {
26ba25
@@ -1199,10 +1195,6 @@ static int ram_save_compressed_page(RAMState *rs, PageSearchStatus *pss,
26ba25
 
26ba25
     p = block->host + offset;
26ba25
 
26ba25
-    if (control_save_page(rs, block, offset, &pages)) {
26ba25
-        return pages;
26ba25
-    }
26ba25
-
26ba25
     /* When starting the process of a new block, the first page of
26ba25
      * the block should be sent out before other pages in the same
26ba25
      * block, and all the pages in last block should have been sent
26ba25
@@ -1490,6 +1482,14 @@ err:
26ba25
 static int ram_save_target_page(RAMState *rs, PageSearchStatus *pss,
26ba25
                                 bool last_stage)
26ba25
 {
26ba25
+    RAMBlock *block = pss->block;
26ba25
+    ram_addr_t offset = pss->page << TARGET_PAGE_BITS;
26ba25
+    int res;
26ba25
+
26ba25
+    if (control_save_page(rs, block, offset, &res)) {
26ba25
+        return res;
26ba25
+    }
26ba25
+
26ba25
     /*
26ba25
      * If xbzrle is on, stop using the data compression after first
26ba25
      * round of migration even if compression is enabled. In theory,
26ba25
-- 
26ba25
1.8.3.1
26ba25