|
|
1bdc94 |
From 45b68ea328fbac00681b1c2eec1eb1499005020a Mon Sep 17 00:00:00 2001
|
|
|
1bdc94 |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
1bdc94 |
Date: Fri, 22 Jun 2018 18:59:56 +0200
|
|
|
1bdc94 |
Subject: [PATCH 17/57] migration: introduce save_normal_page()
|
|
|
1bdc94 |
|
|
|
1bdc94 |
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
1bdc94 |
Message-id: <20180622190005.21297-10-dgilbert@redhat.com>
|
|
|
1bdc94 |
Patchwork-id: 81003
|
|
|
1bdc94 |
O-Subject: [RHEL7.6 qemu-kvm-rhev PATCH 09/18] migration: introduce save_normal_page()
|
|
|
1bdc94 |
Bugzilla: 1584139
|
|
|
1bdc94 |
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
|
|
1bdc94 |
RH-Acked-by: Juan Quintela <quintela@redhat.com>
|
|
|
1bdc94 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
1bdc94 |
|
|
|
1bdc94 |
From: Xiao Guangrong <xiaoguangrong@tencent.com>
|
|
|
1bdc94 |
|
|
|
1bdc94 |
It directly sends the page to the stream neither checking zero nor
|
|
|
1bdc94 |
using xbzrle or compression
|
|
|
1bdc94 |
|
|
|
1bdc94 |
Reviewed-by: Peter Xu <peterx@redhat.com>
|
|
|
1bdc94 |
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
1bdc94 |
Signed-off-by: Xiao Guangrong <xiaoguangrong@tencent.com>
|
|
|
1bdc94 |
Message-Id: <20180330075128.26919-10-xiaoguangrong@tencent.com>
|
|
|
1bdc94 |
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
1bdc94 |
(cherry picked from commit 65dacaa04fa7e6104cbcee9251c7845355769a10)
|
|
|
1bdc94 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
1bdc94 |
---
|
|
|
1bdc94 |
migration/ram.c | 50 ++++++++++++++++++++++++++++++--------------------
|
|
|
1bdc94 |
1 file changed, 30 insertions(+), 20 deletions(-)
|
|
|
1bdc94 |
|
|
|
1bdc94 |
diff --git a/migration/ram.c b/migration/ram.c
|
|
|
1bdc94 |
index 6e8a7e2..908879f 100644
|
|
|
1bdc94 |
--- a/migration/ram.c
|
|
|
1bdc94 |
+++ b/migration/ram.c
|
|
|
1bdc94 |
@@ -1013,6 +1013,34 @@ static bool control_save_page(RAMState *rs, RAMBlock *block, ram_addr_t offset,
|
|
|
1bdc94 |
return true;
|
|
|
1bdc94 |
}
|
|
|
1bdc94 |
|
|
|
1bdc94 |
+/*
|
|
|
1bdc94 |
+ * directly send the page to the stream
|
|
|
1bdc94 |
+ *
|
|
|
1bdc94 |
+ * Returns the number of pages written.
|
|
|
1bdc94 |
+ *
|
|
|
1bdc94 |
+ * @rs: current RAM state
|
|
|
1bdc94 |
+ * @block: block that contains the page we want to send
|
|
|
1bdc94 |
+ * @offset: offset inside the block for the page
|
|
|
1bdc94 |
+ * @buf: the page to be sent
|
|
|
1bdc94 |
+ * @async: send to page asyncly
|
|
|
1bdc94 |
+ */
|
|
|
1bdc94 |
+static int save_normal_page(RAMState *rs, RAMBlock *block, ram_addr_t offset,
|
|
|
1bdc94 |
+ uint8_t *buf, bool async)
|
|
|
1bdc94 |
+{
|
|
|
1bdc94 |
+ ram_counters.transferred += save_page_header(rs, rs->f, block,
|
|
|
1bdc94 |
+ offset | RAM_SAVE_FLAG_PAGE);
|
|
|
1bdc94 |
+ if (async) {
|
|
|
1bdc94 |
+ qemu_put_buffer_async(rs->f, buf, TARGET_PAGE_SIZE,
|
|
|
1bdc94 |
+ migrate_release_ram() &
|
|
|
1bdc94 |
+ migration_in_postcopy());
|
|
|
1bdc94 |
+ } else {
|
|
|
1bdc94 |
+ qemu_put_buffer(rs->f, buf, TARGET_PAGE_SIZE);
|
|
|
1bdc94 |
+ }
|
|
|
1bdc94 |
+ ram_counters.transferred += TARGET_PAGE_SIZE;
|
|
|
1bdc94 |
+ ram_counters.normal++;
|
|
|
1bdc94 |
+ return 1;
|
|
|
1bdc94 |
+}
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
/**
|
|
|
1bdc94 |
* ram_save_page: send the given page to the stream
|
|
|
1bdc94 |
*
|
|
|
1bdc94 |
@@ -1053,18 +1081,7 @@ static int ram_save_page(RAMState *rs, PageSearchStatus *pss, bool last_stage)
|
|
|
1bdc94 |
|
|
|
1bdc94 |
/* XBZRLE overflow or normal page */
|
|
|
1bdc94 |
if (pages == -1) {
|
|
|
1bdc94 |
- ram_counters.transferred +=
|
|
|
1bdc94 |
- save_page_header(rs, rs->f, block, offset | RAM_SAVE_FLAG_PAGE);
|
|
|
1bdc94 |
- if (send_async) {
|
|
|
1bdc94 |
- qemu_put_buffer_async(rs->f, p, TARGET_PAGE_SIZE,
|
|
|
1bdc94 |
- migrate_release_ram() &
|
|
|
1bdc94 |
- migration_in_postcopy());
|
|
|
1bdc94 |
- } else {
|
|
|
1bdc94 |
- qemu_put_buffer(rs->f, p, TARGET_PAGE_SIZE);
|
|
|
1bdc94 |
- }
|
|
|
1bdc94 |
- ram_counters.transferred += TARGET_PAGE_SIZE;
|
|
|
1bdc94 |
- pages = 1;
|
|
|
1bdc94 |
- ram_counters.normal++;
|
|
|
1bdc94 |
+ pages = save_normal_page(rs, block, offset, p, send_async);
|
|
|
1bdc94 |
}
|
|
|
1bdc94 |
|
|
|
1bdc94 |
XBZRLE_cache_unlock();
|
|
|
1bdc94 |
@@ -1195,14 +1212,7 @@ static int ram_save_compressed_page(RAMState *rs, PageSearchStatus *pss,
|
|
|
1bdc94 |
* we post it as normal page as compression will take much
|
|
|
1bdc94 |
* CPU resource.
|
|
|
1bdc94 |
*/
|
|
|
1bdc94 |
- ram_counters.transferred += save_page_header(rs, rs->f, block,
|
|
|
1bdc94 |
- offset | RAM_SAVE_FLAG_PAGE);
|
|
|
1bdc94 |
- qemu_put_buffer_async(rs->f, p, TARGET_PAGE_SIZE,
|
|
|
1bdc94 |
- migrate_release_ram() &
|
|
|
1bdc94 |
- migration_in_postcopy());
|
|
|
1bdc94 |
- ram_counters.transferred += TARGET_PAGE_SIZE;
|
|
|
1bdc94 |
- ram_counters.normal++;
|
|
|
1bdc94 |
- pages = 1;
|
|
|
1bdc94 |
+ pages = save_normal_page(rs, block, offset, p, true);
|
|
|
1bdc94 |
} else {
|
|
|
1bdc94 |
pages = compress_page_with_multi_thread(rs, block, offset);
|
|
|
1bdc94 |
}
|
|
|
1bdc94 |
--
|
|
|
1bdc94 |
1.8.3.1
|
|
|
1bdc94 |
|