Skip to contentSkip to conversation

migration: Fix regressions

PATCH In review Fabiano Rosas 3 participants 5 messages Dec 13, 2024 – Dec 16, 2024

lore
Share & tools
lore
#0 lore raw

cover migration: Fix regressions

Hello,

A couple of fixes for regressions we have open in gitlab:

multifd from old QEMUs - https://gitlab.com/qemu-project/qemu/-/issues/2720
s390x CSS - https://gitlab.com/qemu-project/qemu/-/issues/2704

CI run: https://gitlab.com/farosas/qemu/-/pipelines/1587733433

Fabiano Rosas (2):
migration/multifd: Fix compat with QEMU < 9.0
s390x: Fix CSS migration

 hw/s390x/s390-virtio-ccw.c |  2 +-
 migration/multifd.c        | 15 +++++++++------
 2 files changed, 10 insertions(+), 7 deletions(-)
Signature · 1 line
2.35.3
#1 lore raw

PATCH 1/2 migration/multifd: Fix compat with QEMU < 9.0

Commit f5f48a7891 ("migration/multifd: Separate SYNC request with normal jobs") changed the multifd source side to stop sending data along with the MULTIFD_FLAG_SYNC, effectively introducing the concept of a SYNC-only packet. Relying on that, commit d7e58f412c ("migration/multifd: Don't send ram data during SYNC") later came along and skipped reading data from SYNC packets.

In a versions timeline like this:

8.2 f5f48a7 9.0 9.1 d7e58f41 9.2

The issue arises that QEMUs < 9.0 still send data along with SYNC, but QEMUs > 9.1 don't gather that data anymore. This leads to various kinds of migration failures due to desync/missing data.

Stop checking for a SYNC packet on the destination and unconditionally unfill the packet.

From now on:

old -> new:
the source sends data + sync, destination reads normally

new -> new:
source sends only sync, destination reads zeros

new -> old:
source sends only sync, destination reads zeros

Fixes d7e58f412c ("migration/multifd: Don't send ram data during SYNC")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2720

---
 migration/multifd.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
migration/multifd.c +9 -6
index 498e71fd10..8d0a763a72 100644
@@ -252,9 +252,8 @@ static int multifd_recv_unfill_packet(MultiFDRecvParams *p, Error **errp)
     p->packet_num = be64_to_cpu(packet->packet_num);
     p->packets_recved++;
 
-    if (!(p->flags & MULTIFD_FLAG_SYNC)) {
-        ret = multifd_ram_unfill_packet(p, errp);
-    }
+    /* Always unfill, old QEMUs (<9.0) send data along with SYNC */
+    ret = multifd_ram_unfill_packet(p, errp);
 
     trace_multifd_recv_unfill(p->id, p->packet_num, p->flags,
                               p->next_packet_size);
@@ -1151,9 +1150,13 @@ static void *multifd_recv_thread(void *opaque)
             flags = p->flags;
             /* recv methods don't know how to handle the SYNC flag */
             p->flags &= ~MULTIFD_FLAG_SYNC;
-            if (!(flags & MULTIFD_FLAG_SYNC)) {
-                has_data = p->normal_num || p->zero_num;
-            }
+
+            /*
+             * Even if it's a SYNC packet, this needs to be set
+             * because older QEMUs (<9.0) still send data along with
+             * the SYNC packet.
+             */
+            has_data = p->normal_num || p->zero_num;
             qemu_mutex_unlock(&p->mutex);
         } else {
             /*
Signature · 1 line
2.35.3
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] migration/multifd: Fix compat with QEMU < 9.0

Quoted 26 lines · Fabiano Rosas

Commit f5f48a7891 ("migration/multifd: Separate SYNC request with normal jobs") changed the multifd source side to stop sending data along with the MULTIFD_FLAG_SYNC, effectively introducing the concept of a SYNC-only packet. Relying on that, commit d7e58f412c ("migration/multifd: Don't send ram data during SYNC") later came along and skipped reading data from SYNC packets.

In a versions timeline like this:

8.2 f5f48a7 9.0 9.1 d7e58f41 9.2

The issue arises that QEMUs < 9.0 still send data along with SYNC, but QEMUs > 9.1 don't gather that data anymore. This leads to various kinds of migration failures due to desync/missing data.

Stop checking for a SYNC packet on the destination and unconditionally unfill the packet.

From now on:

old -> new:
the source sends data + sync, destination reads normally

new -> new:
source sends only sync, destination reads zeros

Quoted 7 lines

new -> old:
source sends only sync, destination reads zeros

Fixes d7e58f412c ("migration/multifd: Don't send ram data during SYNC")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2720

Signature · 1 line
Peter Xu
#3 lore raw

PATCH 2/2 s390x: Fix CSS migration

In reply to Fabiano Rosas

Commit a55ae46683 ("s390: move css_migration_enabled from machine to css.c") disabled CSS migration globally instead of doing it per-instance.

CC Paolo Bonzini <[email protected]>
Fixes a55ae46683 ("s390: move css_migration_enabled from machine to css.c")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2704

---
Consider enabling migration-compat-s390x in CI, it would have caught this. It's too late for this development cycle because the backward migration is broken, but in 10.1 both sides will agree on the css_migration_enabled value.

---
 hw/s390x/s390-virtio-ccw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/s390x/s390-virtio-ccw.c +1 -1
index fe03f716f3..701b2d4e2e 100644
@@ -1189,6 +1189,7 @@ static void ccw_machine_2_9_instance_options(MachineState *machine)
     s390_cpudef_featoff_greater(12, 1, S390_FEAT_ZPCI);
     s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_INT_SUPPRESSION);
     s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_EVENT_NOTIFICATION);
+    css_migration_enabled = false;
 }
 
 static void ccw_machine_2_9_class_options(MachineClass *mc)
@@ -1201,7 +1202,6 @@ static void ccw_machine_2_9_class_options(MachineClass *mc)
     ccw_machine_2_10_class_options(mc);
     compat_props_add(mc->compat_props, hw_compat_2_9, hw_compat_2_9_len);
     compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
-    css_migration_enabled = false;
 }
 DEFINE_CCW_MACHINE(2, 9);
 
Signature · 1 line
2.35.3
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] s390x: Fix CSS migration

Quoted 31 lines · Fabiano Rosas

Commit a55ae46683 ("s390: move css_migration_enabled from machine to css.c") disabled CSS migration globally instead of doing it per-instance.

CC Paolo Bonzini <[email protected]>
Fixes a55ae46683 ("s390: move css_migration_enabled from machine to css.c")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2704

---
Consider enabling migration-compat-s390x in CI, it would have caught this. It's too late for this development cycle because the backward migration is broken, but in 10.1 both sides will agree on the css_migration_enabled value.

---
  hw/s390x/s390-virtio-ccw.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/s390x/s390-virtio-ccw.c +1 -0
index fe03f716f3..701b2d4e2e 100644
@@ -1189,6 +1189,7 @@ static void ccw_machine_2_9_instance_options(MachineState *machine)
      s390_cpudef_featoff_greater(12, 1, S390_FEAT_ZPCI);
      s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_INT_SUPPRESSION);
      s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_EVENT_NOTIFICATION);
+    css_migration_enabled = false;
  }
 
  static void ccw_machine_2_9_class_options(MachineClass *mc)

hw/s390x/s390-virtio-ccw.c static void ccw_machine_2_9_class_options(MachineClass *mc) · line 1207

Quoted 7 lines
hw/s390x/s390-virtio-ccw.c +0 -1
@@ -1201,7 +1202,6 @@ static void ccw_machine_2_9_class_options(MachineClass *mc)
      ccw_machine_2_10_class_options(mc);
      compat_props_add(mc->compat_props, hw_compat_2_9, hw_compat_2_9_len);
      compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
-    css_migration_enabled = false;
  }
  DEFINE_CCW_MACHINE(2, 9);
 

D'oh!