thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-migration-multifd-clean-pages-after-filling-packet.patch

22c213
From 32ee75b7f4a31d6080e5659e2a0285a046ef1036 Mon Sep 17 00:00:00 2001
22c213
From: Juan Quintela <quintela@redhat.com>
22c213
Date: Tue, 3 Mar 2020 14:51:34 +0000
22c213
Subject: [PATCH 02/18] migration/multifd: clean pages after filling packet
22c213
22c213
RH-Author: Juan Quintela <quintela@redhat.com>
22c213
Message-id: <20200303145143.149290-2-quintela@redhat.com>
22c213
Patchwork-id: 94112
22c213
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 01/10] migration/multifd: clean pages after filling packet
22c213
Bugzilla: 1738451
22c213
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
22c213
RH-Acked-by: Peter Xu <peterx@redhat.com>
22c213
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
22c213
22c213
From: Wei Yang <richardw.yang@linux.intel.com>
22c213
22c213
This is a preparation for the next patch:
22c213
22c213
    not use multifd during postcopy.
22c213
22c213
Without enabling postcopy, everything looks good. While after enabling
22c213
postcopy, migration may fail even not use multifd during postcopy. The
22c213
reason is the pages is not properly cleared and *old* target page will
22c213
continue to be transferred.
22c213
22c213
After clean pages, migration succeeds.
22c213
22c213
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
22c213
Reviewed-by: Juan Quintela <quintela@redhat.com>
22c213
Signed-off-by: Juan Quintela <quintela@redhat.com>
22c213
(cherry picked from commit eab54aa78ffd9fb7895b20fc2761ee998479489b)
22c213
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
22c213
---
22c213
 migration/ram.c | 6 ++++--
22c213
 1 file changed, 4 insertions(+), 2 deletions(-)
22c213
22c213
diff --git a/migration/ram.c b/migration/ram.c
22c213
index 5078f94..65580e3 100644
22c213
--- a/migration/ram.c
22c213
+++ b/migration/ram.c
22c213
@@ -944,10 +944,10 @@ static int multifd_send_pages(RAMState *rs)
22c213
         }
22c213
         qemu_mutex_unlock(&p->mutex);
22c213
     }
22c213
-    p->pages->used = 0;
22c213
+    assert(!p->pages->used);
22c213
+    assert(!p->pages->block);
22c213
 
22c213
     p->packet_num = multifd_send_state->packet_num++;
22c213
-    p->pages->block = NULL;
22c213
     multifd_send_state->pages = p->pages;
22c213
     p->pages = pages;
22c213
     transferred = ((uint64_t) pages->used) * TARGET_PAGE_SIZE + p->packet_len;
22c213
@@ -1129,6 +1129,8 @@ static void *multifd_send_thread(void *opaque)
22c213
             p->flags = 0;
22c213
             p->num_packets++;
22c213
             p->num_pages += used;
22c213
+            p->pages->used = 0;
22c213
+            p->pages->block = NULL;
22c213
             qemu_mutex_unlock(&p->mutex);
22c213
 
22c213
             trace_multifd_send(p->id, packet_num, used, flags,
22c213
-- 
22c213
1.8.3.1
22c213