[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/12] Restart optimization on stage3 update version
From: |
Orit Wasserman |
Subject: |
[Qemu-devel] [PATCH 12/12] Restart optimization on stage3 update version |
Date: |
Mon, 6 Aug 2012 21:42:58 +0300 |
From: Juan Quintela <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>
---
arch_init.c | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 5f864a6..5181953 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -273,14 +273,16 @@ static void save_block_hdr(QEMUFile *f, RAMBlock *block,
ram_addr_t offset,
static int save_xbzrle_page(QEMUFile *f, uint8_t *current_data,
ram_addr_t current_addr, RAMBlock *block,
- ram_addr_t offset, int cont)
+ ram_addr_t offset, int cont, bool last_stage)
{
int encoded_len = 0, bytes_sent = -1;
uint8_t *prev_cached_page;
if (!cache_is_cached(XBZRLE.cache, current_addr)) {
- cache_insert(XBZRLE.cache, current_addr,
- g_memdup(current_data, TARGET_PAGE_SIZE));
+ if (!last_stage) {
+ cache_insert(XBZRLE.cache, current_addr,
+ g_memdup(current_data, TARGET_PAGE_SIZE));
+ }
acct_info.xbzrle_cache_miss++;
return -1;
}
@@ -306,7 +308,9 @@ static int save_xbzrle_page(QEMUFile *f, uint8_t
*current_data,
}
/* we need to update the data in the cache, in order to get the same data
*/
- memcpy(prev_cached_page, XBZRLE.current_buf, TARGET_PAGE_SIZE);
+ if (!last_stage) {
+ memcpy(prev_cached_page, XBZRLE.current_buf, TARGET_PAGE_SIZE);
+ }
/* Send XBZRLE based compressed page */
save_block_hdr(f, block, offset, cont, RAM_SAVE_FLAG_XBZRLE);
@@ -331,7 +335,7 @@ static ram_addr_t last_offset;
* n: the amount of bytes written in other case
*/
-static int ram_save_block(QEMUFile *f)
+static int ram_save_block(QEMUFile *f, bool last_stage)
{
RAMBlock *block = last_block;
ram_addr_t offset = last_offset;
@@ -362,8 +366,10 @@ static int ram_save_block(QEMUFile *f)
} else if (migrate_use_xbzrle()) {
current_addr = block->offset + offset;
bytes_sent = save_xbzrle_page(f, p, current_addr, block,
- offset, cont);
- p = get_cached_data(XBZRLE.cache, current_addr);
+ offset, cont, last_stage);
+ if (!last_stage) {
+ p = get_cached_data(XBZRLE.cache, current_addr);
+ }
}
/* either we didn't send yet (we may have had XBZRLE overflow) */
@@ -536,7 +542,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
while ((ret = qemu_file_rate_limit(f)) == 0) {
int bytes_sent;
- bytes_sent = ram_save_block(f);
+ bytes_sent = ram_save_block(f, false);
/* no more blocks to sent */
if (bytes_sent < 0) {
break;
@@ -598,7 +604,7 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
while (true) {
int bytes_sent;
- bytes_sent = ram_save_block(f);
+ bytes_sent = ram_save_block(f, true);
/* no more blocks to sent */
if (bytes_sent < 0) {
break;
--
1.7.7.6
- [Qemu-devel] [PATCH 00/12] Migration next v12, Orit Wasserman, 2012/08/06
- [Qemu-devel] [PATCH 01/12] Add migration capabilities, Orit Wasserman, 2012/08/06
- [Qemu-devel] [PATCH 02/12] Add migrate-set-capabilities, Orit Wasserman, 2012/08/06
- [Qemu-devel] [PATCH 03/12] Add XBZRLE documentation, Orit Wasserman, 2012/08/06
- [Qemu-devel] [PATCH 06/12] Add xbzrle_encode_buffer and xbzrle_decode_buffer functions, Orit Wasserman, 2012/08/06
- [Qemu-devel] [PATCH 05/12] Add uleb encoding/decoding functions, Orit Wasserman, 2012/08/06
- [Qemu-devel] [PATCH 07/12] Add XBZRLE to ram_save_block and ram_save_live, Orit Wasserman, 2012/08/06
- [Qemu-devel] [PATCH 09/12] Change total_time to total-time in MigrationStats, Orit Wasserman, 2012/08/06
- [Qemu-devel] [PATCH 10/12] Add migration accounting for normal and duplicate pages, Orit Wasserman, 2012/08/06
- [Qemu-devel] [PATCH 04/12] Add cache handling functions, Orit Wasserman, 2012/08/06
- [Qemu-devel] [PATCH 12/12] Restart optimization on stage3 update version,
Orit Wasserman <=
- [Qemu-devel] [PATCH 08/12] Add migrate_set_cache_size command, Orit Wasserman, 2012/08/06
- Re: [Qemu-devel] [PATCH 00/12] Migration next v12, Eric Blake, 2012/08/06
- [Qemu-devel] [PATCH 11/12] Add XBZRLE statistics, Orit Wasserman, 2012/08/06
- Re: [Qemu-devel] [PATCH 00/12] Migration next v12, Luiz Capitulino, 2012/08/07