diff mbox series

[1/2] migration/multifd: clean pages after filling packet

Message ID 20191025232000.25857-2-richardw.yang@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series not use multifd during postcopy | expand

Commit Message

Wei Yang Oct. 25, 2019, 11:19 p.m. UTC
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>
---
 migration/ram.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Juan Quintela Nov. 19, 2019, 10:54 a.m. UTC | #1
Wei Yang <richardw.yang@linux.intel.com> wrote:
> 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>

I don't like asserts, but I understand why you put them there.
diff mbox series

Patch

diff --git a/migration/ram.c b/migration/ram.c
index 80dd2d55f9..7087bb73ed 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -929,10 +929,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;
@@ -1114,6 +1114,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,