render / rpms / qemu

Forked from rpms/qemu 11 months ago
Clone
232601
From 0c0baf37eaaccff09f8b75015cad0dacc997ff87 Mon Sep 17 00:00:00 2001
232601
From: Fabiano Rosas <farosas@suse.de>
232601
Date: Fri, 13 Dec 2024 10:30:40 -0300
232601
Subject: [PATCH] migration/multifd: Fix compat with QEMU < 9.0
232601
232601
Commit f5f48a7891 ("migration/multifd: Separate SYNC request with
232601
normal jobs") changed the multifd source side to stop sending data
232601
along with the MULTIFD_FLAG_SYNC, effectively introducing the concept
232601
of a SYNC-only packet. Relying on that, commit d7e58f412c
232601
("migration/multifd: Don't send ram data during SYNC") later came
232601
along and skipped reading data from SYNC packets.
232601
232601
In a versions timeline like this:
232601
232601
  8.2 f5f48a7 9.0 9.1 d7e58f41 9.2
232601
232601
The issue arises that QEMUs < 9.0 still send data along with SYNC, but
232601
QEMUs > 9.1 don't gather that data anymore. This leads to various
232601
kinds of migration failures due to desync/missing data.
232601
232601
Stop checking for a SYNC packet on the destination and unconditionally
232601
unfill the packet.
232601
232601
From now on:
232601
232601
old -> new:
232601
the source sends data + sync, destination reads normally
232601
232601
new -> new:
232601
source sends only sync, destination reads zeros
232601
232601
new -> old:
232601
source sends only sync, destination reads zeros
232601
232601
CC: qemu-stable@nongnu.org
232601
Fixes: d7e58f412c ("migration/multifd: Don't send ram data during SYNC")
232601
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2720
232601
Signed-off-by: Fabiano Rosas <farosas@suse.de>
232601
---
232601
 migration/multifd.c | 15 +++++++++------
232601
 1 file changed, 9 insertions(+), 6 deletions(-)
232601
232601
diff --git a/migration/multifd.c b/migration/multifd.c
232601
index 498e71fd102..8d0a763a720 100644
232601
--- a/migration/multifd.c
232601
+++ b/migration/multifd.c
232601
@@ -252,9 +252,8 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp)
232601
     p->packet_num = be64_to_cpu(packet->packet_num);
232601
     p->packets_recved++;
232601
 
232601
-    if (!(p->flags & MULTIFD_FLAG_SYNC)) {
232601
-        ret = multifd_ram_unfill_packet(p, errp);
232601
-    }
232601
+    /* Always unfill, old QEMUs (<9.0) send data along with SYNC */
232601
+    ret = multifd_ram_unfill_packet(p, errp);
232601
 
232601
     trace_multifd_recv_unfill(p->id, p->packet_num, p->flags,
232601
                               p->next_packet_size);
232601
@@ -1151,9 +1150,13 @@ static void *multifd_recv_thread(void *opaque)
232601
             flags = p->flags;
232601
             /* recv methods don't know how to handle the SYNC flag */
232601
             p->flags &= ~MULTIFD_FLAG_SYNC;
232601
-            if (!(flags & MULTIFD_FLAG_SYNC)) {
232601
-                has_data = p->normal_num || p->zero_num;
232601
-            }
232601
+
232601
+            /*
232601
+             * Even if it's a SYNC packet, this needs to be set
232601
+             * because older QEMUs (<9.0) still send data along with
232601
+             * the SYNC packet.
232601
+             */
232601
+            has_data = p->normal_num || p->zero_num;
232601
             qemu_mutex_unlock(&p->mutex);
232601
         } else {
232601
             /*
232601
-- 
232601
GitLab
232601