diff mbox series

[RFC,1/1] migration: Remove vmstate_unregister_ram

Message ID 20191209074102.5926-2-yury-kotov@yandex-team.ru (mailing list archive)
State New, archived
Headers show
Series Removing RAMBlocks during migration | expand

Commit Message

Yury Kotov Dec. 9, 2019, 7:41 a.m. UTC
Disclaimer: This is just an RFC.
It's more an illustration-patch than real patch. And I didn't verify the
possible side effects!

Currently, it's possible to call this function during migration.
And so, to have a race condition between migration thread and main
thread.

It seems that all calls of this function are just before
MemoryRegion deletion. Thus, there is no effect of this function
actually.

Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru>
---
 hw/block/pflash_cfi01.c     | 1 -
 hw/block/pflash_cfi02.c     | 1 -
 hw/mem/pc-dimm.c            | 5 -----
 hw/misc/ivshmem.c           | 2 --
 hw/pci/pci.c                | 1 -
 include/migration/vmstate.h | 1 -
 migration/savevm.c          | 6 ------
 7 files changed, 17 deletions(-)
diff mbox series

Patch

diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index 54e6ebd385..1d0cc9e576 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -763,7 +763,6 @@  static void pflash_cfi01_realize(DeviceState *dev, Error **errp)
     if (pfl->blk) {
         if (!blk_check_size_and_read_all(pfl->blk, pfl->storage, total_len,
                                          errp)) {
-            vmstate_unregister_ram(&pfl->mem, DEVICE(pfl));
             return;
         }
     }
diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c
index c7d92c3e79..1abe1120bf 100644
--- a/hw/block/pflash_cfi02.c
+++ b/hw/block/pflash_cfi02.c
@@ -810,7 +810,6 @@  static void pflash_cfi02_realize(DeviceState *dev, Error **errp)
     if (pfl->blk) {
         if (!blk_check_size_and_read_all(pfl->blk, pfl->storage,
                                          pfl->chip_len, errp)) {
-            vmstate_unregister_ram(&pfl->orig_mem, DEVICE(pfl));
             return;
         }
     }
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index 99e2faf01b..f8cb5233ee 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -76,12 +76,7 @@  void pc_dimm_plug(PCDIMMDevice *dimm, MachineState *machine, Error **errp)
 
 void pc_dimm_unplug(PCDIMMDevice *dimm, MachineState *machine)
 {
-    PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm);
-    MemoryRegion *vmstate_mr = ddc->get_vmstate_memory_region(dimm,
-                                                              &error_abort);
-
     memory_device_unplug(MEMORY_DEVICE(dimm), machine);
-    vmstate_unregister_ram(vmstate_mr, DEVICE(dimm));
 }
 
 static int pc_dimm_slot2bitmap(Object *obj, void *opaque)
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 5e3b05eae0..f31e313dec 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -973,8 +973,6 @@  static void ivshmem_exit(PCIDevice *dev)
             fd = memory_region_get_fd(s->ivshmem_bar2);
             close(fd);
         }
-
-        vmstate_unregister_ram(s->ivshmem_bar2, DEVICE(dev));
     }
 
     if (s->hostmem) {
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index cbc7a32568..8a719e2bfa 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2371,7 +2371,6 @@  static void pci_del_option_rom(PCIDevice *pdev)
     if (!pdev->has_rom)
         return;
 
-    vmstate_unregister_ram(&pdev->rom, &pdev->qdev);
     pdev->has_rom = false;
 }
 
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index ac4f46a67d..f298de44a7 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -1176,7 +1176,6 @@  void vmstate_unregister(DeviceState *dev, const VMStateDescription *vmsd,
 
 struct MemoryRegion;
 void vmstate_register_ram(struct MemoryRegion *memory, DeviceState *dev);
-void vmstate_unregister_ram(struct MemoryRegion *memory, DeviceState *dev);
 void vmstate_register_ram_global(struct MemoryRegion *memory);
 
 bool vmstate_check_only_migratable(const VMStateDescription *vmsd);
diff --git a/migration/savevm.c b/migration/savevm.c
index a71b930b91..4b3a7b1b76 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2915,12 +2915,6 @@  void vmstate_register_ram(MemoryRegion *mr, DeviceState *dev)
     qemu_ram_set_migratable(mr->ram_block);
 }
 
-void vmstate_unregister_ram(MemoryRegion *mr, DeviceState *dev)
-{
-    qemu_ram_unset_idstr(mr->ram_block);
-    qemu_ram_unset_migratable(mr->ram_block);
-}
-
 void vmstate_register_ram_global(MemoryRegion *mr)
 {
     vmstate_register_ram(mr, NULL);