+ * Return true if ram is compatible with CPR.  Do not exclude rom,
+ * because the rom file could change in new QEMU.
+ */
+static bool ram_is_cpr_compatible(RAMBlock *rb)
+{
+    MemoryRegion *mr = rb->mr;
+
+    if (!mr || !memory_region_is_ram(mr)) {
+        return true;
+    }
+
+    /* Ram device is remapped in new QEMU */
+    if (memory_region_is_ram_device(mr)) {
+        return true;
+    }
+
+    /* Named files are remapped in new QEMU, same contents if shared (no COW) 
*/
+    if (qemu_ram_is_shared(rb) && qemu_ram_is_named_file(rb)) {
+        return true;
+    }

In general

Reviewed-by: David Hildenbrand <da...@redhat.com>

just one more question:

+
+    /* A file descriptor is remapped in new QEMU */
+    if (rb->fd >= 0) {
+        return true;

This looks odd / wrong. Assume we have

!qemu_ram_is_shared(rb) || !qemu_ram_is_named_file(rb)

(negated condition above)

Why should having a fd be fine? It could just be MAP_PRIVATE/COW (which you document above) or an unnamed file?

--
Cheers,

David / dhildenb


Reply via email to