Sorry, I made an error in this patch that break the migration.

On 12/8/22 10:44, Pierre Morel wrote:

+
+const VMStateDescription vmstate_cpu_topology = {
+    .name = "cpu_topology",
+    .version_id = 1,
+    .post_load = cpu_topology_postload,
+    .minimum_version_id = 1,
+    .needed = cpu_topology_needed,
+};

Here having no VMStateField break the migration.
Since there will be a new spin I will change this in the next with something like this where I also add the saving of the mtcr before the migration to set it back after the migration.


+/**
+ * cpu_topology_post_load
+ * @opaque: a pointer to the S390Topology
+ * @version_id: version identifier
+ *
+ * We check that the topology is used or is not used
+ * on both side identically.
+ *
+ * If the topology is in use we set the Modified Topology Change Report
+ * on the destination host.
+ */
+static int cpu_topology_post_load(void *opaque, int version_id)
+{
+    S390Topology *topo = opaque;
+    int ret;
+
+    /* Set the MTCR to the saved value */
+    ret = s390_cpu_topology_mtcr_set(topo->mtcr);
+    if (ret) {
+        error_report("Failed to set MTCR: %s", strerror(-ret));
+    }
+    return ret;
+}
+
+/**
+ * cpu_topology_pre_save:
+ * @opaque: The pointer to the S390Topology
+ *
+ * Save the usage of the CPU Topology in the VM State.
+ */
+static int cpu_topology_pre_save(void *opaque)
+{
+    S390Topology *topo = opaque;
+
+    return  s390_cpu_topology_mtcr_get(&topo->mtcr);
+}
+
+/**
+ * cpu_topology_needed:
+ * @opaque: The pointer to the S390Topology
+ *
+ * We always need to know if source and destination use the topology.
+ */
+static bool cpu_topology_needed(void *opaque)
+{
+    return true;
+}
+
+const VMStateDescription vmstate_cpu_topology = {
+    .name = "cpu_topology",
+    .version_id = 1,
+    .post_load = cpu_topology_post_load,
+    .pre_save = cpu_topology_pre_save,
+    .minimum_version_id = 1,
+    .needed = cpu_topology_needed,
+    .fields = (VMStateField[]) {
+        VMSTATE_UINT8(mtcr, S390Topology),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
--
Pierre Morel
IBM Lab Boeblingen

Reply via email to