Skip to contentSkip to conversation

hw/intc/s390_flic: Fix interrupt controller migration on s390x with TCG

PATCH New Thomas Huth 1 participant 1 message Jun 19, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/intc/s390_flic: Fix interrupt controller migration on s390x with TCG

Migration of a s390x guest with TCG was long known to be very unstable, so the tests in tests/qtest/migration-test.c are disabled if running with TCG instead of KVM.

Nicholas Piggin did a great analysis of the problem:

"The flic pending state is not migrated, so if the machine is migrated
while an interrupt is pending, it can be lost. This shows up in qtest migration test, an extint is pending (due to console writes?) and the CPU waits via s390_cpu_set_psw and expects the interrupt to wake it. However when the flic pending state is lost, s390_cpu_has_int returns false, so s390_cpu_exec_interrupt falls through to halting again."

Thus let's finally migrate the pending state, and to be on the safe side, also the other state variables of the QEMUS390FLICState structure.

---
Once this has been merged, we can enable the migration-test again with Nicholas' patch here:
https://lore.kernel.org/qemu-devel/[email protected]/

 include/hw/s390x/s390_flic.h |  1 +
 hw/intc/s390_flic.c          | 75 ++++++++++++++++++++++++++++++++++--
 hw/s390x/s390-virtio-ccw.c   |  5 +++
 3 files changed, 78 insertions(+), 3 deletions(-)
include/hw/s390x/s390_flic.h +1 -0
index 382d9833f1..4d66c5e42e 100644
@@ -116,6 +116,7 @@ struct QEMUS390FLICState {
     uint8_t simm;
     uint8_t nimm;
     QLIST_HEAD(, QEMUS390FlicIO) io[8];
+    bool migrate_all_state;
 };
 
 uint32_t qemu_s390_flic_dequeue_service(QEMUS390FLICState *flic);
hw/intc/s390_flic.c +72 -3

98 lines not on this page · raw message

hw/s390x/s390-virtio-ccw.c +5 -0
index cd063f8b64..f87ca36264 100644
@@ -863,8 +863,13 @@ static void ccw_machine_9_0_instance_options(MachineState *machine)
 
 static void ccw_machine_9_0_class_options(MachineClass *mc)
 {
+    static GlobalProperty compat[] = {
+        { TYPE_QEMU_S390_FLIC, "migrate-all-state", "off", },
+    };
+
     ccw_machine_9_1_class_options(mc);
     compat_props_add(mc->compat_props, hw_compat_9_0, hw_compat_9_0_len);
+    compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat));
 }
 DEFINE_CCW_MACHINE(9_0, "9.0", false);
 
Signature · 1 line
2.45.2