thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

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