Add a cpr-luo migration blocker for anonymous memory. cpr-luo requires
shared memory, and therefore cannot use memory-backend-ram,
memory-backend-memfd, or memory-backend-shm when "share=on" or
"aux-ram-share=on" is unavailable.

Here is an example if I use regular "-m 8G".

(qemu) migrate_set_parameter mode cpr-luo
(qemu) migrate file:cpr-luo.state
Error: Memory region pc.ram is not compatible with CPR. share=on is
  required for memory-backend objects, and aux-ram-share=on is required.

Signed-off-by: Dongli Zhang <[email protected]>
---
MIG_MODE_CPR_EXEC is missing from some existing blockers found with cscope
"cs find s MIG_MODE_CPR_TRANSFER". I may fix them and send the changes as
an independent patchset.

 system/physmem.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/system/physmem.c b/system/physmem.c
index 263acb5727..fcf40ca3f8 100644
--- a/system/physmem.c
+++ b/system/physmem.c
@@ -2246,7 +2246,8 @@ static void ram_block_add(RAMBlock *new_block, Error 
**errp)
                        "which is not supported with CPR.",
                        memory_region_name(new_block->mr));
             migrate_add_blocker_modes(&new_block->cpr_blocker,
-                                      BIT(MIG_MODE_CPR_TRANSFER), errp);
+                    BIT(MIG_MODE_CPR_TRANSFER) | BIT(MIG_MODE_CPR_LUO),
+                    errp);
         }
     }
 
@@ -4539,8 +4540,9 @@ void ram_block_add_cpr_blocker(RAMBlock *rb, Error **errp)
                "Memory region %s is not compatible with CPR. share=on is "
                "required for memory-backend objects, and aux-ram-share=on is "
                "required.", memory_region_name(rb->mr));
-    migrate_add_blocker_modes(&rb->cpr_blocker, BIT(MIG_MODE_CPR_TRANSFER),
-                              errp);
+    migrate_add_blocker_modes(&rb->cpr_blocker,
+            BIT(MIG_MODE_CPR_TRANSFER) | BIT(MIG_MODE_CPR_LUO),
+            errp);
 }
 
 void ram_block_del_cpr_blocker(RAMBlock *rb)
-- 
2.43.5


Reply via email to