summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yang2019-10-26 01:19:59 +0200
committerJuan Quintela2020-01-20 09:10:23 +0100
commiteab54aa78ffd9fb7895b20fc2761ee998479489b (patch)
tree5f50e11218af82fcf75e4539a9a4eb4236b9af0e
parentmigration/postcopy: enable compress during postcopy (diff)
downloadqemu-eab54aa78ffd9fb7895b20fc2761ee998479489b.tar.gz
qemu-eab54aa78ffd9fb7895b20fc2761ee998479489b.tar.xz
qemu-eab54aa78ffd9fb7895b20fc2761ee998479489b.zip
migration/multifd: clean pages after filling packet
This is a preparation for the next patch: not use multifd during postcopy. Without enabling postcopy, everything looks good. While after enabling postcopy, migration may fail even not use multifd during postcopy. The reason is the pages is not properly cleared and *old* target page will continue to be transferred. After clean pages, migration succeeds. Signed-off-by: Wei Yang <richardw.yang@linux.intel.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
-rw-r--r--migration/ram.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/migration/ram.c b/migration/ram.c
index 5f20c3d15d..a05448c0c9 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -955,10 +955,10 @@ static int multifd_send_pages(RAMState *rs)
}
qemu_mutex_unlock(&p->mutex);
}
- p->pages->used = 0;
+ assert(!p->pages->used);
+ assert(!p->pages->block);
p->packet_num = multifd_send_state->packet_num++;
- p->pages->block = NULL;
multifd_send_state->pages = p->pages;
p->pages = pages;
transferred = ((uint64_t) pages->used) * TARGET_PAGE_SIZE + p->packet_len;
@@ -1154,6 +1154,8 @@ static void *multifd_send_thread(void *opaque)
p->flags = 0;
p->num_packets++;
p->num_pages += used;
+ p->pages->used = 0;
+ p->pages->block = NULL;
qemu_mutex_unlock(&p->mutex);
trace_multifd_send(p->id, packet_num, used, flags,