Skip to contentSkip to conversation

Migration cleanup

PATCH Superseded Juan Quintela 4 participants 53 messages Apr 25, 2017 – May 13, 2017

Subsystems (3)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover Migration cleanup

Hi

In this second version:
- Move inclnude files to migration/ instead of include/migration/
- Split misc patches to other series
- Split MigrationParams to other series
- Split HMP commands to other series
- Make migration.h private
- Create include/migration/misc.h for functions that don't belong anywhere else
- Create include/migration/register.h for functions that register new vmsdescriptions
- Create global_state.c for that VMState Description
- Make savevm.c target indepedent
- Exported functions reorganization to minimize the number of changes
- Remove migration stuff from sysemu/sysemu.h (Why was it there in the 1st place.)
- Split vmstate-types.c from vmstate.c (now there is only the interpreter there).

ToDo:
- RAMBlocks are defined in ram_addr_t, which includes ramlists.h Clearly we should be able to have a better organization here, but it is eluding me.
- Lots of files include sysemu/sysemu.h because runstate_* functions are there, I think they deserve their own file.
- Split qmp commands from migration.c
- Reorganize savevm.c and migration.c to have less dependencies between them.

Please, comment.

[v1]
This is a cleanup on top of my previous series. It does:
- create one .h file for each migration/* file
- export with meaningful include names the migration functions that we export
- untangle the includes mess (migration.h in8cluded vmstate.h who included qemu-file.h). Fixed all callers.
- once there, old MigrationParams are gone. Now block migration can be configured with migration capabilities like everything else in migration (old command line parameters are maintained, but on top of this)
- start moving hmp* functions to monitor.c

ToDo:
- move the two remaining hmp commands to monitor.c

really I should move them to block/* something, because they all use block functions, nothing from migration.c.

- savevm.c/vmstate.c/migration.c: they are still tangled, but I wanted to send the easy parts for review.

- half of the savevm.c functions are still exported from sysemu/sysemu.h moving that to a different file, have to think about it to make patches easier to understand.

- split capabilities/qmp commands/... from migration.c they don't belong there, and once they are out it would be easier to untangle the remaining bits.

- goal is still untangle normal migration/xbzrle/compression and rdma, they are still too untangled together.

- I can still remove some includes that are not needed, but with the current code, it gets really complicated until there is more cleanup there.

Please, comment.

Juan Quintela (41):
migration: Create migration/blocker.h
migration: Split migration/channel.c for channel operations
migration: Remove MigrationState from migration_channel_incomming()
migration: Export qemu-file-channel.c functions in its own file
migration: Remove migration.h from colo.h
migration: Move colo.h to migration/
migration: Move failover.h to migration/colo-failover.h
migration: Move page_cache.c to migration/
migration: Move qjson.h to migration/
migration: Move postcopy-ram.h to migration/
migration: Split vmstate-types.c from vmstate.c
migration: Remove qemu-file.h from vmstate.h
migration: Remove vmstate.h from migration.h
migration: migration.h was not needed
migration: Create include for migration snapshots
migration: Rename {save,load}_vmstate to {save,load}_snapshot
migration: Create savevm.h for functions exported from savevm.c
migration: Split qemu-file.h
migration: Remove unneeded includes of migration/vmstate.h
migration: Export exec.c functions in its own file
migration: Export fd.c functions in its own file
migration: Export socket.c functions in its own file
migration: Export tls.c functions in its own file
migration: Export ram.c functions in its own file
migration: Export rdma.c functions in its own file
migration: Move include/migration/block.h into migration/
migration: Move self_announce_delay() to misc.h
migration: Split registration functions from vmstate.h
migration: loadvm_free_handlers is only used in migration/
migration: Move dump_vmsate_json_to_file() to misc.h
migration: Move postcopy stuff to postcopy-ram.c
migration: Move constants to savevm.h
migration: Commands are only used inside migration.c
migration: ram_control_* are implemented in qemu_file
migration: create global_state.c
migration: Move more exported functions to migration/misc.h
migration: Move last funtions to misc.h
migration: Move migration.h to migration/
exec: Create include for target_page_size()
migration: Make savevm.c target independent
migration: Remove unneeded includes

 MAINTAINERS                                        |   4 +-
 Makefile.objs                                      |   1 -
 Makefile.target                                    |   2 +-
 block/qcow.c                                       |   2 +-
 block/qed.c                                        |   1 -
 block/vdi.c                                        |   2 +-
 block/vhdx.c                                       |   2 +-
 block/vmdk.c                                       |   2 +-
 block/vpc.c                                        |   2 +-
 block/vvfat.c                                      |   2 +-
 exec.c                                             |  10 +
 hmp.c                                              |   5 +-
 hw/9pfs/9p.c                                       |   2 +-
 hw/core/qdev.c                                     |   1 -
 hw/display/qxl.c                                   |   2 +-
 hw/display/virtio-gpu.c                            |   2 +-
 hw/i2c/i2c-ddc.c                                   |   1 +
 hw/i386/pc_piix.c                                  |   3 +-
 hw/i386/pc_q35.c                                   |   1 -
 hw/intc/arm_gic_kvm.c                              |   2 +-
 hw/intc/arm_gicv3_its_kvm.c                        |   2 +-
 hw/intc/arm_gicv3_kvm.c                            |   2 +-
 hw/intc/s390_flic.c                                |   1 -
 hw/intc/s390_flic_kvm.c                            |   1 -
 hw/misc/ivshmem.c                                  |   2 +-
 hw/net/virtio-net.c                                |   1 +
 hw/net/vmxnet3.c                                   |   1 +
 hw/ppc/spapr.c                                     |   4 +-
 hw/s390x/s390-skeys.c                              |   2 +-
 hw/s390x/s390-virtio-ccw.c                         |   1 +
 hw/scsi/vhost-scsi.c                               |   2 +-
 hw/virtio/vhost-user.c                             |   1 -
 hw/virtio/vhost-vsock.c                            |   1 -
 hw/virtio/vhost.c                                  |   2 +-
 hw/virtio/virtio.c                                 |   1 -
 include/block/block_int.h                          |   4 +-
 include/exec/target_page.h                         |  22 +
 include/hw/acpi/memory_hotplug.h                   |   1 -
 include/hw/acpi/pcihp.h                            |   1 -
 include/hw/hw.h                                    |   1 +
 include/hw/pci/shpc.h                              |   1 -
 include/migration/blocker.h                        |  35 ++
 include/migration/global_state.h                   |  26 +
 include/migration/migration.h                      | 353 -----------
 include/migration/misc.h                           |  53 ++
 include/migration/qemu-file-types.h                | 164 +++++
 include/migration/register.h                       |  64 ++
 include/migration/snapshot.h                       |  20 +
 include/migration/vmstate.h                        |  62 --
 include/net/net.h                                  |   1 -
 include/sysemu/sysemu.h                            |  51 --
 migration/Makefile.objs                            |   6 +-
 migration/block.c                                  |  14 +-
 {include/migration => migration}/block.h           |   1 -
 migration/channel.c                                |  72 +++
 migration/channel.h                                |  24 +
 migration/colo-comm.c                              |   4 +-
 migration/colo-failover.c                          |   6 +-
 .../failover.h => migration/colo-failover.h        |   0
 migration/colo.c                                   |   8 +-
 {include/migration => migration}/colo.h            |   4 -
 migration/exec.c                                   |   6 +-
 migration/exec.h                                   |  20 +
 migration/fd.c                                     |   6 +-
 migration/fd.h                                     |  20 +
 migration/global_state.c                           | 142 +++++
 migration/migration.c                              | 261 ++------
 migration/migration.h                              | 167 +++++
 page_cache.c => migration/page_cache.c             |   0
 {include/migration => migration}/page_cache.h      |   0
 migration/postcopy-ram.c                           |  28 +-
 {include/migration => migration}/postcopy-ram.h    |  26 +
 migration/qemu-file-channel.c                      |   4 +-
 migration/qemu-file-channel.h                      |  21 +
 migration/qemu-file.c                              |   6 +-
 {include/migration => migration}/qemu-file.h       | 178 +-----
 migration/qjson.c                                  |   2 +-
 {include/migration => migration}/qjson.h           |   0
 migration/ram.c                                    |  15 +-
 migration/ram.h                                    |  55 ++
 migration/rdma.c                                   |   8 +-
 migration/rdma.h                                   |  22 +
 migration/savevm.c                                 |  65 +-
 migration/savevm.h                                 |  58 ++
 migration/socket.c                                 |   9 +-
 migration/socket.h                                 |  25 +
 migration/tls.c                                    |   6 +-
 migration/tls.h                                    |  27 +
 migration/vmstate-types.c                          | 677 +++++++++++++++++++++
 migration/vmstate.c                                | 676 +-------------------
 migration/xbzrle.c                                 |   2 +-
 {include/migration => migration}/xbzrle.h          |   0
 monitor.c                                          |   1 -
 qdev-monitor.c                                     |   2 +-
 replay/replay-snapshot.c                           |   5 +-
 slirp/slirp.c                                      |   1 +
 stubs/migr-blocker.c                               |   2 +-
 target/alpha/cpu.c                                 |   1 -
 target/hppa/cpu.c                                  |   1 -
 target/i386/kvm.c                                  |   2 +-
 target/s390x/cpu.c                                 |   1 -
 target/tilegx/cpu.c                                |   1 -
 tests/Makefile.include                             |   4 +-
 tests/test-vmstate.c                               |   6 +-
 tests/test-xbzrle.c                                |   2 +-
 ui/spice-core.c                                    |   2 +-
 vl.c                                               |   7 +-
 xen-common.c                                       |   3 +-
 108 files changed, 2027 insertions(+), 1617 deletions(-)
 create mode 100644 include/exec/target_page.h
 create mode 100644 include/migration/blocker.h
 create mode 100644 include/migration/global_state.h
 delete mode 100644 include/migration/migration.h
 create mode 100644 include/migration/misc.h
 create mode 100644 include/migration/qemu-file-types.h
 create mode 100644 include/migration/register.h
 create mode 100644 include/migration/snapshot.h
 rename {include/migration => migration}/block.h (95%)
 create mode 100644 migration/channel.c
 create mode 100644 migration/channel.h
 rename include/migration/failover.h => migration/colo-failover.h (100%)
 rename {include/migration => migration}/colo.h (88%)
 create mode 100644 migration/exec.h
 create mode 100644 migration/fd.h
 create mode 100644 migration/global_state.c
 create mode 100644 migration/migration.h
 rename page_cache.c => migration/page_cache.c (100%)
 rename {include/migration => migration}/page_cache.h (100%)
 rename {include/migration => migration}/postcopy-ram.h (72%)
 create mode 100644 migration/qemu-file-channel.h
 rename {include/migration => migration}/qemu-file.h (62%)
 rename {include/migration => migration}/qjson.h (100%)
 create mode 100644 migration/ram.h
 create mode 100644 migration/rdma.h
 create mode 100644 migration/savevm.h
 create mode 100644 migration/socket.h
 create mode 100644 migration/tls.h
 create mode 100644 migration/vmstate-types.c
 rename {include/migration => migration}/xbzrle.h (100%)
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/41 migration: Create migration/blocker.h

This allows us to remove lots of includes of migration/migration.h

---
 block/qcow.c                              |  2 +-
 block/vdi.c                               |  2 +-
 block/vhdx.c                              |  2 +-
 block/vmdk.c                              |  2 +-
 block/vpc.c                               |  2 +-
 block/vvfat.c                             |  2 +-
 hw/9pfs/9p.c                              |  2 +-
 hw/display/qxl.c                          |  2 +-
 hw/display/virtio-gpu.c                   |  2 +-
 hw/intc/arm_gic_kvm.c                     |  2 +-
 hw/intc/arm_gicv3_its_kvm.c               |  2 +-
 hw/intc/arm_gicv3_kvm.c                   |  2 +-
 hw/misc/ivshmem.c                         |  2 +-
 hw/scsi/vhost-scsi.c                      |  2 +-
 hw/virtio/vhost.c                         |  2 +-
 include/migration/blocker.h               | 35 +++++++++++++++++++++++++++++++
 include/migration/migration.h             | 18 ----------------
 migration/migration.c                     |  1 +
 migration/ram.c                           |  2 +-
 migration/xbzrle.c                        |  2 +-
 {include/migration => migration}/xbzrle.h |  0
 stubs/migr-blocker.c                      |  2 +-
 target/i386/kvm.c                         |  2 +-
 tests/test-xbzrle.c                       |  2 +-
 24 files changed, 56 insertions(+), 38 deletions(-)
 create mode 100644 include/migration/blocker.h
 rename {include/migration => migration}/xbzrle.h (100%)
block/qcow.c +1 -1
index 9d6ac83..48e852c 100644
@@ -32,7 +32,7 @@
 #include <zlib.h>
 #include "qapi/qmp/qerror.h"
 #include "crypto/cipher.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 
 /**************************************************************/
 /* QEMU COW block driver with compression and encryption support */
block/vdi.c +1 -1
index 9b4f70e..5f7b29f 100644
@@ -55,7 +55,7 @@
 #include "sysemu/block-backend.h"
 #include "qemu/module.h"
 #include "qemu/bswap.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "qemu/coroutine.h"
 #include "qemu/cutils.h"
 #include "qemu/uuid.h"
block/vhdx.c +1 -1
index 052a753..6128b7b 100644
@@ -24,7 +24,7 @@
 #include "qemu/crc32c.h"
 #include "qemu/bswap.h"
 #include "block/vhdx.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "qemu/uuid.h"
 
 /* Options for VHDX creation */
block/vmdk.c +1 -1
index a9bd22b..f09f0b2 100644
@@ -31,7 +31,7 @@
 #include "qemu/error-report.h"
 #include "qemu/module.h"
 #include "qemu/bswap.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "qemu/cutils.h"
 #include <zlib.h>
 
block/vpc.c +1 -1
index f591d4b..cb2d4cf 100644
@@ -28,7 +28,7 @@
 #include "block/block_int.h"
 #include "sysemu/block-backend.h"
 #include "qemu/module.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "qemu/bswap.h"
 #include "qemu/uuid.h"
 
block/vvfat.c +1 -1
index b509d55..3fcc59c 100644
@@ -28,7 +28,7 @@
 #include "block/block_int.h"
 #include "qemu/module.h"
 #include "qemu/bswap.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "qapi/qmp/qint.h"
 #include "qapi/qmp/qbool.h"
 #include "qapi/qmp/qstring.h"
hw/9pfs/9p.c +1 -1
index c80ba67..ab3e22f 100644
@@ -23,7 +23,7 @@
 #include "9p-xattr.h"
 #include "coth.h"
 #include "trace.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 
 int open_fd_hw;
 int total_open_fd;
hw/display/qxl.c +1 -1
index 4d94cec..ad09bb9 100644
@@ -26,7 +26,7 @@
 #include "qemu/queue.h"
 #include "qemu/atomic.h"
 #include "sysemu/sysemu.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "trace.h"
 
 #include "qxl.h"
hw/display/virtio-gpu.c +1 -1
index e1056f3..8ad27f3 100644
@@ -19,7 +19,7 @@
 #include "hw/virtio/virtio.h"
 #include "hw/virtio/virtio-gpu.h"
 #include "hw/virtio/virtio-bus.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "qemu/log.h"
 #include "qapi/error.h"
 
hw/intc/arm_gic_kvm.c +1 -1
index ec952ec..af5cd36 100644
@@ -24,7 +24,7 @@
 #include "qemu-common.h"
 #include "cpu.h"
 #include "hw/sysbus.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "sysemu/kvm.h"
 #include "kvm_arm.h"
 #include "gic_internal.h"
hw/intc/arm_gicv3_its_kvm.c +1 -1
index bd4f3aa..a0441d6 100644
@@ -24,7 +24,7 @@
 #include "sysemu/sysemu.h"
 #include "sysemu/kvm.h"
 #include "kvm_arm.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 
 #define TYPE_KVM_ARM_ITS "arm-its-kvm"
 #define KVM_ARM_ITS(obj) OBJECT_CHECK(GICv3ITSState, (obj), TYPE_KVM_ARM_ITS)
hw/intc/arm_gicv3_kvm.c +1 -1
index 19aab56..4ee2baa 100644
@@ -28,7 +28,7 @@
 #include "kvm_arm.h"
 #include "gicv3_internal.h"
 #include "vgic_common.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 
 #ifdef DEBUG_GICV3_KVM
 #define DPRINTF(fmt, ...) \
hw/misc/ivshmem.c +1 -1
index 82ce837..475e36a 100644
@@ -25,7 +25,7 @@
 #include "hw/pci/msi.h"
 #include "hw/pci/msix.h"
 #include "sysemu/kvm.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "qemu/error-report.h"
 #include "qemu/event_notifier.h"
 #include "qom/object_interfaces.h"
hw/scsi/vhost-scsi.c +1 -1
index f53bc17..0558737 100644
@@ -21,7 +21,7 @@
 #include "qemu/error-report.h"
 #include "qemu/queue.h"
 #include "monitor/monitor.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "hw/virtio/vhost-scsi.h"
 #include "hw/virtio/vhost.h"
 #include "hw/virtio/virtio-scsi.h"
hw/virtio/vhost.c +1 -1
index 0001e60..03a46a7 100644
@@ -25,7 +25,7 @@
 #include "exec/address-spaces.h"
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "sysemu/dma.h"
 
 /* enabled until disconnected backend stabilizes */
include/migration/blocker.h new file +35 -0
new file mode 100644
index 0000000..acd2701
@@ -0,0 +1,35 @@
+/*
+ * QEMU migration blockers
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef MIGRATION_BLOCKER_H
+#define MIGRATION_BLOCKER_H
+
+/**
+ * @migrate_add_blocker - prevent migration from proceeding
+ *
+ * @reason - an error to be returned whenever migration is attempted
+ *
+ * @errp - [out] The reason (if any) we cannot block migration right now.
+ *
+ * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set.
+ */
+int migrate_add_blocker(Error *reason, Error **errp);
+
+/**
+ * @migrate_del_blocker - remove a blocking error from migration
+ *
+ * @reason - the error blocking migration
+ */
+void migrate_del_blocker(Error *reason);
+
+#endif
include/migration/migration.h +0 -18
index 9579280..02b074f 100644
@@ -267,24 +267,6 @@ int ram_discard_range(const char *block_name, uint64_t start, size_t length);
 int ram_postcopy_incoming_init(MigrationIncomingState *mis);
 void ram_postcopy_migrated_memory_release(MigrationState *ms);
 
-/**
- * @migrate_add_blocker - prevent migration from proceeding
- *
- * @reason - an error to be returned whenever migration is attempted
- *
- * @errp - [out] The reason (if any) we cannot block migration right now.
- *
- * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set.
- */
-int migrate_add_blocker(Error *reason, Error **errp);
-
-/**
- * @migrate_del_blocker - remove a blocking error from migration
- *
- * @reason - the error blocking migration
- */
-void migrate_del_blocker(Error *reason);
-
 bool migrate_release_ram(void);
 bool migrate_postcopy_ram(void);
 bool migrate_zero_blocks(void);
migration/migration.c +1 -0
index f094079..8625a6c 100644
@@ -17,6 +17,7 @@
 #include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
+#include "migration/blocker.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
 #include "sysemu/sysemu.h"
migration/ram.c +1 -1
index 5428026..4e562be 100644
@@ -35,7 +35,7 @@
 #include "qemu/bitmap.h"
 #include "qemu/timer.h"
 #include "qemu/main-loop.h"
-#include "migration/xbzrle.h"
+#include "xbzrle.h"
 #include "migration/migration.h"
 #include "migration/postcopy-ram.h"
 #include "exec/address-spaces.h"
migration/xbzrle.c +1 -1
index 421bca0..1ba482d 100644
@@ -12,7 +12,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu/cutils.h"
-#include "migration/xbzrle.h"
+#include "xbzrle.h"
 
 /*
   page = zrun nzrun
migration/xbzrle.h renamed from include/migration/xbzrle.h +0 -0
similarity index 100%
rename from include/migration/xbzrle.h
rename to migration/xbzrle.h
stubs/migr-blocker.c +1 -1
index a5ba18f..2b64ac9 100644
@@ -1,6 +1,6 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 
 int migrate_add_blocker(Error *reason, Error **errp)
 {
target/i386/kvm.c +1 -1
index 55865db..011d4a5 100644
@@ -43,7 +43,7 @@
 #include "standard-headers/asm-x86/hyperv.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/msi.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "exec/memattrs.h"
 #include "trace.h"
 
tests/test-xbzrle.c +1 -1
index d97b5eb..f5e08de 100644
@@ -13,7 +13,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qemu/cutils.h"
-#include "include/migration/xbzrle.h"
+#include "../migration/xbzrle.h"
 
 #define PAGE_SIZE 4096
 
Signature · 1 line
2.9.3
Reviewed-by on v1 1/41
#2 lore raw

Re: [Qemu-devel] [PATCH 01/41] migration: Create migration/blocker.h

Quoted 3 lines · * Juan Quintela ([email protected]) wrote:

This allows us to remove lots of includes of migration/migration.h

if you need to regenerate it, I think the xvzrle.h move is out of place in this patch.

Dave

Quoted 377 lines
---
 block/qcow.c                              |  2 +-
 block/vdi.c                               |  2 +-
 block/vhdx.c                              |  2 +-
 block/vmdk.c                              |  2 +-
 block/vpc.c                               |  2 +-
 block/vvfat.c                             |  2 +-
 hw/9pfs/9p.c                              |  2 +-
 hw/display/qxl.c                          |  2 +-
 hw/display/virtio-gpu.c                   |  2 +-
 hw/intc/arm_gic_kvm.c                     |  2 +-
 hw/intc/arm_gicv3_its_kvm.c               |  2 +-
 hw/intc/arm_gicv3_kvm.c                   |  2 +-
 hw/misc/ivshmem.c                         |  2 +-
 hw/scsi/vhost-scsi.c                      |  2 +-
 hw/virtio/vhost.c                         |  2 +-
 include/migration/blocker.h               | 35 +++++++++++++++++++++++++++++++
 include/migration/migration.h             | 18 ----------------
 migration/migration.c                     |  1 +
 migration/ram.c                           |  2 +-
 migration/xbzrle.c                        |  2 +-
 {include/migration => migration}/xbzrle.h |  0
 stubs/migr-blocker.c                      |  2 +-
 target/i386/kvm.c                         |  2 +-
 tests/test-xbzrle.c                       |  2 +-
 24 files changed, 56 insertions(+), 38 deletions(-)
 create mode 100644 include/migration/blocker.h
 rename {include/migration => migration}/xbzrle.h (100%)
block/qcow.c +1 -1
index 9d6ac83..48e852c 100644
@@ -32,7 +32,7 @@
 #include <zlib.h>
 #include "qapi/qmp/qerror.h"
 #include "crypto/cipher.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 
 /**************************************************************/
 /* QEMU COW block driver with compression and encryption support */
block/vdi.c +1 -1
index 9b4f70e..5f7b29f 100644
@@ -55,7 +55,7 @@
 #include "sysemu/block-backend.h"
 #include "qemu/module.h"
 #include "qemu/bswap.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "qemu/coroutine.h"
 #include "qemu/cutils.h"
 #include "qemu/uuid.h"
block/vhdx.c +1 -1
index 052a753..6128b7b 100644
@@ -24,7 +24,7 @@
 #include "qemu/crc32c.h"
 #include "qemu/bswap.h"
 #include "block/vhdx.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "qemu/uuid.h"
 
 /* Options for VHDX creation */
block/vmdk.c +1 -1
index a9bd22b..f09f0b2 100644
@@ -31,7 +31,7 @@
 #include "qemu/error-report.h"
 #include "qemu/module.h"
 #include "qemu/bswap.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "qemu/cutils.h"
 #include <zlib.h>
 
block/vpc.c +1 -1
index f591d4b..cb2d4cf 100644
@@ -28,7 +28,7 @@
 #include "block/block_int.h"
 #include "sysemu/block-backend.h"
 #include "qemu/module.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "qemu/bswap.h"
 #include "qemu/uuid.h"
 
block/vvfat.c +1 -1
index b509d55..3fcc59c 100644
@@ -28,7 +28,7 @@
 #include "block/block_int.h"
 #include "qemu/module.h"
 #include "qemu/bswap.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "qapi/qmp/qint.h"
 #include "qapi/qmp/qbool.h"
 #include "qapi/qmp/qstring.h"
hw/9pfs/9p.c +1 -1
index c80ba67..ab3e22f 100644
@@ -23,7 +23,7 @@
 #include "9p-xattr.h"
 #include "coth.h"
 #include "trace.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 
 int open_fd_hw;
 int total_open_fd;
hw/display/qxl.c +1 -1
index 4d94cec..ad09bb9 100644
@@ -26,7 +26,7 @@
 #include "qemu/queue.h"
 #include "qemu/atomic.h"
 #include "sysemu/sysemu.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "trace.h"
 
 #include "qxl.h"
hw/display/virtio-gpu.c +1 -1
index e1056f3..8ad27f3 100644
@@ -19,7 +19,7 @@
 #include "hw/virtio/virtio.h"
 #include "hw/virtio/virtio-gpu.h"
 #include "hw/virtio/virtio-bus.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "qemu/log.h"
 #include "qapi/error.h"
 
hw/intc/arm_gic_kvm.c +1 -1
index ec952ec..af5cd36 100644
@@ -24,7 +24,7 @@
 #include "qemu-common.h"
 #include "cpu.h"
 #include "hw/sysbus.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "sysemu/kvm.h"
 #include "kvm_arm.h"
 #include "gic_internal.h"
hw/intc/arm_gicv3_its_kvm.c +1 -1
index bd4f3aa..a0441d6 100644
@@ -24,7 +24,7 @@
 #include "sysemu/sysemu.h"
 #include "sysemu/kvm.h"
 #include "kvm_arm.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 
 #define TYPE_KVM_ARM_ITS "arm-its-kvm"
 #define KVM_ARM_ITS(obj) OBJECT_CHECK(GICv3ITSState, (obj), TYPE_KVM_ARM_ITS)
hw/intc/arm_gicv3_kvm.c +1 -1
index 19aab56..4ee2baa 100644
@@ -28,7 +28,7 @@
 #include "kvm_arm.h"
 #include "gicv3_internal.h"
 #include "vgic_common.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 
 #ifdef DEBUG_GICV3_KVM
 #define DPRINTF(fmt, ...) \
hw/misc/ivshmem.c +1 -1
index 82ce837..475e36a 100644
@@ -25,7 +25,7 @@
 #include "hw/pci/msi.h"
 #include "hw/pci/msix.h"
 #include "sysemu/kvm.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "qemu/error-report.h"
 #include "qemu/event_notifier.h"
 #include "qom/object_interfaces.h"
hw/scsi/vhost-scsi.c +1 -1
index f53bc17..0558737 100644
@@ -21,7 +21,7 @@
 #include "qemu/error-report.h"
 #include "qemu/queue.h"
 #include "monitor/monitor.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "hw/virtio/vhost-scsi.h"
 #include "hw/virtio/vhost.h"
 #include "hw/virtio/virtio-scsi.h"
hw/virtio/vhost.c +1 -1
index 0001e60..03a46a7 100644
@@ -25,7 +25,7 @@
 #include "exec/address-spaces.h"
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "sysemu/dma.h"
 
 /* enabled until disconnected backend stabilizes */
include/migration/blocker.h new file +35 -0
new file mode 100644
index 0000000..acd2701
@@ -0,0 +1,35 @@
+/*
+ * QEMU migration blockers
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef MIGRATION_BLOCKER_H
+#define MIGRATION_BLOCKER_H
+
+/**
+ * @migrate_add_blocker - prevent migration from proceeding
+ *
+ * @reason - an error to be returned whenever migration is attempted
+ *
+ * @errp - [out] The reason (if any) we cannot block migration right now.
+ *
+ * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set.
+ */
+int migrate_add_blocker(Error *reason, Error **errp);
+
+/**
+ * @migrate_del_blocker - remove a blocking error from migration
+ *
+ * @reason - the error blocking migration
+ */
+void migrate_del_blocker(Error *reason);
+
+#endif
include/migration/migration.h +0 -18
index 9579280..02b074f 100644
@@ -267,24 +267,6 @@ int ram_discard_range(const char *block_name, uint64_t start, size_t length);
 int ram_postcopy_incoming_init(MigrationIncomingState *mis);
 void ram_postcopy_migrated_memory_release(MigrationState *ms);
 
-/**
- * @migrate_add_blocker - prevent migration from proceeding
- *
- * @reason - an error to be returned whenever migration is attempted
- *
- * @errp - [out] The reason (if any) we cannot block migration right now.
- *
- * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set.
- */
-int migrate_add_blocker(Error *reason, Error **errp);
-
-/**
- * @migrate_del_blocker - remove a blocking error from migration
- *
- * @reason - the error blocking migration
- */
-void migrate_del_blocker(Error *reason);
-
 bool migrate_release_ram(void);
 bool migrate_postcopy_ram(void);
 bool migrate_zero_blocks(void);
migration/migration.c +1 -0
index f094079..8625a6c 100644
@@ -17,6 +17,7 @@
 #include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
+#include "migration/blocker.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
 #include "sysemu/sysemu.h"
migration/ram.c +1 -1
index 5428026..4e562be 100644
@@ -35,7 +35,7 @@
 #include "qemu/bitmap.h"
 #include "qemu/timer.h"
 #include "qemu/main-loop.h"
-#include "migration/xbzrle.h"
+#include "xbzrle.h"
 #include "migration/migration.h"
 #include "migration/postcopy-ram.h"
 #include "exec/address-spaces.h"
migration/xbzrle.c +1 -1
index 421bca0..1ba482d 100644
@@ -12,7 +12,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu/cutils.h"
-#include "migration/xbzrle.h"
+#include "xbzrle.h"
 
 /*
   page = zrun nzrun
migration/xbzrle.h renamed from include/migration/xbzrle.h +0 -0
similarity index 100%
rename from include/migration/xbzrle.h
rename to migration/xbzrle.h
stubs/migr-blocker.c +1 -1
index a5ba18f..2b64ac9 100644
@@ -1,6 +1,6 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 
 int migrate_add_blocker(Error *reason, Error **errp)
 {
target/i386/kvm.c +1 -1
index 55865db..011d4a5 100644
@@ -43,7 +43,7 @@
 #include "standard-headers/asm-x86/hyperv.h"
 #include "hw/pci/pci.h"
 #include "hw/pci/msi.h"
-#include "migration/migration.h"
+#include "migration/blocker.h"
 #include "exec/memattrs.h"
 #include "trace.h"
 
tests/test-xbzrle.c +1 -1
index d97b5eb..f5e08de 100644
@@ -13,7 +13,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qemu/cutils.h"
-#include "include/migration/xbzrle.h"
+#include "../migration/xbzrle.h"
 
 #define PAGE_SIZE 4096
 
Signature · 1 line
2.9.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#4 lore raw

PATCH 2/41 migration: Split migration/channel.c for channel operations

In reply to Juan Quintela

Create an include for its exported functions.

---
 include/migration/migration.h |  7 -----
 migration/Makefile.objs       |  2 +-
 migration/channel.c           | 69 +++++++++++++++++++++++++++++++++++++++++++
 migration/channel.h           | 25 ++++++++++++++++
 migration/exec.c              |  1 +
 migration/fd.c                |  1 +
 migration/migration.c         | 50 -------------------------------
 migration/socket.c            |  1 +
 migration/tls.c               |  1 +
 9 files changed, 99 insertions(+), 58 deletions(-)
 create mode 100644 migration/channel.c
 create mode 100644 migration/channel.h
include/migration/migration.h +0 -7
index 02b074f..bb81433 100644
@@ -179,17 +179,10 @@ void migration_fd_process_incoming(QEMUFile *f);
 
 void qemu_start_incoming_migration(const char *uri, Error **errp);
 
-void migration_channel_process_incoming(MigrationState *s,
-                                        QIOChannel *ioc);
-
 void migration_tls_channel_process_incoming(MigrationState *s,
                                             QIOChannel *ioc,
                                             Error **errp);
 
-void migration_channel_connect(MigrationState *s,
-                               QIOChannel *ioc,
-                               const char *hostname);
-
 void migration_tls_channel_connect(MigrationState *s,
                                    QIOChannel *ioc,
                                    const char *hostname,
migration/Makefile.objs +1 -1
index 480dd49..c83ca92 100644
@@ -1,5 +1,5 @@
 common-obj-y += migration.o socket.o fd.o exec.o
-common-obj-y += tls.o
+common-obj-y += tls.o channel.o
 common-obj-y += colo-comm.o colo.o colo-failover.o
 common-obj-y += vmstate.o
 common-obj-y += qemu-file.o
migration/channel.c new file +69 -0

69 lines not on this page · raw message

migration/channel.h new file +25 -0
new file mode 100644
index 0000000..618acb7
@@ -0,0 +1,25 @@
+/*
+ * QEMU live migration channel functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_CHANNEL_H
+#define QEMU_MIGRATION_CHANNEL_H
+
+#include "io/channel.h"
+
+void migration_channel_process_incoming(MigrationState *s,
+                                        QIOChannel *ioc);
+
+void migration_channel_connect(MigrationState *s,
+                               QIOChannel *ioc,
+                               const char *hostname);
+#endif
migration/exec.c +1 -0
index 9157721..203f587 100644
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
+#include "channel.h"
 #include "migration/migration.h"
 #include "io/channel-command.h"
 #include "trace.h"
migration/fd.c +1 -0
index 58cb51a..05e0a5c 100644
@@ -17,6 +17,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
+#include "channel.h"
 #include "migration/migration.h"
 #include "monitor/monitor.h"
 #include "io/channel-util.h"
migration/migration.c +0 -50

56 lines not on this page · raw message

migration/socket.c +1 -0
index dc88812..99bd7e7 100644
@@ -19,6 +19,7 @@
 #include "qemu-common.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
+#include "channel.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
 #include "io/channel-socket.h"
migration/tls.c +1 -0
index a33ecb7..34ad121 100644
@@ -19,6 +19,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "channel.h"
 #include "migration/migration.h"
 #include "io/channel-tls.h"
 #include "crypto/tlscreds.h"
Signature · 1 line
2.9.3
#5 lore raw

PATCH 3/41 migration: Remove MigrationState from migration_channel_incomming()

In reply to Juan Quintela

All callers were calling migrate_get_current(), so do it inside the function.

---
 migration/channel.c | 5 +++--
 migration/channel.h | 3 +--
 migration/exec.c    | 2 +-
 migration/fd.c      | 2 +-
 migration/socket.c  | 3 +--
 migration/tls.c     | 2 +-
 6 files changed, 8 insertions(+), 9 deletions(-)
migration/channel.c +3 -2
index 6104de5..acb4dd6 100644
@@ -20,9 +20,10 @@
 #include "qapi/error.h"
 #include "io/channel-tls.h"
 
-void migration_channel_process_incoming(MigrationState *s,
-                                        QIOChannel *ioc)
+void migration_channel_process_incoming(QIOChannel *ioc)
 {
+    MigrationState *s = migrate_get_current();
+
     trace_migration_set_incoming_channel(
         ioc, object_get_typename(OBJECT(ioc)));
 
migration/channel.h +1 -2
index 618acb7..fbc4bfb 100644
@@ -16,8 +16,7 @@
 
 #include "io/channel.h"
 
-void migration_channel_process_incoming(MigrationState *s,
-                                        QIOChannel *ioc);
+void migration_channel_process_incoming(QIOChannel *ioc);
 
 void migration_channel_connect(MigrationState *s,
                                QIOChannel *ioc,
migration/exec.c +1 -1
index 203f587..405d0ab 100644
@@ -48,7 +48,7 @@ static gboolean exec_accept_incoming_migration(QIOChannel *ioc,
                                                GIOCondition condition,
                                                gpointer opaque)
 {
-    migration_channel_process_incoming(migrate_get_current(), ioc);
+    migration_channel_process_incoming(ioc);
     object_unref(OBJECT(ioc));
     return FALSE; /* unregister */
 }
migration/fd.c +1 -1
index 05e0a5c..ccaa806 100644
@@ -48,7 +48,7 @@ static gboolean fd_accept_incoming_migration(QIOChannel *ioc,
                                              GIOCondition condition,
                                              gpointer opaque)
 {
-    migration_channel_process_incoming(migrate_get_current(), ioc);
+    migration_channel_process_incoming(ioc);
     object_unref(OBJECT(ioc));
     return FALSE; /* unregister */
 }
migration/socket.c +1 -2
index 99bd7e7..a49cf44 100644
@@ -149,8 +149,7 @@ static gboolean socket_accept_incoming_migration(QIOChannel *ioc,
     trace_migration_socket_incoming_accepted();
 
     qio_channel_set_name(QIO_CHANNEL(sioc), "migration-socket-incoming");
-    migration_channel_process_incoming(migrate_get_current(),
-                                       QIO_CHANNEL(sioc));
+    migration_channel_process_incoming(QIO_CHANNEL(sioc));
     object_unref(OBJECT(sioc));
 
 out:
migration/tls.c +1 -1
index 34ad121..b4cb8fe 100644
@@ -73,7 +73,7 @@ static void migration_tls_incoming_handshake(QIOTask *task,
         error_report_err(err);
     } else {
         trace_migration_tls_incoming_handshake_complete();
-        migration_channel_process_incoming(migrate_get_current(), ioc);
+        migration_channel_process_incoming(ioc);
     }
     object_unref(OBJECT(ioc));
 }
Signature · 1 line
2.9.3
#6 lore raw

PATCH 4/41 migration: Export qemu-file-channel.c functions in its own file

In reply to Juan Quintela
---
 include/migration/migration.h |  1 +
 include/migration/qemu-file.h |  4 ----
 migration/channel.c           |  1 +
 migration/colo.c              |  1 +
 migration/migration.c         |  1 +
 migration/qemu-file-channel.c |  1 +
 migration/qemu-file-channel.h | 21 +++++++++++++++++++++
 migration/rdma.c              |  1 +
 migration/savevm.c            |  1 +
 tests/test-vmstate.c          |  1 +
 10 files changed, 29 insertions(+), 4 deletions(-)
 create mode 100644 migration/qemu-file-channel.h
include/migration/migration.h +1 -0
index bb81433..d465624 100644
@@ -19,6 +19,7 @@
 #include "qemu/thread.h"
 #include "qemu/notify.h"
 #include "migration/vmstate.h"
+#include "io/channel.h"
 #include "qapi-types.h"
 #include "exec/cpu-common.h"
 #include "qemu/coroutine_int.h"
include/migration/qemu-file.h +0 -4
index 0cd648a..b5ac800 100644
@@ -27,8 +27,6 @@
 
 #include "qemu-common.h"
 #include "exec/cpu-common.h"
-#include "io/channel.h"
-
 
 /* Read a chunk of data from a file at the given position.  The pos argument
  * can be ignored if the file is only be used for streaming.  The number of
@@ -119,8 +117,6 @@ typedef struct QEMUFileHooks {
 } QEMUFileHooks;
 
 QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops);
-QEMUFile *qemu_fopen_channel_input(QIOChannel *ioc);
-QEMUFile *qemu_fopen_channel_output(QIOChannel *ioc);
 void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks);
 int qemu_get_fd(QEMUFile *f);
 int qemu_fclose(QEMUFile *f);
migration/channel.c +1 -0
index acb4dd6..d9b51de 100644
@@ -16,6 +16,7 @@
 #include "qemu/osdep.h"
 #include "channel.h"
 #include "migration/migration.h"
+#include "qemu-file-channel.h"
 #include "trace.h"
 #include "qapi/error.h"
 #include "io/channel-tls.h"
migration/colo.c +1 -0
index 75e8807..cd9e767 100644
@@ -13,6 +13,7 @@
 #include "qemu/osdep.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
+#include "qemu-file-channel.h"
 #include "migration/colo.h"
 #include "io/channel-buffer.h"
 #include "trace.h"
migration/migration.c +1 -0
index 8c873c7..dd8c9d5 100644
@@ -19,6 +19,7 @@
 #include "qemu/main-loop.h"
 #include "migration/blocker.h"
 #include "migration/migration.h"
+#include "qemu-file-channel.h"
 #include "migration/qemu-file.h"
 #include "sysemu/sysemu.h"
 #include "block/block.h"
migration/qemu-file-channel.c +1 -0
index 45c13f1..dc991c9 100644
@@ -23,6 +23,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-file-channel.h"
 #include "migration/qemu-file.h"
 #include "io/channel-socket.h"
 #include "qemu/iov.h"
migration/qemu-file-channel.h new file +21 -0
new file mode 100644
index 0000000..d1bd5ff
@@ -0,0 +1,21 @@
+/*
+ * QEMU migration file channel operations
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_FILE_CHANNEL_H
+#define QEMU_FILE_CHANNEL_H
+
+#include "io/channel.h"
+
+QEMUFile *qemu_fopen_channel_input(QIOChannel *ioc);
+QEMUFile *qemu_fopen_channel_output(QIOChannel *ioc);
+#endif
migration/rdma.c +1 -0
index fe0a4b5..fffe2d6 100644
@@ -20,6 +20,7 @@
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
 #include "exec/cpu-common.h"
+#include "qemu-file-channel.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
 #include "qemu/sockets.h"
migration/savevm.c +1 -0
index 97c6908..7a07ea6 100644
@@ -36,6 +36,7 @@
 #include "sysemu/sysemu.h"
 #include "qemu/timer.h"
 #include "migration/migration.h"
+#include "qemu-file-channel.h"
 #include "migration/postcopy-ram.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
tests/test-vmstate.c +1 -0
index f694a89..1c13570 100644
@@ -27,6 +27,7 @@
 #include "qemu-common.h"
 #include "migration/migration.h"
 #include "migration/vmstate.h"
+#include "../migration/qemu-file-channel.h"
 #include "qemu/coroutine.h"
 #include "io/channel-file.h"
 
Signature · 1 line
2.9.3
#7 lore raw

PATCH 5/41 migration: Remove migration.h from colo.h

In reply to Juan Quintela

migration.h is not included in any includes now.

---
 include/migration/colo.h | 1 -
 migration/colo-comm.c    | 3 ++-
 migration/colo.c         | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
include/migration/colo.h +0 -1
index 2bbff9e..ba0bb6e 100644
@@ -14,7 +14,6 @@
 #define QEMU_COLO_H
 
 #include "qemu-common.h"
-#include "migration/migration.h"
 #include "qemu/coroutine_int.h"
 #include "qemu/thread.h"
 #include "qemu/main-loop.h"
migration/colo-comm.c +2 -1
index 20b60ec..3d91798 100644
@@ -12,7 +12,8 @@
  */
 
 #include "qemu/osdep.h"
-#include <migration/colo.h>
+#include "migration/migration.h"
+#include "migration/colo.h"
 #include "trace.h"
 
 typedef struct {
migration/colo.c +1 -0
index cd9e767..fb00310 100644
@@ -14,6 +14,7 @@
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
 #include "qemu-file-channel.h"
+#include "migration/migration.h"
 #include "migration/colo.h"
 #include "io/channel-buffer.h"
 #include "trace.h"
Signature · 1 line
2.9.3
#8 lore raw

PATCH 6/41 migration: Move colo.h to migration/

In reply to Juan Quintela

There are functions only used by migration code.

---
 MAINTAINERS                             | 2 +-
 migration/colo-comm.c                   | 2 +-
 migration/colo-failover.c               | 2 +-
 {include/migration => migration}/colo.h | 0
 migration/migration.c                   | 2 +-
 migration/ram.c                         | 2 +-
 6 files changed, 5 insertions(+), 5 deletions(-)
 rename {include/migration => migration}/colo.h (100%)
MAINTAINERS +1 -1
index cae3b09..3560ba2 100644
@@ -1535,7 +1535,7 @@ COLO Framework
 M: zhanghailiang <[email protected]>
 S: Maintained
 F: migration/colo*
-F: include/migration/colo.h
+F: migration/colo.h
 F: include/migration/failover.h
 F: docs/COLO-FT.txt
 
migration/colo-comm.c +1 -1
index 3d91798..9b35027 100644
@@ -13,7 +13,7 @@
 
 #include "qemu/osdep.h"
 #include "migration/migration.h"
-#include "migration/colo.h"
+#include "colo.h"
 #include "trace.h"
 
 typedef struct {
migration/colo-failover.c +1 -1
index cc229f5..29b8d63 100644
@@ -11,7 +11,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "migration/colo.h"
+#include "colo.h"
 #include "migration/failover.h"
 #include "qmp-commands.h"
 #include "qapi/qmp/qerror.h"
migration/colo.h renamed from include/migration/colo.h +0 -0
similarity index 100%
rename from include/migration/colo.h
rename to migration/colo.h
migration/migration.c +1 -1
index dd8c9d5..fe30227 100644
@@ -38,7 +38,7 @@
 #include "exec/address-spaces.h"
 #include "io/channel-buffer.h"
 #include "io/channel-tls.h"
-#include "migration/colo.h"
+#include "colo.h"
 
 #define MAX_THROTTLE  (32 << 20)      /* Migration transfer speed throttling */
 
migration/ram.c +1 -1
index 4e562be..47e66f4 100644
@@ -44,7 +44,7 @@
 #include "trace.h"
 #include "exec/ram_addr.h"
 #include "qemu/rcu_queue.h"
-#include "migration/colo.h"
+#include "colo.h"
 
 /***********************************************************/
 /* ram save/restore */
Signature · 1 line
2.9.3
#9 lore raw

Re: [Qemu-devel] [PATCH 06/41] migration: Move colo.h to migration/

Quoted 31 lines · * Juan Quintela ([email protected]) wrote:

There are functions only used by migration code.

---
 MAINTAINERS                             | 2 +-
 migration/colo-comm.c                   | 2 +-
 migration/colo-failover.c               | 2 +-
 {include/migration => migration}/colo.h | 0
 migration/migration.c                   | 2 +-
 migration/ram.c                         | 2 +-
 6 files changed, 5 insertions(+), 5 deletions(-)
 rename {include/migration => migration}/colo.h (100%)
MAINTAINERS +1 -1
index cae3b09..3560ba2 100644
@@ -1535,7 +1535,7 @@ COLO Framework
 M: zhanghailiang <[email protected]>
 S: Maintained
 F: migration/colo*
-F: include/migration/colo.h
+F: migration/colo.h
 F: include/migration/failover.h
 F: docs/COLO-FT.txt
 
migration/colo-comm.c +0 -0
index 3d91798..9b35027 100644

migration/colo-comm.c line 17

Quoted 6 lines
migration/colo-comm.c +1 -1
@@ -13,7 +13,7 @@
 
 #include "qemu/osdep.h"
 #include "migration/migration.h"
-#include "migration/colo.h"
+#include "colo.h"
 #include "trace.h"

Like most of the other 'move foo.h' patches, these don't need the #include's changing everywhere - so the patch becomes trivial; so you can then wrap most of these mv's up into fewer patches.

Dave

Quoted 47 lines
migration/colo-comm.c +0 -0
 typedef struct {
migration/colo-failover.c +1 -1
index cc229f5..29b8d63 100644
@@ -11,7 +11,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "migration/colo.h"
+#include "colo.h"
 #include "migration/failover.h"
 #include "qmp-commands.h"
 #include "qapi/qmp/qerror.h"
migration/colo.h renamed from include/migration/colo.h +0 -0
similarity index 100%
rename from include/migration/colo.h
rename to migration/colo.h
migration/migration.c +1 -1
index dd8c9d5..fe30227 100644
@@ -38,7 +38,7 @@
 #include "exec/address-spaces.h"
 #include "io/channel-buffer.h"
 #include "io/channel-tls.h"
-#include "migration/colo.h"
+#include "colo.h"
 
 #define MAX_THROTTLE  (32 << 20)      /* Migration transfer speed throttling */
 
migration/ram.c +1 -1
index 4e562be..47e66f4 100644
@@ -44,7 +44,7 @@
 #include "trace.h"
 #include "exec/ram_addr.h"
 #include "qemu/rcu_queue.h"
-#include "migration/colo.h"
+#include "colo.h"
 
 /***********************************************************/
 /* ram save/restore */
Signature · 1 line
2.9.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#10 lore raw

PATCH 7/41 migration: Move failover.h to migration/colo-failover.h

In reply to Juan Quintela

This file is internal for migration/colo code.

---
 MAINTAINERS                                               | 2 +-
 migration/colo-failover.c                                 | 2 +-
 include/migration/failover.h => migration/colo-failover.h | 0
 migration/colo.c                                          | 2 +-
 4 files changed, 3 insertions(+), 3 deletions(-)
 rename include/migration/failover.h => migration/colo-failover.h (100%)
MAINTAINERS +1 -1
index 3560ba2..7435c9d 100644
@@ -1536,7 +1536,7 @@ M: zhanghailiang <[email protected]>
 S: Maintained
 F: migration/colo*
 F: migration/colo.h
-F: include/migration/failover.h
+F: migration/colo-failover.h
 F: docs/COLO-FT.txt
 
 COLO Proxy
migration/colo-failover.c +1 -1
index 29b8d63..85c4526 100644
@@ -12,7 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "colo.h"
-#include "migration/failover.h"
+#include "colo-failover.h"
 #include "qmp-commands.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
migration/colo-failover.h renamed from include/migration/failover.h +0 -0
similarity index 100%
rename from include/migration/failover.h
rename to migration/colo-failover.h
migration/colo.c +1 -1
index fb00310..31ab23f 100644
@@ -20,7 +20,7 @@
 #include "trace.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
-#include "migration/failover.h"
+#include "colo-failover.h"
 #include "replication.h"
 #include "qmp-commands.h"
 
Signature · 1 line
2.9.3
#11 lore raw

PATCH 8/41 migration: Move page_cache.c to migration/

In reply to Juan Quintela

It is only used by migration, so move it there.

---
 Makefile.objs                                 | 1 -
 migration/Makefile.objs                       | 2 +-
 page_cache.c => migration/page_cache.c        | 0
 {include/migration => migration}/page_cache.h | 0
 tests/Makefile.include                        | 2 +-
 5 files changed, 2 insertions(+), 3 deletions(-)
 rename page_cache.c => migration/page_cache.c (100%)
 rename {include/migration => migration}/page_cache.h (100%)
Makefile.objs +0 -1
index 6167e7b..2100845 100644
@@ -49,7 +49,6 @@ common-obj-$(CONFIG_POSIX) += os-posix.o
 common-obj-$(CONFIG_LINUX) += fsdev/
 
 common-obj-y += migration/
-common-obj-y += page_cache.o #aio.o
 
 common-obj-$(CONFIG_SPICE) += spice-qemu-char.o
 
migration/Makefile.objs +1 -1
index c83ca92..ce8ce12 100644
@@ -1,7 +1,7 @@
 common-obj-y += migration.o socket.o fd.o exec.o
 common-obj-y += tls.o channel.o
 common-obj-y += colo-comm.o colo.o colo-failover.o
-common-obj-y += vmstate.o
+common-obj-y += vmstate.o page_cache.o
 common-obj-y += qemu-file.o
 common-obj-y += qemu-file-channel.o
 common-obj-y += xbzrle.o postcopy-ram.o
migration/page_cache.c renamed from page_cache.c +0 -0
similarity index 100%
rename from page_cache.c
rename to migration/page_cache.c
migration/page_cache.h renamed from include/migration/page_cache.h +0 -0
similarity index 100%
rename from include/migration/page_cache.h
rename to migration/page_cache.h
tests/Makefile.include +1 -1
index 579ec07..0f98c04 100644
@@ -549,7 +549,7 @@ tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(test-block-obj-y)
 tests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y)
 tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y)
 tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o
-tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o page_cache.o $(test-util-obj-y)
+tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-util-obj-y)
 tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o
 tests/test-int128$(EXESUF): tests/test-int128.o
 tests/rcutorture$(EXESUF): tests/rcutorture.o $(test-util-obj-y)
Signature · 1 line
2.9.3
Reviewed-by on v1 8/41
#12 lore raw

Re: [Qemu-devel] [PATCH 08/41] migration: Move page_cache.c to migration/

Quoted 3 lines · * Juan Quintela ([email protected]) wrote:

It is only used by migration, so move it there.

Quoted 59 lines
---
 Makefile.objs                                 | 1 -
 migration/Makefile.objs                       | 2 +-
 page_cache.c => migration/page_cache.c        | 0
 {include/migration => migration}/page_cache.h | 0
 tests/Makefile.include                        | 2 +-
 5 files changed, 2 insertions(+), 3 deletions(-)
 rename page_cache.c => migration/page_cache.c (100%)
 rename {include/migration => migration}/page_cache.h (100%)
Makefile.objs +0 -1
index 6167e7b..2100845 100644
@@ -49,7 +49,6 @@ common-obj-$(CONFIG_POSIX) += os-posix.o
 common-obj-$(CONFIG_LINUX) += fsdev/
 
 common-obj-y += migration/
-common-obj-y += page_cache.o #aio.o
 
 common-obj-$(CONFIG_SPICE) += spice-qemu-char.o
 
migration/Makefile.objs +1 -1
index c83ca92..ce8ce12 100644
@@ -1,7 +1,7 @@
 common-obj-y += migration.o socket.o fd.o exec.o
 common-obj-y += tls.o channel.o
 common-obj-y += colo-comm.o colo.o colo-failover.o
-common-obj-y += vmstate.o
+common-obj-y += vmstate.o page_cache.o
 common-obj-y += qemu-file.o
 common-obj-y += qemu-file-channel.o
 common-obj-y += xbzrle.o postcopy-ram.o
migration/page_cache.c renamed from page_cache.c +0 -0
similarity index 100%
rename from page_cache.c
rename to migration/page_cache.c
migration/page_cache.h renamed from include/migration/page_cache.h +0 -0
similarity index 100%
rename from include/migration/page_cache.h
rename to migration/page_cache.h
tests/Makefile.include +1 -1
index 579ec07..0f98c04 100644
@@ -549,7 +549,7 @@ tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(test-block-obj-y)
 tests/test-iov$(EXESUF): tests/test-iov.o $(test-util-obj-y)
 tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o $(test-util-obj-y)
 tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o
-tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o page_cache.o $(test-util-obj-y)
+tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o migration/xbzrle.o migration/page_cache.o $(test-util-obj-y)
 tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o
 tests/test-int128$(EXESUF): tests/test-int128.o
 tests/rcutorture$(EXESUF): tests/rcutorture.o $(test-util-obj-y)
Signature · 1 line
2.9.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#13 lore raw

PATCH 9/41 migration: Move qjson.h to migration/

In reply to Juan Quintela

It is only used for migration code.

---
 migration/qjson.c                        | 2 +-
 {include/migration => migration}/qjson.h | 0
 migration/vmstate.c                      | 2 +-
 3 files changed, 2 insertions(+), 2 deletions(-)
 rename {include/migration => migration}/qjson.h (100%)
migration/qjson.c +1 -1
index f345904..9d7f6eb 100644
@@ -25,7 +25,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/qmp/qstring.h"
-#include "migration/qjson.h"
+#include "qjson.h"
 
 struct QJSON {
     QString *str;
migration/qjson.h renamed from include/migration/qjson.h +0 -0
similarity index 100%
rename from include/migration/qjson.h
rename to migration/qjson.h
migration/vmstate.c +1 -1
index 7b4a607..66c50ee 100644
@@ -7,7 +7,7 @@
 #include "qemu/error-report.h"
 #include "qemu/queue.h"
 #include "trace.h"
-#include "migration/qjson.h"
+#include "qjson.h"
 
 static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
                                     void *opaque, QJSON *vmdesc);
Signature · 1 line
2.9.3
#14 lore raw

PATCH 10/41 migration: Move postcopy-ram.h to migration/

In reply to Juan Quintela

It is internal to migration, not intended for other users.

---
 migration/migration.c                           | 2 +-
 migration/postcopy-ram.c                        | 2 +-
 {include/migration => migration}/postcopy-ram.h | 0
 migration/ram.c                                 | 2 +-
 migration/savevm.c                              | 2 +-
 5 files changed, 4 insertions(+), 4 deletions(-)
 rename {include/migration => migration}/postcopy-ram.h (100%)
migration/migration.c +1 -1
index fe30227..fef1f0a 100644
@@ -28,7 +28,7 @@
 #include "qemu/sockets.h"
 #include "qemu/rcu.h"
 #include "migration/block.h"
-#include "migration/postcopy-ram.h"
+#include "postcopy-ram.h"
 #include "qemu/thread.h"
 #include "qmp-commands.h"
 #include "trace.h"
migration/postcopy-ram.c +1 -1
index e3f4a37..cdadaf6 100644
@@ -20,7 +20,7 @@
 
 #include "qemu-common.h"
 #include "migration/migration.h"
-#include "migration/postcopy-ram.h"
+#include "postcopy-ram.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/balloon.h"
 #include "qemu/error-report.h"
migration/postcopy-ram.h renamed from include/migration/postcopy-ram.h +0 -0
similarity index 100%
rename from include/migration/postcopy-ram.h
rename to migration/postcopy-ram.h
migration/ram.c +1 -1
index 47e66f4..5fcf593 100644
@@ -37,7 +37,7 @@
 #include "qemu/main-loop.h"
 #include "xbzrle.h"
 #include "migration/migration.h"
-#include "migration/postcopy-ram.h"
+#include "postcopy-ram.h"
 #include "exec/address-spaces.h"
 #include "migration/page_cache.h"
 #include "qemu/error-report.h"
migration/savevm.c +1 -1
index 7a07ea6..1b2a83c 100644
@@ -37,7 +37,7 @@
 #include "qemu/timer.h"
 #include "migration/migration.h"
 #include "qemu-file-channel.h"
-#include "migration/postcopy-ram.h"
+#include "postcopy-ram.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
 #include "qemu/queue.h"
Signature · 1 line
2.9.3
#15 lore raw

Re: [Qemu-devel] [PATCH 10/41] migration: Move postcopy-ram.h to migration/

Quoted 17 lines · * Juan Quintela ([email protected]) wrote:

It is internal to migration, not intended for other users.

---
 migration/migration.c                           | 2 +-
 migration/postcopy-ram.c                        | 2 +-
 {include/migration => migration}/postcopy-ram.h | 0
 migration/ram.c                                 | 2 +-
 migration/savevm.c                              | 2 +-
 5 files changed, 4 insertions(+), 4 deletions(-)
 rename {include/migration => migration}/postcopy-ram.h (100%)
migration/migration.c +0 -0
index fe30227..fef1f0a 100644

migration/migration.c line 31

Quoted 5 lines
migration/migration.c +1 -1
@@ -28,7 +28,7 @@
 #include "qemu/sockets.h"
 #include "qemu/rcu.h"
 #include "migration/block.h"
-#include "migration/postcopy-ram.h"
+#include "postcopy-ram.h"

Do we need to do all those #include changes, it's still migration/postcopy-ram.h, it seems to work for me without changing the includes.

Dave

Quoted 49 lines
migration/migration.c +0 -0
 #include "qemu/thread.h"
 #include "qmp-commands.h"
 #include "trace.h"
migration/postcopy-ram.c +1 -1
index e3f4a37..cdadaf6 100644
@@ -20,7 +20,7 @@
 
 #include "qemu-common.h"
 #include "migration/migration.h"
-#include "migration/postcopy-ram.h"
+#include "postcopy-ram.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/balloon.h"
 #include "qemu/error-report.h"
migration/postcopy-ram.h renamed from include/migration/postcopy-ram.h +0 -0
similarity index 100%
rename from include/migration/postcopy-ram.h
rename to migration/postcopy-ram.h
migration/ram.c +1 -1
index 47e66f4..5fcf593 100644
@@ -37,7 +37,7 @@
 #include "qemu/main-loop.h"
 #include "xbzrle.h"
 #include "migration/migration.h"
-#include "migration/postcopy-ram.h"
+#include "postcopy-ram.h"
 #include "exec/address-spaces.h"
 #include "migration/page_cache.h"
 #include "qemu/error-report.h"
migration/savevm.c +1 -1
index 7a07ea6..1b2a83c 100644
@@ -37,7 +37,7 @@
 #include "qemu/timer.h"
 #include "migration/migration.h"
 #include "qemu-file-channel.h"
-#include "migration/postcopy-ram.h"
+#include "postcopy-ram.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
 #include "qemu/queue.h"
Signature · 1 line
2.9.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#16 lore raw

PATCH 11/41 migration: Split vmstate-types.c from vmstate.c

In reply to Juan Quintela

Now one just has the interperter, and the other has the basic types. Once there, add copyright boilerplate.

---
 migration/Makefile.objs   |   2 +-
 migration/vmstate-types.c | 676 ++++++++++++++++++++++++++++++++++++++++++++++
 migration/vmstate.c       | 669 ++-------------------------------------------
 tests/Makefile.include    |   2 +-
 4 files changed, 705 insertions(+), 644 deletions(-)
 create mode 100644 migration/vmstate-types.c
migration/Makefile.objs +1 -1
index ce8ce12..812b2ec 100644
@@ -1,7 +1,7 @@
 common-obj-y += migration.o socket.o fd.o exec.o
 common-obj-y += tls.o channel.o
 common-obj-y += colo-comm.o colo.o colo-failover.o
-common-obj-y += vmstate.o page_cache.o
+common-obj-y += vmstate.o vmstate-types.o page_cache.o
 common-obj-y += qemu-file.o
 common-obj-y += qemu-file-channel.o
 common-obj-y += xbzrle.o postcopy-ram.o
migration/vmstate-types.c new file +676 -0

676 lines not on this page · raw message

migration/vmstate.c +27 -642

681 lines not on this page · raw message

tests/Makefile.include +1 -1
index 0f98c04..7eaf586 100644
@@ -569,7 +569,7 @@ tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
 	hw/core/reset.o \
 	$(test-qapi-obj-y)
 tests/test-vmstate$(EXESUF): tests/test-vmstate.o \
-	migration/vmstate.o migration/qemu-file.o \
+	migration/vmstate.o migration/vmstate-types.o migration/qemu-file.o \
         migration/qemu-file-channel.o migration/qjson.o \
 	$(test-io-obj-y)
 tests/test-timed-average$(EXESUF): tests/test-timed-average.o $(test-util-obj-y)
Signature · 1 line
2.9.3
#17 lore raw

PATCH 12/41 migration: Remove qemu-file.h from vmstate.h

In reply to Juan Quintela

--

minor rearangements due to the rebase

---
 include/hw/hw.h             | 1 +
 include/migration/vmstate.h | 3 ---
 migration/block.c           | 1 +
 migration/colo.c            | 1 +
 migration/postcopy-ram.c    | 1 +
 migration/ram.c             | 1 +
 tests/test-vmstate.c        | 1 +
 7 files changed, 6 insertions(+), 3 deletions(-)
include/hw/hw.h +1 -0
index e22d4ce..af9eae1 100644
@@ -11,6 +11,7 @@
 #include "exec/memory.h"
 #include "hw/irq.h"
 #include "migration/vmstate.h"
+#include "migration/qemu-file.h"
 #include "qemu/module.h"
 #include "sysemu/reset.h"
 
include/migration/vmstate.h +0 -3
index 4396d7e..e9f5bc8 100644
@@ -27,9 +27,6 @@
 #ifndef QEMU_VMSTATE_H
 #define QEMU_VMSTATE_H
 
-#ifndef CONFIG_USER_ONLY
-#include "migration/qemu-file.h"
-#endif
 #include "migration/qjson.h"
 
 typedef void SaveStateHandler(QEMUFile *f, void *opaque);
migration/block.c +1 -0
index fcfa823..d2923b3 100644
@@ -26,6 +26,7 @@
 #include "migration/block.h"
 #include "migration/migration.h"
 #include "sysemu/blockdev.h"
+#include "migration/qemu-file.h"
 #include "sysemu/block-backend.h"
 
 #define BLOCK_SIZE                       (1 << 20)
migration/colo.c +1 -0
index 31ab23f..94cdb89 100644
@@ -15,6 +15,7 @@
 #include "sysemu/sysemu.h"
 #include "qemu-file-channel.h"
 #include "migration/migration.h"
+#include "migration/qemu-file.h"
 #include "migration/colo.h"
 #include "io/channel-buffer.h"
 #include "trace.h"
migration/postcopy-ram.c +1 -0
index cdadaf6..019e031 100644
@@ -20,6 +20,7 @@
 
 #include "qemu-common.h"
 #include "migration/migration.h"
+#include "migration/qemu-file.h"
 #include "postcopy-ram.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/balloon.h"
migration/ram.c +1 -0
index 5fcf593..8e1c136 100644
@@ -37,6 +37,7 @@
 #include "qemu/main-loop.h"
 #include "xbzrle.h"
 #include "migration/migration.h"
+#include "migration/qemu-file.h"
 #include "postcopy-ram.h"
 #include "exec/address-spaces.h"
 #include "migration/page_cache.h"
tests/test-vmstate.c +1 -0
index 1c13570..25389bc 100644
@@ -27,6 +27,7 @@
 #include "qemu-common.h"
 #include "migration/migration.h"
 #include "migration/vmstate.h"
+#include "migration/qemu-file.h"
 #include "../migration/qemu-file-channel.h"
 #include "qemu/coroutine.h"
 #include "io/channel-file.h"
Signature · 1 line
2.9.3
#18 lore raw

PATCH 13/41 migration: Remove vmstate.h from migration.h

In reply to Juan Quintela

--

Minor rearrangements due to rebase

---
 include/migration/migration.h | 1 -
 migration/block.c             | 1 +
 migration/colo-comm.c         | 1 +
 migration/migration.c         | 1 +
 migration/ram.c               | 1 +
 5 files changed, 4 insertions(+), 1 deletion(-)
include/migration/migration.h +0 -1
index d465624..22578db 100644
@@ -18,7 +18,6 @@
 #include "qemu-common.h"
 #include "qemu/thread.h"
 #include "qemu/notify.h"
-#include "migration/vmstate.h"
 #include "io/channel.h"
 #include "qapi-types.h"
 #include "exec/cpu-common.h"
migration/block.c +1 -0
index d2923b3..c919787 100644
@@ -27,6 +27,7 @@
 #include "migration/migration.h"
 #include "sysemu/blockdev.h"
 #include "migration/qemu-file.h"
+#include "migration/vmstate.h"
 #include "sysemu/block-backend.h"
 
 #define BLOCK_SIZE                       (1 << 20)
migration/colo-comm.c +1 -0
index 9b35027..b4288b8 100644
@@ -13,6 +13,7 @@
 
 #include "qemu/osdep.h"
 #include "migration/migration.h"
+#include "migration/vmstate.h"
 #include "colo.h"
 #include "trace.h"
 
migration/migration.c +1 -0
index fef1f0a..4668236 100644
@@ -21,6 +21,7 @@
 #include "migration/migration.h"
 #include "qemu-file-channel.h"
 #include "migration/qemu-file.h"
+#include "migration/vmstate.h"
 #include "sysemu/sysemu.h"
 #include "block/block.h"
 #include "qapi/qmp/qerror.h"
migration/ram.c +1 -0
index 8e1c136..c431ef9 100644
@@ -38,6 +38,7 @@
 #include "xbzrle.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
+#include "migration/vmstate.h"
 #include "postcopy-ram.h"
 #include "exec/address-spaces.h"
 #include "migration/page_cache.h"
Signature · 1 line
2.9.3
Reviewed-by on v1 13/41
#19 lore raw

Re: [Qemu-devel] [PATCH 13/41] migration: Remove vmstate.h from migration.h

Quoted 2 lines · Juan Quintela
Quoted 74 lines

--

Minor rearrangements due to rebase

---
 include/migration/migration.h | 1 -
 migration/block.c             | 1 +
 migration/colo-comm.c         | 1 +
 migration/migration.c         | 1 +
 migration/ram.c               | 1 +
 5 files changed, 4 insertions(+), 1 deletion(-)
include/migration/migration.h +0 -1
index d465624..22578db 100644
@@ -18,7 +18,6 @@
 #include "qemu-common.h"
 #include "qemu/thread.h"
 #include "qemu/notify.h"
-#include "migration/vmstate.h"
 #include "io/channel.h"
 #include "qapi-types.h"
 #include "exec/cpu-common.h"
migration/block.c +1 -0
index d2923b3..c919787 100644
@@ -27,6 +27,7 @@
 #include "migration/migration.h"
 #include "sysemu/blockdev.h"
 #include "migration/qemu-file.h"
+#include "migration/vmstate.h"
 #include "sysemu/block-backend.h"
 
 #define BLOCK_SIZE                       (1 << 20)
migration/colo-comm.c +1 -0
index 9b35027..b4288b8 100644
@@ -13,6 +13,7 @@
 
 #include "qemu/osdep.h"
 #include "migration/migration.h"
+#include "migration/vmstate.h"
 #include "colo.h"
 #include "trace.h"
 
migration/migration.c +1 -0
index fef1f0a..4668236 100644
@@ -21,6 +21,7 @@
 #include "migration/migration.h"
 #include "qemu-file-channel.h"
 #include "migration/qemu-file.h"
+#include "migration/vmstate.h"
 #include "sysemu/sysemu.h"
 #include "block/block.h"
 #include "qapi/qmp/qerror.h"
migration/ram.c +1 -0
index 8e1c136..c431ef9 100644
@@ -38,6 +38,7 @@
 #include "xbzrle.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
+#include "migration/vmstate.h"
 #include "postcopy-ram.h"
 #include "exec/address-spaces.h"
 #include "migration/page_cache.h"
#20 lore raw

PATCH 14/41 migration: migration.h was not needed

In reply to Juan Quintela

This files don't use any function from migration.h, so drop it.

---
 block/qed.c             | 1 -
 hw/i386/pc_q35.c        | 1 -
 hw/virtio/vhost-user.c  | 1 -
 hw/virtio/vhost-vsock.c | 1 -
 hw/virtio/virtio.c      | 1 -
 monitor.c               | 1 -
 6 files changed, 6 deletions(-)
block/qed.c +0 -1
index 5ec7fd8..0d2f3bf 100644
@@ -19,7 +19,6 @@
 #include "trace.h"
 #include "qed.h"
 #include "qapi/qmp/qerror.h"
-#include "migration/migration.h"
 #include "sysemu/block-backend.h"
 
 static const AIOCBInfo qed_aiocb_info = {
hw/i386/pc_q35.c +0 -1
index dd792a8..76b08f8 100644
@@ -46,7 +46,6 @@
 #include "hw/ide/ahci.h"
 #include "hw/usb.h"
 #include "qemu/error-report.h"
-#include "migration/migration.h"
 
 /* ICH9 AHCI has 6 ports */
 #define MAX_SATA_PORTS     6
hw/virtio/vhost-user.c +0 -1
index 9334a8a..ebc8ccf 100644
@@ -17,7 +17,6 @@
 #include "sysemu/kvm.h"
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
-#include "migration/migration.h"
 
 #include <sys/ioctl.h>
 #include <sys/socket.h>
hw/virtio/vhost-vsock.c +0 -1
index b481562..49e0022 100644
@@ -17,7 +17,6 @@
 #include "qapi/error.h"
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
-#include "migration/migration.h"
 #include "qemu/error-report.h"
 #include "hw/virtio/vhost-vsock.h"
 #include "qemu/iov.h"
hw/virtio/virtio.c +0 -1
index 03592c5..2d2b6bf 100644
@@ -21,7 +21,6 @@
 #include "hw/virtio/virtio.h"
 #include "qemu/atomic.h"
 #include "hw/virtio/virtio-bus.h"
-#include "migration/migration.h"
 #include "hw/virtio/virtio-access.h"
 #include "sysemu/dma.h"
 
monitor.c +0 -1
index d02900d..ec5ad1f 100644
@@ -49,7 +49,6 @@
 #include "disas/disas.h"
 #include "sysemu/balloon.h"
 #include "qemu/timer.h"
-#include "migration/migration.h"
 #include "sysemu/hw_accel.h"
 #include "qemu/acl.h"
 #include "sysemu/tpm.h"
Signature · 1 line
2.9.3
#21 lore raw

PATCH 15/41 migration: Create include for migration snapshots

In reply to Juan Quintela

Start removing migration code from sysemu/sysemu.h.

---
 hmp.c                        |  1 +
 include/migration/snapshot.h | 20 ++++++++++++++++++++
 include/sysemu/sysemu.h      |  3 ---
 migration/savevm.c           |  1 +
 replay/replay-snapshot.c     |  1 +
 vl.c                         |  1 +
 6 files changed, 24 insertions(+), 3 deletions(-)
 create mode 100644 include/migration/snapshot.h
hmp.c +1 -0
index d81f71e..235cc2a 100644
@@ -39,6 +39,7 @@
 #include "qemu/cutils.h"
 #include "qemu/error-report.h"
 #include "hw/intc/intc.h"
+#include "migration/snapshot.h"
 
 #ifdef CONFIG_SPICE
 #include <spice/enums.h>
include/migration/snapshot.h new file +20 -0
new file mode 100644
index 0000000..a390fea
@@ -0,0 +1,20 @@
+/*
+ * QEMU save vm functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_SAVEVM_H
+#define QEMU_MIGRATION_SAVEVM_H
+
+int save_vmstate(const char *name, Error **errp);
+int load_vmstate(const char *name, Error **errp);
+
+#endif
include/sysemu/sysemu.h +0 -3
index 3340202..0d496d3 100644
@@ -75,9 +75,6 @@ void qemu_remove_exit_notifier(Notifier *notify);
 void qemu_add_machine_init_done_notifier(Notifier *notify);
 void qemu_remove_machine_init_done_notifier(Notifier *notify);
 
-int save_vmstate(const char *name, Error **errp);
-int load_vmstate(const char *name, Error **errp);
-
 void qemu_announce_self(void);
 
 /* Subcommands for QEMU_VM_COMMAND */
migration/savevm.c +1 -0
index 1b2a83c..2f76a8a 100644
@@ -36,6 +36,7 @@
 #include "sysemu/sysemu.h"
 #include "qemu/timer.h"
 #include "migration/migration.h"
+#include "migration/snapshot.h"
 #include "qemu-file-channel.h"
 #include "postcopy-ram.h"
 #include "qapi/qmp/qerror.h"
replay/replay-snapshot.c +1 -0
index fdc4353..86ae8dd 100644
@@ -19,6 +19,7 @@
 #include "qapi/qmp/qstring.h"
 #include "qemu/error-report.h"
 #include "migration/vmstate.h"
+#include "migration/snapshot.h"
 
 static void replay_pre_save(void *opaque)
 {
vl.c +1 -0
index 8b3ec2e..53a9d19 100644
@@ -87,6 +87,7 @@ int main(int argc, char **argv)
 #include "sysemu/blockdev.h"
 #include "hw/block/block.h"
 #include "migration/block.h"
+#include "migration/snapshot.h"
 #include "sysemu/tpm.h"
 #include "sysemu/dma.h"
 #include "audio/audio.h"
Signature · 1 line
2.9.3
#22 lore raw

PATCH 16/41 migration: Rename {save, load}_vmstate to {save, load}_snapshot

In reply to Juan Quintela

It reflects what they do. And make it easier to not confuse with vmstate_{save,load}_state.

---
 hmp.c                        | 4 ++--
 include/block/block_int.h    | 4 ++--
 include/migration/snapshot.h | 4 ++--
 migration/savevm.c           | 4 ++--
 replay/replay-snapshot.c     | 4 ++--
 vl.c                         | 2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)
hmp.c +2 -2
index 235cc2a..73f97bb 100644
@@ -1278,7 +1278,7 @@ void hmp_loadvm(Monitor *mon, const QDict *qdict)
 
     vm_stop(RUN_STATE_RESTORE_VM);
 
-    if (load_vmstate(name, &err) == 0 && saved_vm_running) {
+    if (load_snapshot(name, &err) == 0 && saved_vm_running) {
         vm_start();
     }
     hmp_handle_error(mon, &err);
@@ -1288,7 +1288,7 @@ void hmp_savevm(Monitor *mon, const QDict *qdict)
 {
     Error *err = NULL;
 
-    save_vmstate(qdict_get_try_str(qdict, "name"), &err);
+    save_snapshot(qdict_get_try_str(qdict, "name"), &err);
     hmp_handle_error(mon, &err);
 }
 
include/block/block_int.h +2 -2
index 4f8cd29..fa74559 100644
@@ -587,8 +587,8 @@ struct BlockDriverState {
     int copy_on_read;
 
     /* If we are reading a disk image, give its size in sectors.
-     * Generally read-only; it is written to by load_vmstate and save_vmstate,
-     * but the block layer is quiescent during those.
+     * Generally read-only; it is written to by load_snapshot and
+     * save_snaphost, but the block layer is quiescent during those.
      */
     int64_t total_sectors;
 
include/migration/snapshot.h +2 -2
index a390fea..f04bd79 100644
@@ -14,7 +14,7 @@
 #ifndef QEMU_MIGRATION_SAVEVM_H
 #define QEMU_MIGRATION_SAVEVM_H
 
-int save_vmstate(const char *name, Error **errp);
-int load_vmstate(const char *name, Error **errp);
+int save_snapshot(const char *name, Error **errp);
+int load_snapshot(const char *name, Error **errp);
 
 #endif
migration/savevm.c +2 -2
index 2f76a8a..a6bc1f9 100644
@@ -2056,7 +2056,7 @@ int qemu_loadvm_state(QEMUFile *f)
     return ret;
 }
 
-int save_vmstate(const char *name, Error **errp)
+int save_snapshot(const char *name, Error **errp)
 {
     BlockDriverState *bs, *bs1;
     QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1;
@@ -2213,7 +2213,7 @@ void qmp_xen_load_devices_state(const char *filename, Error **errp)
     migration_incoming_state_destroy();
 }
 
-int load_vmstate(const char *name, Error **errp)
+int load_snapshot(const char *name, Error **errp)
 {
     BlockDriverState *bs, *bs_vm_state;
     QEMUSnapshotInfo sn;
replay/replay-snapshot.c +2 -2
index 86ae8dd..0522cd2 100644
@@ -67,12 +67,12 @@ void replay_vmstate_init(void)
 
     if (replay_snapshot) {
         if (replay_mode == REPLAY_MODE_RECORD) {
-            if (save_vmstate(replay_snapshot, &err) != 0) {
+            if (save_snapshot(replay_snapshot, &err) != 0) {
                 error_report("Could not create snapshot for icount record");
                 exit(1);
             }
         } else if (replay_mode == REPLAY_MODE_PLAY) {
-            if (load_vmstate(replay_snapshot, &err) != 0) {
+            if (load_snapshot(replay_snapshot, &err) != 0) {
                 error_report("Could not load snapshot for icount replay");
                 exit(1);
             }
vl.c +1 -1
index 53a9d19..5b79f5b 100644
@@ -4683,7 +4683,7 @@ int main(int argc, char **argv, char **envp)
         replay_vmstate_init();
     } else if (loadvm) {
         Error *local_err = NULL;
-        if (load_vmstate(loadvm, &local_err) < 0) {
+        if (load_snapshot(loadvm, &local_err) < 0) {
             error_report_err(local_err);
             autostart = 0;
         }
Signature · 1 line
2.9.3
#23 lore raw

PATCH 17/41 migration: Create savevm.h for functions exported from savevm.c

In reply to Juan Quintela

This removes last trace of migration functions from sysemu/sysemu.h.

---
 include/sysemu/sysemu.h  | 47 -----------------------------------------------
 migration/colo.c         |  1 +
 migration/migration.c    |  1 +
 migration/postcopy-ram.c |  1 +
 migration/savevm.c       | 29 +++++++++++++++++++++++++----
 migration/savevm.h       | 41 +++++++++++++++++++++++++++++++++++++++++
 6 files changed, 69 insertions(+), 51 deletions(-)
 create mode 100644 migration/savevm.h
include/sysemu/sysemu.h +0 -47
index 0d496d3..503b51f 100644
@@ -77,53 +77,6 @@ void qemu_remove_machine_init_done_notifier(Notifier *notify);
 
 void qemu_announce_self(void);
 
-/* Subcommands for QEMU_VM_COMMAND */
-enum qemu_vm_cmd {
-    MIG_CMD_INVALID = 0,   /* Must be 0 */
-    MIG_CMD_OPEN_RETURN_PATH,  /* Tell the dest to open the Return path */
-    MIG_CMD_PING,              /* Request a PONG on the RP */
-
-    MIG_CMD_POSTCOPY_ADVISE,       /* Prior to any page transfers, just
-                                      warn we might want to do PC */
-    MIG_CMD_POSTCOPY_LISTEN,       /* Start listening for incoming
-                                      pages as it's running. */
-    MIG_CMD_POSTCOPY_RUN,          /* Start execution */
-
-    MIG_CMD_POSTCOPY_RAM_DISCARD,  /* A list of pages to discard that
-                                      were previously sent during
-                                      precopy but are dirty. */
-    MIG_CMD_PACKAGED,          /* Send a wrapped stream within this stream */
-    MIG_CMD_MAX
-};
-
-#define MAX_VM_CMD_PACKAGED_SIZE (1ul << 24)
-
-bool qemu_savevm_state_blocked(Error **errp);
-void qemu_savevm_state_begin(QEMUFile *f);
-void qemu_savevm_state_header(QEMUFile *f);
-int qemu_savevm_state_iterate(QEMUFile *f, bool postcopy);
-void qemu_savevm_state_cleanup(void);
-void qemu_savevm_state_complete_postcopy(QEMUFile *f);
-void qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only);
-void qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size,
-                               uint64_t *res_non_postcopiable,
-                               uint64_t *res_postcopiable);
-void qemu_savevm_command_send(QEMUFile *f, enum qemu_vm_cmd command,
-                              uint16_t len, uint8_t *data);
-void qemu_savevm_send_ping(QEMUFile *f, uint32_t value);
-void qemu_savevm_send_open_return_path(QEMUFile *f);
-int qemu_savevm_send_packaged(QEMUFile *f, const uint8_t *buf, size_t len);
-void qemu_savevm_send_postcopy_advise(QEMUFile *f);
-void qemu_savevm_send_postcopy_listen(QEMUFile *f);
-void qemu_savevm_send_postcopy_run(QEMUFile *f);
-
-void qemu_savevm_send_postcopy_ram_discard(QEMUFile *f, const char *name,
-                                           uint16_t len,
-                                           uint64_t *start_list,
-                                           uint64_t *length_list);
-
-int qemu_loadvm_state(QEMUFile *f);
-
 extern int autostart;
 
 typedef enum {
migration/colo.c +1 -0
index 94cdb89..ff268bd 100644
@@ -16,6 +16,7 @@
 #include "qemu-file-channel.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
+#include "migration/savevm.h"
 #include "migration/colo.h"
 #include "io/channel-buffer.h"
 #include "trace.h"
migration/migration.c +1 -0
index 4668236..367b039 100644
@@ -19,6 +19,7 @@
 #include "qemu/main-loop.h"
 #include "migration/blocker.h"
 #include "migration/migration.h"
+#include "savevm.h"
 #include "qemu-file-channel.h"
 #include "migration/qemu-file.h"
 #include "migration/vmstate.h"
migration/postcopy-ram.c +1 -0
index 019e031..0b02755 100644
@@ -21,6 +21,7 @@
 #include "qemu-common.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
+#include "savevm.h"
 #include "postcopy-ram.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/balloon.h"
migration/savevm.c +25 -4
index a6bc1f9..483eda1 100644
@@ -38,6 +38,7 @@
 #include "migration/migration.h"
 #include "migration/snapshot.h"
 #include "qemu-file-channel.h"
+#include "savevm.h"
 #include "postcopy-ram.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
@@ -64,6 +65,26 @@ const unsigned int postcopy_ram_discard_version = 0;
 
 static bool skip_section_footers;
 
+/* Subcommands for QEMU_VM_COMMAND */
+enum qemu_vm_cmd {
+    MIG_CMD_INVALID = 0,   /* Must be 0 */
+    MIG_CMD_OPEN_RETURN_PATH,  /* Tell the dest to open the Return path */
+    MIG_CMD_PING,              /* Request a PONG on the RP */
+
+    MIG_CMD_POSTCOPY_ADVISE,       /* Prior to any page transfers, just
+                                      warn we might want to do PC */
+    MIG_CMD_POSTCOPY_LISTEN,       /* Start listening for incoming
+                                      pages as it's running. */
+    MIG_CMD_POSTCOPY_RUN,          /* Start execution */
+
+    MIG_CMD_POSTCOPY_RAM_DISCARD,  /* A list of pages to discard that
+                                      were previously sent during
+                                      precopy but are dirty. */
+    MIG_CMD_PACKAGED,          /* Send a wrapped stream within this stream */
+    MIG_CMD_MAX
+};
+
+#define MAX_VM_CMD_PACKAGED_SIZE (1ul << 24)
 static struct mig_cmd_args {
     ssize_t     len; /* -1 = variable */
     const char *name;
@@ -807,10 +828,10 @@ static void save_section_footer(QEMUFile *f, SaveStateEntry *se)
  * @len: Length of associated data
  * @data: Data associated with command.
  */
-void qemu_savevm_command_send(QEMUFile *f,
-                              enum qemu_vm_cmd command,
-                              uint16_t len,
-                              uint8_t *data)
+static void qemu_savevm_command_send(QEMUFile *f,
+                                     enum qemu_vm_cmd command,
+                                     uint16_t len,
+                                     uint8_t *data)
 {
     trace_savevm_command_send(command, len);
     qemu_put_byte(f, QEMU_VM_COMMAND);
migration/savevm.h new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.9.3
#24 lore raw

PATCH 18/41 migration: Split qemu-file.h

In reply to Juan Quintela

Split the file into public and internal interfaces. I have to rename the external one because we can't have two include files with the same name in the same directory. Build system gets confused. The only exported functions are the ones that handle basic types.

---
 hw/i2c/i2c-ddc.c                             |   1 +
 hw/intc/s390_flic.c                          |   1 -
 hw/intc/s390_flic_kvm.c                      |   1 -
 hw/s390x/s390-skeys.c                        |   1 -
 include/hw/hw.h                              |   2 +-
 include/migration/qemu-file-types.h          | 164 +++++++++++++++++++++++++++
 migration/block.c                            |   2 +-
 migration/colo.c                             |   2 +-
 migration/migration.c                        |   2 +-
 migration/postcopy-ram.c                     |   2 +-
 migration/qemu-file-channel.c                |   3 +-
 migration/qemu-file.c                        |   2 +-
 {include/migration => migration}/qemu-file.h | 157 +------------------------
 migration/ram.c                              |   2 +-
 migration/rdma.c                             |   2 +-
 migration/savevm.c                           |   1 +
 migration/socket.c                           |   2 +-
 migration/vmstate-types.c                    |   3 +-
 migration/vmstate.c                          |   2 +-
 tests/test-vmstate.c                         |   3 +-
 20 files changed, 186 insertions(+), 169 deletions(-)
 create mode 100644 include/migration/qemu-file-types.h
 rename {include/migration => migration}/qemu-file.h (62%)
hw/i2c/i2c-ddc.c +1 -0
index 66899d7..6b92e95 100644
@@ -17,6 +17,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-common.h"
 #include "qemu/log.h"
 #include "hw/i2c/i2c.h"
 #include "hw/i2c/i2c-ddc.h"
hw/intc/s390_flic.c +0 -1
index 711c114..a26e906 100644
@@ -13,7 +13,6 @@
 #include "qemu/osdep.h"
 #include "qemu/error-report.h"
 #include "hw/sysbus.h"
-#include "migration/qemu-file.h"
 #include "hw/s390x/s390_flic.h"
 #include "trace.h"
 #include "hw/qdev.h"
hw/intc/s390_flic_kvm.c +0 -1
index cc44bc4..b4c61d8 100644
@@ -17,7 +17,6 @@
 #include "qemu/error-report.h"
 #include "hw/sysbus.h"
 #include "sysemu/kvm.h"
-#include "migration/qemu-file.h"
 #include "hw/s390x/s390_flic.h"
 #include "hw/s390x/adapter.h"
 #include "trace.h"
hw/s390x/s390-skeys.c +0 -1
index e2d4e1a..619152c 100644
@@ -12,7 +12,6 @@
 #include "qemu/osdep.h"
 #include "hw/boards.h"
 #include "qmp-commands.h"
-#include "migration/qemu-file.h"
 #include "hw/s390x/storage-keys.h"
 #include "qemu/error-report.h"
 #include "sysemu/kvm.h"
include/hw/hw.h +1 -1
index af9eae1..ab4950c 100644
@@ -11,7 +11,7 @@
 #include "exec/memory.h"
 #include "hw/irq.h"
 #include "migration/vmstate.h"
-#include "migration/qemu-file.h"
+#include "migration/qemu-file-types.h"
 #include "qemu/module.h"
 #include "sysemu/reset.h"
 
include/migration/qemu-file-types.h new file +164 -0

164 lines not on this page · raw message

migration/block.c +1 -1
index c919787..c26bdb2 100644
@@ -26,7 +26,7 @@
 #include "migration/block.h"
 #include "migration/migration.h"
 #include "sysemu/blockdev.h"
-#include "migration/qemu-file.h"
+#include "qemu-file.h"
 #include "migration/vmstate.h"
 #include "sysemu/block-backend.h"
 
migration/colo.c +1 -1
index ff268bd..3757ad9 100644
@@ -15,7 +15,7 @@
 #include "sysemu/sysemu.h"
 #include "qemu-file-channel.h"
 #include "migration/migration.h"
-#include "migration/qemu-file.h"
+#include "qemu-file.h"
 #include "migration/savevm.h"
 #include "migration/colo.h"
 #include "io/channel-buffer.h"
migration/migration.c +1 -1
index 367b039..f300b5e 100644
@@ -21,7 +21,7 @@
 #include "migration/migration.h"
 #include "savevm.h"
 #include "qemu-file-channel.h"
-#include "migration/qemu-file.h"
+#include "qemu-file.h"
 #include "migration/vmstate.h"
 #include "sysemu/sysemu.h"
 #include "block/block.h"
migration/postcopy-ram.c +1 -1
index 0b02755..07fbc25 100644
@@ -20,7 +20,7 @@
 
 #include "qemu-common.h"
 #include "migration/migration.h"
-#include "migration/qemu-file.h"
+#include "qemu-file.h"
 #include "savevm.h"
 #include "postcopy-ram.h"
 #include "sysemu/sysemu.h"
migration/qemu-file-channel.c +2 -1
index dc991c9..e202d73 100644
@@ -24,7 +24,8 @@
 
 #include "qemu/osdep.h"
 #include "qemu-file-channel.h"
-#include "migration/qemu-file.h"
+#include "exec/cpu-common.h"
+#include "qemu-file.h"
 #include "io/channel-socket.h"
 #include "qemu/iov.h"
 
migration/qemu-file.c +1 -1
index 195fa94..ab26f4e 100644
@@ -29,7 +29,7 @@
 #include "qemu/sockets.h"
 #include "qemu/coroutine.h"
 #include "migration/migration.h"
-#include "migration/qemu-file.h"
+#include "qemu-file.h"
 #include "trace.h"
 
 #define IO_BUF_SIZE 32768
migration/qemu-file.h renamed from include/migration/qemu-file.h +4 -153

191 lines not on this page · raw message

migration/ram.c +1 -1
index c431ef9..36afa98 100644
@@ -37,7 +37,7 @@
 #include "qemu/main-loop.h"
 #include "xbzrle.h"
 #include "migration/migration.h"
-#include "migration/qemu-file.h"
+#include "qemu-file.h"
 #include "migration/vmstate.h"
 #include "postcopy-ram.h"
 #include "exec/address-spaces.h"
migration/rdma.c +1 -1
index fffe2d6..2fda7a5 100644
@@ -18,7 +18,7 @@
 #include "qemu-common.h"
 #include "qemu/cutils.h"
 #include "migration/migration.h"
-#include "migration/qemu-file.h"
+#include "qemu-file.h"
 #include "exec/cpu-common.h"
 #include "qemu-file-channel.h"
 #include "qemu/error-report.h"
migration/savevm.c +1 -0
index 483eda1..d3e4d8e 100644
@@ -38,6 +38,7 @@
 #include "migration/migration.h"
 #include "migration/snapshot.h"
 #include "qemu-file-channel.h"
+#include "qemu-file.h"
 #include "savevm.h"
 #include "postcopy-ram.h"
 #include "qapi/qmp/qerror.h"
migration/socket.c +1 -1
index a49cf44..6ee69ed 100644
@@ -21,7 +21,7 @@
 #include "qapi/error.h"
 #include "channel.h"
 #include "migration/migration.h"
-#include "migration/qemu-file.h"
+#include "qemu-file.h"
 #include "io/channel-socket.h"
 #include "trace.h"
 
migration/vmstate-types.c +2 -1
index 0cf14d4..c2bd334 100644
@@ -27,8 +27,9 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "exec/cpu-common.h"
+#include "qemu-file.h"
 #include "migration/migration.h"
-#include "migration/qemu-file.h"
 #include "migration/vmstate.h"
 #include "qemu/error-report.h"
 #include "qemu/queue.h"
migration/vmstate.c +1 -1
index c284769..57dc34f 100644
@@ -28,8 +28,8 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "migration/migration.h"
-#include "migration/qemu-file.h"
 #include "migration/vmstate.h"
+#include "qemu-file.h"
 #include "qemu/bitops.h"
 #include "qemu/error-report.h"
 #include "trace.h"
tests/test-vmstate.c +2 -1
index 25389bc..c52aff9 100644
@@ -27,7 +27,8 @@
 #include "qemu-common.h"
 #include "migration/migration.h"
 #include "migration/vmstate.h"
-#include "migration/qemu-file.h"
+#include "migration/qemu-file-types.h"
+#include "../migration/qemu-file.h"
 #include "../migration/qemu-file-channel.h"
 #include "qemu/coroutine.h"
 #include "io/channel-file.h"
Signature · 1 line
2.9.3
#25 lore raw

PATCH 19/41 migration: Remove unneeded includes of migration/vmstate.h

In reply to Juan Quintela
---
 hw/core/qdev.c                   | 1 -
 include/hw/acpi/memory_hotplug.h | 1 -
 include/hw/acpi/pcihp.h          | 1 -
 include/hw/pci/shpc.h            | 1 -
 include/net/net.h                | 1 -
 target/alpha/cpu.c               | 1 -
 target/hppa/cpu.c                | 1 -
 target/s390x/cpu.c               | 1 -
 target/tilegx/cpu.c              | 1 -
 9 files changed, 9 deletions(-)
hw/core/qdev.c +0 -1
index 17ff638..23ccf9f 100644
@@ -37,7 +37,6 @@
 #include "hw/boards.h"
 #include "hw/sysbus.h"
 #include "qapi-event.h"
-#include "migration/vmstate.h"
 
 bool qdev_hotplug = false;
 static bool qdev_hot_added = false;
include/hw/acpi/memory_hotplug.h +0 -1
index db8ebc9..77c6576 100644
@@ -3,7 +3,6 @@
 
 #include "hw/qdev-core.h"
 #include "hw/acpi/acpi.h"
-#include "migration/vmstate.h"
 #include "hw/acpi/aml-build.h"
 
 /**
include/hw/acpi/pcihp.h +0 -1
index 04528b7..8a65f99 100644
@@ -28,7 +28,6 @@
 #define HW_ACPI_PCIHP_H
 
 #include "hw/acpi/acpi.h"
-#include "migration/vmstate.h"
 #include "hw/hotplug.h"
 
 #define ACPI_PCIHP_IO_BASE_PROP "acpi-pcihp-io-base"
include/hw/pci/shpc.h +0 -1
index b208554..71e836b 100644
@@ -3,7 +3,6 @@
 
 #include "qemu-common.h"
 #include "exec/memory.h"
-#include "migration/vmstate.h"
 #include "hw/hotplug.h"
 #include "hw/pci/pci.h"
 
include/net/net.h +0 -1
index 99b28d5..ba663bd 100644
@@ -6,7 +6,6 @@
 #include "qapi/qmp/qdict.h"
 #include "qemu/option.h"
 #include "net/queue.h"
-#include "migration/vmstate.h"
 #include "qapi-types.h"
 
 #define MAC_FMT "%02X:%02X:%02X:%02X:%02X:%02X"
target/alpha/cpu.c +0 -1
index b4f9798..8186c9d 100644
@@ -23,7 +23,6 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu-common.h"
-#include "migration/vmstate.h"
 #include "exec/exec-all.h"
 
 
target/hppa/cpu.c +0 -1
index 1d791d0..30299e9 100644
@@ -22,7 +22,6 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu-common.h"
-#include "migration/vmstate.h"
 #include "exec/exec-all.h"
 
 
target/s390x/cpu.c +0 -1
index 066dcd1..cfd3b70 100644
@@ -32,7 +32,6 @@
 #include "qemu/error-report.h"
 #include "trace.h"
 #include "qapi/visitor.h"
-#include "migration/vmstate.h"
 #include "exec/exec-all.h"
 #ifndef CONFIG_USER_ONLY
 #include "hw/hw.h"
target/tilegx/cpu.c +0 -1
index d90e38e..4532639 100644
@@ -23,7 +23,6 @@
 #include "cpu.h"
 #include "qemu-common.h"
 #include "hw/qdev-properties.h"
-#include "migration/vmstate.h"
 #include "linux-user/syscall_defs.h"
 #include "exec/exec-all.h"
 
Signature · 1 line
2.9.3
Reviewed-by on v1 19/41
#26 lore raw

Re: [Qemu-devel] [PATCH 19/41] migration: Remove unneeded includes of migration/vmstate.h

Quoted 1 line · Juan Quintela
Quoted 121 lines
---
 hw/core/qdev.c                   | 1 -
 include/hw/acpi/memory_hotplug.h | 1 -
 include/hw/acpi/pcihp.h          | 1 -
 include/hw/pci/shpc.h            | 1 -
 include/net/net.h                | 1 -
 target/alpha/cpu.c               | 1 -
 target/hppa/cpu.c                | 1 -
 target/s390x/cpu.c               | 1 -
 target/tilegx/cpu.c              | 1 -
 9 files changed, 9 deletions(-)
hw/core/qdev.c +0 -1
index 17ff638..23ccf9f 100644
@@ -37,7 +37,6 @@
 #include "hw/boards.h"
 #include "hw/sysbus.h"
 #include "qapi-event.h"
-#include "migration/vmstate.h"
 
 bool qdev_hotplug = false;
 static bool qdev_hot_added = false;
include/hw/acpi/memory_hotplug.h +0 -1
index db8ebc9..77c6576 100644
@@ -3,7 +3,6 @@
 
 #include "hw/qdev-core.h"
 #include "hw/acpi/acpi.h"
-#include "migration/vmstate.h"
 #include "hw/acpi/aml-build.h"
 
 /**
include/hw/acpi/pcihp.h +0 -1
index 04528b7..8a65f99 100644
@@ -28,7 +28,6 @@
 #define HW_ACPI_PCIHP_H
 
 #include "hw/acpi/acpi.h"
-#include "migration/vmstate.h"
 #include "hw/hotplug.h"
 
 #define ACPI_PCIHP_IO_BASE_PROP "acpi-pcihp-io-base"
include/hw/pci/shpc.h +0 -1
index b208554..71e836b 100644
@@ -3,7 +3,6 @@
 
 #include "qemu-common.h"
 #include "exec/memory.h"
-#include "migration/vmstate.h"
 #include "hw/hotplug.h"
 #include "hw/pci/pci.h"
 
include/net/net.h +0 -1
index 99b28d5..ba663bd 100644
@@ -6,7 +6,6 @@
 #include "qapi/qmp/qdict.h"
 #include "qemu/option.h"
 #include "net/queue.h"
-#include "migration/vmstate.h"
 #include "qapi-types.h"
 
 #define MAC_FMT "%02X:%02X:%02X:%02X:%02X:%02X"
target/alpha/cpu.c +0 -1
index b4f9798..8186c9d 100644
@@ -23,7 +23,6 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu-common.h"
-#include "migration/vmstate.h"
 #include "exec/exec-all.h"
 
 
target/hppa/cpu.c +0 -1
index 1d791d0..30299e9 100644
@@ -22,7 +22,6 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu-common.h"
-#include "migration/vmstate.h"
 #include "exec/exec-all.h"
 
 
target/s390x/cpu.c +0 -1
index 066dcd1..cfd3b70 100644
@@ -32,7 +32,6 @@
 #include "qemu/error-report.h"
 #include "trace.h"
 #include "qapi/visitor.h"
-#include "migration/vmstate.h"
 #include "exec/exec-all.h"
 #ifndef CONFIG_USER_ONLY
 #include "hw/hw.h"
target/tilegx/cpu.c +0 -1
index d90e38e..4532639 100644
@@ -23,7 +23,6 @@
 #include "cpu.h"
 #include "qemu-common.h"
 #include "hw/qdev-properties.h"
-#include "migration/vmstate.h"
 #include "linux-user/syscall_defs.h"
 #include "exec/exec-all.h"
 
#27 lore raw

PATCH 20/41 migration: Export exec.c functions in its own file

In reply to Juan Quintela
---
 include/migration/migration.h |  4 ----
 migration/exec.c              |  1 +
 migration/exec.h              | 20 ++++++++++++++++++++
 migration/migration.c         |  1 +
 4 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 migration/exec.h
include/migration/migration.h +0 -4
index 22578db..3786f05 100644
@@ -190,10 +190,6 @@ void migration_tls_channel_connect(MigrationState *s,
 
 uint64_t migrate_max_downtime(void);
 
-void exec_start_incoming_migration(const char *host_port, Error **errp);
-
-void exec_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp);
-
 void tcp_start_incoming_migration(const char *host_port, Error **errp);
 
 void tcp_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp);
migration/exec.c +1 -0
index 405d0ab..c532c56 100644
@@ -21,6 +21,7 @@
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "channel.h"
+#include "exec.h"
 #include "migration/migration.h"
 #include "io/channel-command.h"
 #include "trace.h"
migration/exec.h new file +20 -0
new file mode 100644
index 0000000..c97a7e9
@@ -0,0 +1,20 @@
+/*
+ * QEMU live migration exec functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_EXEC_H
+#define QEMU_MIGRATION_EXEC_H
+void exec_start_incoming_migration(const char *host_port, Error **errp);
+
+void exec_start_outgoing_migration(MigrationState *s, const char *host_port,
+                                   Error **errp);
+#endif
migration/migration.c +1 -0
index f300b5e..994f25f 100644
@@ -18,6 +18,7 @@
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
 #include "migration/blocker.h"
+#include "exec.h"
 #include "migration/migration.h"
 #include "savevm.h"
 #include "qemu-file-channel.h"
Signature · 1 line
2.9.3
#28 lore raw

PATCH 21/41 migration: Export fd.c functions in its own file

In reply to Juan Quintela
---
 include/migration/migration.h |  4 ----
 migration/fd.c                |  1 +
 migration/fd.h                | 20 ++++++++++++++++++++
 migration/migration.c         |  1 +
 4 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 migration/fd.h
include/migration/migration.h +0 -4
index 3786f05..fd7d40d 100644
@@ -198,10 +198,6 @@ void unix_start_incoming_migration(const char *path, Error **errp);
 
 void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp);
 
-void fd_start_incoming_migration(const char *path, Error **errp);
-
-void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp);
-
 void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp);
 
 void rdma_start_incoming_migration(const char *host_port, Error **errp);
migration/fd.c +1 -0
index ccaa806..8a04dcd 100644
@@ -18,6 +18,7 @@
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "channel.h"
+#include "fd.h"
 #include "migration/migration.h"
 #include "monitor/monitor.h"
 #include "io/channel-util.h"
migration/fd.h new file +20 -0
new file mode 100644
index 0000000..4ec3298
@@ -0,0 +1,20 @@
+/*
+ * QEMU live migration fd functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_FD_H
+#define QEMU_MIGRATION_FD_H
+void fd_start_incoming_migration(const char *path, Error **errp);
+
+void fd_start_outgoing_migration(MigrationState *s, const char *fdname,
+                                 Error **errp);
+#endif
migration/migration.c +1 -0
index 994f25f..ca5a576 100644
@@ -19,6 +19,7 @@
 #include "qemu/main-loop.h"
 #include "migration/blocker.h"
 #include "exec.h"
+#include "fd.h"
 #include "migration/migration.h"
 #include "savevm.h"
 #include "qemu-file-channel.h"
Signature · 1 line
2.9.3
#29 lore raw

PATCH 22/41 migration: Export socket.c functions in its own file

In reply to Juan Quintela
---
 include/migration/migration.h |  8 --------
 migration/migration.c         |  1 +
 migration/socket.c            |  1 +
 migration/socket.h            | 25 +++++++++++++++++++++++++
 4 files changed, 27 insertions(+), 8 deletions(-)
 create mode 100644 migration/socket.h
include/migration/migration.h +0 -8
index fd7d40d..18ec906 100644
@@ -190,14 +190,6 @@ void migration_tls_channel_connect(MigrationState *s,
 
 uint64_t migrate_max_downtime(void);
 
-void tcp_start_incoming_migration(const char *host_port, Error **errp);
-
-void tcp_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp);
-
-void unix_start_incoming_migration(const char *path, Error **errp);
-
-void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp);
-
 void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp);
 
 void rdma_start_incoming_migration(const char *host_port, Error **errp);
migration/migration.c +1 -0
index ca5a576..f349a8c 100644
@@ -20,6 +20,7 @@
 #include "migration/blocker.h"
 #include "exec.h"
 #include "fd.h"
+#include "socket.h"
 #include "migration/migration.h"
 #include "savevm.h"
 #include "qemu-file-channel.h"
migration/socket.c +1 -0
index 6ee69ed..acb3f0d 100644
@@ -20,6 +20,7 @@
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "channel.h"
+#include "socket.h"
 #include "migration/migration.h"
 #include "qemu-file.h"
 #include "io/channel-socket.h"
migration/socket.h new file +25 -0
new file mode 100644
index 0000000..800fde1
@@ -0,0 +1,25 @@
+/*
+ * QEMU live migration socket functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_SOCKET_H
+#define QEMU_MIGRATION_SOCKET_H
+void tcp_start_incoming_migration(const char *host_port, Error **errp);
+
+void tcp_start_outgoing_migration(MigrationState *s, const char *host_port,
+                                  Error **errp);
+
+void unix_start_incoming_migration(const char *path, Error **errp);
+
+void unix_start_outgoing_migration(MigrationState *s, const char *path,
+                                   Error **errp);
+#endif
Signature · 1 line
2.9.3
#30 lore raw

PATCH 23/41 migration: Export tls.c functions in its own file

In reply to Juan Quintela

Just for the functions exported from tls.c. Notice that we can't remove the migration/migration.h include from tls.c because it access directly MigrationState for the tls params.

---
 include/migration/migration.h | 10 ----------
 migration/channel.c           |  1 +
 migration/migration.c         |  1 -
 migration/tls.c               |  1 +
 migration/tls.h               | 27 +++++++++++++++++++++++++++
 5 files changed, 29 insertions(+), 11 deletions(-)
 create mode 100644 migration/tls.h
include/migration/migration.h +0 -10
index 18ec906..08867c6 100644
@@ -18,7 +18,6 @@
 #include "qemu-common.h"
 #include "qemu/thread.h"
 #include "qemu/notify.h"
-#include "io/channel.h"
 #include "qapi-types.h"
 #include "exec/cpu-common.h"
 #include "qemu/coroutine_int.h"
@@ -179,15 +178,6 @@ void migration_fd_process_incoming(QEMUFile *f);
 
 void qemu_start_incoming_migration(const char *uri, Error **errp);
 
-void migration_tls_channel_process_incoming(MigrationState *s,
-                                            QIOChannel *ioc,
-                                            Error **errp);
-
-void migration_tls_channel_connect(MigrationState *s,
-                                   QIOChannel *ioc,
-                                   const char *hostname,
-                                   Error **errp);
-
 uint64_t migrate_max_downtime(void);
 
 void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp);
migration/channel.c +1 -0
index d9b51de..5a81a60 100644
@@ -15,6 +15,7 @@
 
 #include "qemu/osdep.h"
 #include "channel.h"
+#include "tls.h"
 #include "migration/migration.h"
 #include "qemu-file-channel.h"
 #include "trace.h"
migration/migration.c +0 -1
index f349a8c..175e5c9 100644
@@ -42,7 +42,6 @@
 #include "exec/memory.h"
 #include "exec/address-spaces.h"
 #include "io/channel-buffer.h"
-#include "io/channel-tls.h"
 #include "colo.h"
 
 #define MAX_THROTTLE  (32 << 20)      /* Migration transfer speed throttling */
migration/tls.c +1 -0
index b4cb8fe..d3abd6e 100644
@@ -21,6 +21,7 @@
 #include "qemu/osdep.h"
 #include "channel.h"
 #include "migration/migration.h"
+#include "tls.h"
 #include "io/channel-tls.h"
 #include "crypto/tlscreds.h"
 #include "qemu/error-report.h"
migration/tls.h new file +27 -0
new file mode 100644
index 0000000..1d63263
@@ -0,0 +1,27 @@
+/*
+ * QEMU live migration tls functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_TLS_H
+#define QEMU_MIGRATION_TLS_H
+
+#include "io/channel.h"
+
+void migration_tls_channel_process_incoming(MigrationState *s,
+                                            QIOChannel *ioc,
+                                            Error **errp);
+
+void migration_tls_channel_connect(MigrationState *s,
+                                   QIOChannel *ioc,
+                                   const char *hostname,
+                                   Error **errp);
+#endif
Signature · 1 line
2.9.3
#31 lore raw

PATCH 24/41 migration: Export ram.c functions in its own file

In reply to Juan Quintela

All functions are internal except for ram_mig_init(). Create migration/misc.h for this kind of functions.

---
 include/migration/migration.h | 39 ------------------------------
 include/migration/misc.h      | 21 +++++++++++++++++
 migration/migration.c         |  1 +
 migration/postcopy-ram.c      |  1 +
 migration/ram.c               |  2 ++
 migration/ram.h               | 55 +++++++++++++++++++++++++++++++++++++++++++
 migration/rdma.c              |  2 +-
 migration/savevm.c            |  1 +
 vl.c                          |  1 +
 9 files changed, 83 insertions(+), 40 deletions(-)
 create mode 100644 include/migration/misc.h
 create mode 100644 migration/ram.h
include/migration/migration.h +0 -39
index 08867c6..38ba508 100644
@@ -202,38 +202,6 @@ bool migration_in_postcopy(void);
 bool migration_in_postcopy_after_devices(MigrationState *);
 MigrationState *migrate_get_current(void);
 
-void migrate_compress_threads_create(void);
-void migrate_compress_threads_join(void);
-void migrate_decompress_threads_create(void);
-void migrate_decompress_threads_join(void);
-uint64_t ram_bytes_remaining(void);
-uint64_t ram_bytes_transferred(void);
-uint64_t ram_bytes_total(void);
-uint64_t ram_dirty_sync_count(void);
-uint64_t ram_dirty_pages_rate(void);
-uint64_t ram_postcopy_requests(void);
-void free_xbzrle_decoded_buf(void);
-
-void acct_update_position(QEMUFile *f, size_t size, bool zero);
-
-uint64_t dup_mig_pages_transferred(void);
-uint64_t norm_mig_pages_transferred(void);
-uint64_t xbzrle_mig_bytes_transferred(void);
-uint64_t xbzrle_mig_pages_transferred(void);
-uint64_t xbzrle_mig_pages_overflow(void);
-uint64_t xbzrle_mig_pages_cache_miss(void);
-double xbzrle_mig_cache_miss_rate(void);
-
-void ram_handle_compressed(void *host, uint8_t ch, uint64_t size);
-void ram_debug_dump_bitmap(unsigned long *todump, bool expected,
-                           unsigned long pages);
-/* For outgoing discard bitmap */
-int ram_postcopy_send_discard_bitmap(MigrationState *ms);
-/* For incoming postcopy discard */
-int ram_discard_range(const char *block_name, uint64_t start, size_t length);
-int ram_postcopy_incoming_init(MigrationIncomingState *mis);
-void ram_postcopy_migrated_memory_release(MigrationState *ms);
-
 bool migrate_release_ram(void);
 bool migrate_postcopy_ram(void);
 bool migrate_zero_blocks(void);
@@ -244,8 +212,6 @@ int migrate_use_xbzrle(void);
 int64_t migrate_xbzrle_cache_size(void);
 bool migrate_colo_enabled(void);
 
-int64_t xbzrle_cache_resize(int64_t new_size);
-
 bool migrate_use_block_enabled(void);
 bool migrate_use_block_shared(void);
 
@@ -284,7 +250,6 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
                              ram_addr_t offset, size_t size,
                              uint64_t *bytes_sent);
 
-void ram_mig_init(void);
 void savevm_skip_section_footers(void);
 void register_global_state(void);
 void global_state_set_optional(void);
@@ -292,10 +257,6 @@ void savevm_skip_configuration(void);
 int global_state_store(void);
 void global_state_store_running(void);
 
-void migration_page_queue_free(void);
-int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len);
-uint64_t ram_pagesize_summary(void);
-
 PostcopyState postcopy_state_get(void);
 /* Set the state and return the old state */
 PostcopyState postcopy_state_set(PostcopyState new_state);
include/migration/misc.h new file +21 -0
new file mode 100644
index 0000000..0b37714
@@ -0,0 +1,21 @@
+/*
+ * QEMU migration miscellaneus exported functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef MIGRATION_MISC_H
+#define MIGRATION_MISC_H
+
+/* migration/ram.c */
+
+void ram_mig_init(void);
+
+#endif
migration/migration.c +1 -0
index 175e5c9..ef966ca 100644
@@ -21,6 +21,7 @@
 #include "exec.h"
 #include "fd.h"
 #include "socket.h"
+#include "ram.h"
 #include "migration/migration.h"
 #include "savevm.h"
 #include "qemu-file-channel.h"
migration/postcopy-ram.c +1 -0
index 07fbc25..3359224 100644
@@ -23,6 +23,7 @@
 #include "qemu-file.h"
 #include "savevm.h"
 #include "postcopy-ram.h"
+#include "ram.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/balloon.h"
 #include "qemu/error-report.h"
migration/ram.c +2 -0
index 36afa98..89637eb 100644
@@ -36,7 +36,9 @@
 #include "qemu/timer.h"
 #include "qemu/main-loop.h"
 #include "xbzrle.h"
+#include "ram.h"
 #include "migration/migration.h"
+#include "migration/misc.h"
 #include "qemu-file.h"
 #include "migration/vmstate.h"
 #include "postcopy-ram.h"
migration/ram.h new file +55 -0

55 lines not on this page · raw message

migration/rdma.c +1 -1
index 2fda7a5..96a90dd 100644
@@ -19,7 +19,7 @@
 #include "qemu/cutils.h"
 #include "migration/migration.h"
 #include "qemu-file.h"
-#include "exec/cpu-common.h"
+#include "ram.h"
 #include "qemu-file-channel.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
migration/savevm.c +1 -0
index d3e4d8e..a80bc83 100644
@@ -37,6 +37,7 @@
 #include "qemu/timer.h"
 #include "migration/migration.h"
 #include "migration/snapshot.h"
+#include "ram.h"
 #include "qemu-file-channel.h"
 #include "qemu-file.h"
 #include "savevm.h"
vl.c +1 -0
index 5b79f5b..17c0297 100644
@@ -87,6 +87,7 @@ int main(int argc, char **argv)
 #include "sysemu/blockdev.h"
 #include "hw/block/block.h"
 #include "migration/block.h"
+#include "migration/misc.h"
 #include "migration/snapshot.h"
 #include "sysemu/tpm.h"
 #include "sysemu/dma.h"
Signature · 1 line
2.9.3
#32 lore raw

PATCH 25/41 migration: Export rdma.c functions in its own file

In reply to Juan Quintela
---
 include/migration/migration.h |  4 ----
 migration/migration.c         |  1 +
 migration/rdma.c              |  1 +
 migration/rdma.h              | 22 ++++++++++++++++++++++
 4 files changed, 24 insertions(+), 4 deletions(-)
 create mode 100644 migration/rdma.h
include/migration/migration.h +0 -4
index 38ba508..9063c32 100644
@@ -180,10 +180,6 @@ void qemu_start_incoming_migration(const char *uri, Error **errp);
 
 uint64_t migrate_max_downtime(void);
 
-void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp);
-
-void rdma_start_incoming_migration(const char *host_port, Error **errp);
-
 void migrate_fd_error(MigrationState *s, const Error *error);
 
 void migrate_fd_connect(MigrationState *s);
migration/migration.c +1 -0
index ef966ca..394930d 100644
@@ -22,6 +22,7 @@
 #include "fd.h"
 #include "socket.h"
 #include "ram.h"
+#include "rdma.h"
 #include "migration/migration.h"
 #include "savevm.h"
 #include "qemu-file-channel.h"
migration/rdma.c +1 -0
index 96a90dd..f8fea9b 100644
@@ -17,6 +17,7 @@
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "qemu/cutils.h"
+#include "rdma.h"
 #include "migration/migration.h"
 #include "qemu-file.h"
 #include "ram.h"
migration/rdma.h new file +22 -0
new file mode 100644
index 0000000..d2cf481
@@ -0,0 +1,22 @@
+/*
+ * QEMU migration rdma functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_RDMA_H
+#define QEMU_MIGRATION_RDMA_H
+
+void rdma_start_outgoing_migration(void *opaque, const char *host_port,
+                                   Error **errp);
+
+void rdma_start_incoming_migration(const char *host_port, Error **errp);
+
+#endif
Signature · 1 line
2.9.3
#33 lore raw

Re: [Qemu-devel] [PATCH 25/41] migration: Export rdma.c functions in its own file

Quoted 66 lines · * Juan Quintela ([email protected]) wrote:
---
 include/migration/migration.h |  4 ----
 migration/migration.c         |  1 +
 migration/rdma.c              |  1 +
 migration/rdma.h              | 22 ++++++++++++++++++++++
 4 files changed, 24 insertions(+), 4 deletions(-)
 create mode 100644 migration/rdma.h
include/migration/migration.h +0 -4
index 38ba508..9063c32 100644
@@ -180,10 +180,6 @@ void qemu_start_incoming_migration(const char *uri, Error **errp);
 
 uint64_t migrate_max_downtime(void);
 
-void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp);
-
-void rdma_start_incoming_migration(const char *host_port, Error **errp);
-
 void migrate_fd_error(MigrationState *s, const Error *error);
 
 void migrate_fd_connect(MigrationState *s);
migration/migration.c +1 -0
index ef966ca..394930d 100644
@@ -22,6 +22,7 @@
 #include "fd.h"
 #include "socket.h"
 #include "ram.h"
+#include "rdma.h"
 #include "migration/migration.h"
 #include "savevm.h"
 #include "qemu-file-channel.h"
migration/rdma.c +1 -0
index 96a90dd..f8fea9b 100644
@@ -17,6 +17,7 @@
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "qemu/cutils.h"
+#include "rdma.h"
 #include "migration/migration.h"
 #include "qemu-file.h"
 #include "ram.h"
migration/rdma.h new file +12 -0
new file mode 100644
index 0000000..d2cf481
@@ -0,0 +1,22 @@
+/*
+ * QEMU migration rdma functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */

migration/rdma.h line 22

Quoted 10 lines
migration/rdma.h new file +10 -0
+
+#ifndef QEMU_MIGRATION_RDMA_H
+#define QEMU_MIGRATION_RDMA_H
+
+void rdma_start_outgoing_migration(void *opaque, const char *host_port,
+                                   Error **errp);
+
+void rdma_start_incoming_migration(const char *host_port, Error **errp);
+
+#endif

As said before, I still don't think there's any point in having each of these transports in their own header.

However, I think the other problem is the Authors is wrong, both of these lines come from 2da776db484 which is Michael Hines.

Dave

Quoted 3 lines
Signature · 1 line
2.9.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#34 lore raw

PATCH 26/41 migration: Move include/migration/block.h into migration/

In reply to Juan Quintela

All functions were internal, except blk_mig_init() that is exported in misc.h now.

---
 include/migration/misc.h                 | 4 ++++
 migration/block.c                        | 3 ++-
 {include/migration => migration}/block.h | 1 -
 migration/migration.c                    | 2 +-
 vl.c                                     | 1 -
 5 files changed, 7 insertions(+), 4 deletions(-)
 rename {include/migration => migration}/block.h (95%)
include/migration/misc.h +4 -0
index 0b37714..9e64c16 100644
@@ -18,4 +18,8 @@
 
 void ram_mig_init(void);
 
+/* migration/block.c */
+
+void blk_mig_init(void);
+
 #endif
migration/block.c +2 -1
index c26bdb2..d19dc15 100644
@@ -23,7 +23,8 @@
 #include "qemu/cutils.h"
 #include "qemu/queue.h"
 #include "qemu/timer.h"
-#include "migration/block.h"
+#include "block.h"
+#include "migration/misc.h"
 #include "migration/migration.h"
 #include "sysemu/blockdev.h"
 #include "qemu-file.h"
migration/block.h renamed from include/migration/block.h +0 -1
similarity index 95%
rename from include/migration/block.h
rename to migration/block.h
index 41a1ac8..9f6febb 100644
@@ -14,7 +14,6 @@
 #ifndef MIGRATION_BLOCK_H
 #define MIGRATION_BLOCK_H
 
-void blk_mig_init(void);
 int blk_mig_active(void);
 uint64_t blk_mig_bytes_transferred(void);
 uint64_t blk_mig_bytes_remaining(void);
migration/migration.c +1 -1
index 394930d..ff32086 100644
@@ -34,7 +34,7 @@
 #include "qapi/util.h"
 #include "qemu/sockets.h"
 #include "qemu/rcu.h"
-#include "migration/block.h"
+#include "block.h"
 #include "postcopy-ram.h"
 #include "qemu/thread.h"
 #include "qmp-commands.h"
vl.c +0 -1
index 17c0297..605c98f 100644
@@ -86,7 +86,6 @@ int main(int argc, char **argv)
 #include "qemu/log.h"
 #include "sysemu/blockdev.h"
 #include "hw/block/block.h"
-#include "migration/block.h"
 #include "migration/misc.h"
 #include "migration/snapshot.h"
 #include "sysemu/tpm.h"
Signature · 1 line
2.9.3
#35 lore raw

PATCH 27/41 migration: Move self_announce_delay() to misc.h

In reply to Juan Quintela
---
 hw/net/virtio-net.c         |  1 +
 include/migration/misc.h    | 10 ++++++++++
 include/migration/vmstate.h | 10 ----------
 migration/savevm.c          |  1 +
 4 files changed, 12 insertions(+), 10 deletions(-)
hw/net/virtio-net.c +1 -0
index 7d091c9..2259156 100644
@@ -25,6 +25,7 @@
 #include "qapi/qmp/qjson.h"
 #include "qapi-event.h"
 #include "hw/virtio/virtio-access.h"
+#include "migration/misc.h"
 
 #define VIRTIO_NET_VM_VERSION    11
 
include/migration/misc.h +10 -0
index 9e64c16..45ef9c9 100644
@@ -22,4 +22,14 @@ void ram_mig_init(void);
 
 void blk_mig_init(void);
 
+#define SELF_ANNOUNCE_ROUNDS 5
+
+static inline
+int64_t self_announce_delay(int round)
+{
+    assert(round < SELF_ANNOUNCE_ROUNDS && round > 0);
+    /* delay 50ms, 150ms, 250ms, ... */
+    return 50 + (SELF_ANNOUNCE_ROUNDS - round - 1) * 100;
+}
+
 #endif
include/migration/vmstate.h +0 -10
index e9f5bc8..655558d 100644
@@ -1000,8 +1000,6 @@ extern const VMStateInfo vmstate_info_qtailq;
 #define VMSTATE_END_OF_LIST()                                         \
     {}
 
-#define SELF_ANNOUNCE_ROUNDS 5
-
 void loadvm_free_handlers(MigrationIncomingState *mis);
 
 int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
@@ -1035,14 +1033,6 @@ 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);
 
-static inline
-int64_t self_announce_delay(int round)
-{
-    assert(round < SELF_ANNOUNCE_ROUNDS && round > 0);
-    /* delay 50ms, 150ms, 250ms, ... */
-    return 50 + (SELF_ANNOUNCE_ROUNDS - round - 1) * 100;
-}
-
 void dump_vmstate_json_to_file(FILE *out_fp);
 
 bool vmstate_device_is_migratable(const VMStateDescription *vmsd);
migration/savevm.c +1 -0
index a80bc83..6aeebb8 100644
@@ -37,6 +37,7 @@
 #include "qemu/timer.h"
 #include "migration/migration.h"
 #include "migration/snapshot.h"
+#include "migration/misc.h"
 #include "ram.h"
 #include "qemu-file-channel.h"
 #include "qemu-file.h"
Signature · 1 line
2.9.3
#36 lore raw

PATCH 28/41 migration: Split registration functions from vmstate.h

In reply to Juan Quintela

They are indpendent, and nowadays almost every device register things with qdev->vmsd.

---
 hw/net/vmxnet3.c             |  1 +
 hw/ppc/spapr.c               |  1 +
 hw/s390x/s390-skeys.c        |  1 +
 hw/s390x/s390-virtio-ccw.c   |  1 +
 include/migration/register.h | 64 ++++++++++++++++++++++++++++++++++++++++++++
 include/migration/vmstate.h  | 45 -------------------------------
 migration/block.c            |  1 +
 migration/ram.c              |  1 +
 migration/savevm.c           |  1 +
 slirp/slirp.c                |  1 +
 10 files changed, 72 insertions(+), 45 deletions(-)
 create mode 100644 include/migration/register.h
hw/net/vmxnet3.c +1 -0
index 8b1fab2..21ac646 100644
@@ -26,6 +26,7 @@
 #include "qemu/bswap.h"
 #include "hw/pci/msix.h"
 #include "hw/pci/msi.h"
+#include "migration/register.h"
 
 #include "vmxnet3.h"
 #include "vmxnet_debug.h"
hw/ppc/spapr.c +1 -0
index 35db949..4c4701e 100644
@@ -39,6 +39,7 @@
 #include "sysemu/hw_accel.h"
 #include "kvm_ppc.h"
 #include "migration/migration.h"
+#include "migration/register.h"
 #include "mmu-hash64.h"
 #include "qom/cpu.h"
 
hw/s390x/s390-skeys.c +1 -0
index 619152c..58f084a 100644
@@ -15,6 +15,7 @@
 #include "hw/s390x/storage-keys.h"
 #include "qemu/error-report.h"
 #include "sysemu/kvm.h"
+#include "migration/register.h"
 
 #define S390_SKEYS_BUFFER_SIZE 131072  /* Room for 128k storage keys */
 #define S390_SKEYS_SAVE_FLAG_EOS 0x01
hw/s390x/s390-virtio-ccw.c +1 -0
index 04bd0eb..22716e1 100644
@@ -28,6 +28,7 @@
 #include "ipl.h"
 #include "hw/s390x/s390-virtio-ccw.h"
 #include "hw/s390x/css-bridge.h"
+#include "migration/register.h"
 
 static const char *const reset_dev_types[] = {
     TYPE_VIRTUAL_CSS_BRIDGE,
include/migration/register.h new file +64 -0

64 lines not on this page · raw message

include/migration/vmstate.h +0 -45

53 lines not on this page · raw message

migration/block.c +1 -0
index d19dc15..307f136 100644
@@ -26,6 +26,7 @@
 #include "block.h"
 #include "migration/misc.h"
 #include "migration/migration.h"
+#include "migration/register.h"
 #include "sysemu/blockdev.h"
 #include "qemu-file.h"
 #include "migration/vmstate.h"
migration/ram.c +1 -0
index 89637eb..b6cef70 100644
@@ -38,6 +38,7 @@
 #include "xbzrle.h"
 #include "ram.h"
 #include "migration/migration.h"
+#include "migration/register.h"
 #include "migration/misc.h"
 #include "qemu-file.h"
 #include "migration/vmstate.h"
migration/savevm.c +1 -0
index 6aeebb8..1caf8ee 100644
@@ -38,6 +38,7 @@
 #include "migration/migration.h"
 #include "migration/snapshot.h"
 #include "migration/misc.h"
+#include "migration/register.h"
 #include "ram.h"
 #include "qemu-file-channel.h"
 #include "qemu-file.h"
slirp/slirp.c +1 -0
index 9a50918..8f59a26 100644
@@ -25,6 +25,7 @@
 #include "qemu-common.h"
 #include "qemu/timer.h"
 #include "qemu/error-report.h"
+#include "migration/register.h"
 #include "sysemu/char.h"
 #include "slirp.h"
 #include "hw/hw.h"
Signature · 1 line
2.9.3
#37 lore raw

PATCH 29/41 migration: loadvm_free_handlers is only used in migration/

In reply to Juan Quintela
---
 include/migration/vmstate.h | 2 --
 migration/savevm.h          | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)
include/migration/vmstate.h +0 -2
index 6b7031f..afa43ac 100644
@@ -955,8 +955,6 @@ extern const VMStateInfo vmstate_info_qtailq;
 #define VMSTATE_END_OF_LIST()                                         \
     {}
 
-void loadvm_free_handlers(MigrationIncomingState *mis);
-
 int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
                        void *opaque, int version_id);
 void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
migration/savevm.h +2 -0
index f4c4bc9..75b2b8c 100644
@@ -38,4 +38,6 @@ void qemu_savevm_send_postcopy_ram_discard(QEMUFile *f, const char *name,
 
 int qemu_loadvm_state(QEMUFile *f);
 
+void loadvm_free_handlers(MigrationIncomingState *mis);
+
 #endif
Signature · 1 line
2.9.3
#38 lore raw

PATCH 30/41 migration: Move dump_vmsate_json_to_file() to misc.h

In reply to Juan Quintela

It was not from vmstate.c to start with.

---
 include/migration/misc.h    | 4 ++++
 include/migration/vmstate.h | 2 --
 2 files changed, 4 insertions(+), 2 deletions(-)
include/migration/misc.h +4 -0
index 45ef9c9..21a9182 100644
@@ -32,4 +32,8 @@ int64_t self_announce_delay(int round)
     return 50 + (SELF_ANNOUNCE_ROUNDS - round - 1) * 100;
 }
 
+/* migration/savevm.c */
+
+void dump_vmstate_json_to_file(FILE *out_fp);
+
 #endif
include/migration/vmstate.h +0 -2
index afa43ac..5811804 100644
@@ -986,8 +986,6 @@ 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);
 
-void dump_vmstate_json_to_file(FILE *out_fp);
-
 bool vmstate_device_is_migratable(const VMStateDescription *vmsd);
 
 #endif
Signature · 1 line
2.9.3
#39 lore raw

PATCH 31/41 migration: Move postcopy stuff to postcopy-ram.c

In reply to Juan Quintela

Yes, we don't have a good place to put that stuff.

---
 include/migration/migration.h | 25 -------------------------
 migration/migration.c         | 18 ------------------
 migration/postcopy-ram.c      | 18 ++++++++++++++++++
 migration/postcopy-ram.h      | 26 ++++++++++++++++++++++++++
 4 files changed, 44 insertions(+), 43 deletions(-)
include/migration/migration.h +0 -25
index 9063c32..5c27fe7 100644
@@ -54,28 +54,6 @@ enum mig_rp_message_type {
 
 typedef QLIST_HEAD(, LoadStateEntry) LoadStateEntry_Head;
 
-/* The current postcopy state is read/set by postcopy_state_get/set
- * which update it atomically.
- * The state is updated as postcopy messages are received, and
- * in general only one thread should be writing to the state at any one
- * time, initially the main thread and then the listen thread;
- * Corner cases are where either thread finishes early and/or errors.
- * The state is checked as messages are received to ensure that
- * the source is sending us messages in the correct order.
- * The state is also used by the RAM reception code to know if it
- * has to place pages atomically, and the cleanup code at the end of
- * the main thread to know if it has to delay cleanup until the end
- * of postcopy.
- */
-typedef enum {
-    POSTCOPY_INCOMING_NONE = 0,  /* Initial state - no postcopy */
-    POSTCOPY_INCOMING_ADVISE,
-    POSTCOPY_INCOMING_DISCARD,
-    POSTCOPY_INCOMING_LISTENING,
-    POSTCOPY_INCOMING_RUNNING,
-    POSTCOPY_INCOMING_END
-} PostcopyState;
-
 /* State for the incoming migration */
 struct MigrationIncomingState {
     QEMUFile *from_src_file;
@@ -253,7 +231,4 @@ void savevm_skip_configuration(void);
 int global_state_store(void);
 void global_state_store_running(void);
 
-PostcopyState postcopy_state_get(void);
-/* Set the state and return the old state */
-PostcopyState postcopy_state_set(PostcopyState new_state);
 #endif
migration/migration.c +0 -18
index ff32086..d2f3c5e 100644
@@ -85,13 +85,6 @@ static NotifierList migration_state_notifiers =
 
 static bool deferred_incoming;
 
-/*
- * Current state of incoming postcopy; note this is not part of
- * MigrationIncomingState since it's state is used during cleanup
- * at the end as MIS is being freed.
- */
-static PostcopyState incoming_postcopy_state;
-
 /* When we add fault tolerance, we could have several
    migrations at once.  For now we don't need to add
    dynamic creation of migration */
@@ -2085,14 +2078,3 @@ void migrate_fd_connect(MigrationState *s)
     s->migration_thread_running = true;
 }
 
-PostcopyState  postcopy_state_get(void)
-{
-    return atomic_mb_read(&incoming_postcopy_state);
-}
-
-/* Set the state and return the old state */
-PostcopyState postcopy_state_set(PostcopyState new_state)
-{
-    return atomic_xchg(&incoming_postcopy_state, new_state);
-}
-
migration/postcopy-ram.c +18 -0
index 3359224..cae5d48 100644
@@ -787,3 +787,21 @@ void postcopy_discard_send_finish(MigrationState *ms, PostcopyDiscardState *pds)
 
     g_free(pds);
 }
+
+/*
+ * Current state of incoming postcopy; note this is not part of
+ * MigrationIncomingState since it's state is used during cleanup
+ * at the end as MIS is being freed.
+ */
+static PostcopyState incoming_postcopy_state;
+
+PostcopyState  postcopy_state_get(void)
+{
+    return atomic_mb_read(&incoming_postcopy_state);
+}
+
+/* Set the state and return the old state */
+PostcopyState postcopy_state_set(PostcopyState new_state)
+{
+    return atomic_xchg(&incoming_postcopy_state, new_state);
+}
migration/postcopy-ram.h +26 -0
index 4c25f03..52d51e8 100644
@@ -81,6 +81,28 @@ int postcopy_place_page(MigrationIncomingState *mis, void *host, void *from,
 int postcopy_place_page_zero(MigrationIncomingState *mis, void *host,
                              size_t pagesize);
 
+/* The current postcopy state is read/set by postcopy_state_get/set
+ * which update it atomically.
+ * The state is updated as postcopy messages are received, and
+ * in general only one thread should be writing to the state at any one
+ * time, initially the main thread and then the listen thread;
+ * Corner cases are where either thread finishes early and/or errors.
+ * The state is checked as messages are received to ensure that
+ * the source is sending us messages in the correct order.
+ * The state is also used by the RAM reception code to know if it
+ * has to place pages atomically, and the cleanup code at the end of
+ * the main thread to know if it has to delay cleanup until the end
+ * of postcopy.
+ */
+typedef enum {
+    POSTCOPY_INCOMING_NONE = 0,  /* Initial state - no postcopy */
+    POSTCOPY_INCOMING_ADVISE,
+    POSTCOPY_INCOMING_DISCARD,
+    POSTCOPY_INCOMING_LISTENING,
+    POSTCOPY_INCOMING_RUNNING,
+    POSTCOPY_INCOMING_END
+} PostcopyState;
+
 /*
  * Allocate a page of memory that can be mapped at a later point in time
  * using postcopy_place_page
@@ -88,4 +110,8 @@ int postcopy_place_page_zero(MigrationIncomingState *mis, void *host,
  */
 void *postcopy_get_tmp_page(MigrationIncomingState *mis);
 
+PostcopyState postcopy_state_get(void);
+/* Set the state and return the old state */
+PostcopyState postcopy_state_set(PostcopyState new_state);
+
 #endif
Signature · 1 line
2.9.3
Reviewed-by on v1 31/41
#40 lore raw

Re: [Qemu-devel] [PATCH 31/41] migration: Move postcopy stuff to postcopy-ram.c

Quoted 3 lines · * Juan Quintela ([email protected]) wrote:

Yes, we don't have a good place to put that stuff.

Quoted 152 lines
---
 include/migration/migration.h | 25 -------------------------
 migration/migration.c         | 18 ------------------
 migration/postcopy-ram.c      | 18 ++++++++++++++++++
 migration/postcopy-ram.h      | 26 ++++++++++++++++++++++++++
 4 files changed, 44 insertions(+), 43 deletions(-)
include/migration/migration.h +0 -25
index 9063c32..5c27fe7 100644
@@ -54,28 +54,6 @@ enum mig_rp_message_type {
 
 typedef QLIST_HEAD(, LoadStateEntry) LoadStateEntry_Head;
 
-/* The current postcopy state is read/set by postcopy_state_get/set
- * which update it atomically.
- * The state is updated as postcopy messages are received, and
- * in general only one thread should be writing to the state at any one
- * time, initially the main thread and then the listen thread;
- * Corner cases are where either thread finishes early and/or errors.
- * The state is checked as messages are received to ensure that
- * the source is sending us messages in the correct order.
- * The state is also used by the RAM reception code to know if it
- * has to place pages atomically, and the cleanup code at the end of
- * the main thread to know if it has to delay cleanup until the end
- * of postcopy.
- */
-typedef enum {
-    POSTCOPY_INCOMING_NONE = 0,  /* Initial state - no postcopy */
-    POSTCOPY_INCOMING_ADVISE,
-    POSTCOPY_INCOMING_DISCARD,
-    POSTCOPY_INCOMING_LISTENING,
-    POSTCOPY_INCOMING_RUNNING,
-    POSTCOPY_INCOMING_END
-} PostcopyState;
-
 /* State for the incoming migration */
 struct MigrationIncomingState {
     QEMUFile *from_src_file;
@@ -253,7 +231,4 @@ void savevm_skip_configuration(void);
 int global_state_store(void);
 void global_state_store_running(void);
 
-PostcopyState postcopy_state_get(void);
-/* Set the state and return the old state */
-PostcopyState postcopy_state_set(PostcopyState new_state);
 #endif
migration/migration.c +0 -18
index ff32086..d2f3c5e 100644
@@ -85,13 +85,6 @@ static NotifierList migration_state_notifiers =
 
 static bool deferred_incoming;
 
-/*
- * Current state of incoming postcopy; note this is not part of
- * MigrationIncomingState since it's state is used during cleanup
- * at the end as MIS is being freed.
- */
-static PostcopyState incoming_postcopy_state;
-
 /* When we add fault tolerance, we could have several
    migrations at once.  For now we don't need to add
    dynamic creation of migration */
@@ -2085,14 +2078,3 @@ void migrate_fd_connect(MigrationState *s)
     s->migration_thread_running = true;
 }
 
-PostcopyState  postcopy_state_get(void)
-{
-    return atomic_mb_read(&incoming_postcopy_state);
-}
-
-/* Set the state and return the old state */
-PostcopyState postcopy_state_set(PostcopyState new_state)
-{
-    return atomic_xchg(&incoming_postcopy_state, new_state);
-}
-
migration/postcopy-ram.c +18 -0
index 3359224..cae5d48 100644
@@ -787,3 +787,21 @@ void postcopy_discard_send_finish(MigrationState *ms, PostcopyDiscardState *pds)
 
     g_free(pds);
 }
+
+/*
+ * Current state of incoming postcopy; note this is not part of
+ * MigrationIncomingState since it's state is used during cleanup
+ * at the end as MIS is being freed.
+ */
+static PostcopyState incoming_postcopy_state;
+
+PostcopyState  postcopy_state_get(void)
+{
+    return atomic_mb_read(&incoming_postcopy_state);
+}
+
+/* Set the state and return the old state */
+PostcopyState postcopy_state_set(PostcopyState new_state)
+{
+    return atomic_xchg(&incoming_postcopy_state, new_state);
+}
migration/postcopy-ram.h +26 -0
index 4c25f03..52d51e8 100644
@@ -81,6 +81,28 @@ int postcopy_place_page(MigrationIncomingState *mis, void *host, void *from,
 int postcopy_place_page_zero(MigrationIncomingState *mis, void *host,
                              size_t pagesize);
 
+/* The current postcopy state is read/set by postcopy_state_get/set
+ * which update it atomically.
+ * The state is updated as postcopy messages are received, and
+ * in general only one thread should be writing to the state at any one
+ * time, initially the main thread and then the listen thread;
+ * Corner cases are where either thread finishes early and/or errors.
+ * The state is checked as messages are received to ensure that
+ * the source is sending us messages in the correct order.
+ * The state is also used by the RAM reception code to know if it
+ * has to place pages atomically, and the cleanup code at the end of
+ * the main thread to know if it has to delay cleanup until the end
+ * of postcopy.
+ */
+typedef enum {
+    POSTCOPY_INCOMING_NONE = 0,  /* Initial state - no postcopy */
+    POSTCOPY_INCOMING_ADVISE,
+    POSTCOPY_INCOMING_DISCARD,
+    POSTCOPY_INCOMING_LISTENING,
+    POSTCOPY_INCOMING_RUNNING,
+    POSTCOPY_INCOMING_END
+} PostcopyState;
+
 /*
  * Allocate a page of memory that can be mapped at a later point in time
  * using postcopy_place_page
@@ -88,4 +110,8 @@ int postcopy_place_page_zero(MigrationIncomingState *mis, void *host,
  */
 void *postcopy_get_tmp_page(MigrationIncomingState *mis);
 
+PostcopyState postcopy_state_get(void);
+/* Set the state and return the old state */
+PostcopyState postcopy_state_set(PostcopyState new_state);
+
 #endif
Signature · 1 line
2.9.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#41 lore raw

PATCH 32/41 migration: Move constants to savevm.h

In reply to Juan Quintela
---
 include/migration/migration.h | 15 ---------------
 migration/savevm.h            | 15 +++++++++++++++
 migration/vmstate.c           |  1 +
 tests/test-vmstate.c          |  1 +
 4 files changed, 17 insertions(+), 15 deletions(-)
include/migration/migration.h +0 -15
index 5c27fe7..ac6e545 100644
@@ -22,21 +22,6 @@
 #include "exec/cpu-common.h"
 #include "qemu/coroutine_int.h"
 
-#define QEMU_VM_FILE_MAGIC           0x5145564d
-#define QEMU_VM_FILE_VERSION_COMPAT  0x00000002
-#define QEMU_VM_FILE_VERSION         0x00000003
-
-#define QEMU_VM_EOF                  0x00
-#define QEMU_VM_SECTION_START        0x01
-#define QEMU_VM_SECTION_PART         0x02
-#define QEMU_VM_SECTION_END          0x03
-#define QEMU_VM_SECTION_FULL         0x04
-#define QEMU_VM_SUBSECTION           0x05
-#define QEMU_VM_VMDESCRIPTION        0x06
-#define QEMU_VM_CONFIGURATION        0x07
-#define QEMU_VM_COMMAND              0x08
-#define QEMU_VM_SECTION_FOOTER       0x7e
-
 /* for vl.c */
 extern int only_migratable;
 
migration/savevm.h +15 -0
index 75b2b8c..b4c1f3c 100644
@@ -14,6 +14,21 @@
 #ifndef MIGRATION_SAVEVM_H
 #define MIGRATION_SAVEVM_H
 
+#define QEMU_VM_FILE_MAGIC           0x5145564d
+#define QEMU_VM_FILE_VERSION_COMPAT  0x00000002
+#define QEMU_VM_FILE_VERSION         0x00000003
+
+#define QEMU_VM_EOF                  0x00
+#define QEMU_VM_SECTION_START        0x01
+#define QEMU_VM_SECTION_PART         0x02
+#define QEMU_VM_SECTION_END          0x03
+#define QEMU_VM_SECTION_FULL         0x04
+#define QEMU_VM_SUBSECTION           0x05
+#define QEMU_VM_VMDESCRIPTION        0x06
+#define QEMU_VM_CONFIGURATION        0x07
+#define QEMU_VM_COMMAND              0x08
+#define QEMU_VM_SECTION_FOOTER       0x7e
+
 bool qemu_savevm_state_blocked(Error **errp);
 void qemu_savevm_state_begin(QEMUFile *f);
 void qemu_savevm_state_header(QEMUFile *f);
migration/vmstate.c +1 -0
index 57dc34f..4b0cb2f 100644
@@ -29,6 +29,7 @@
 #include "qemu-common.h"
 #include "migration/migration.h"
 #include "migration/vmstate.h"
+#include "migration/savevm.h"
 #include "qemu-file.h"
 #include "qemu/bitops.h"
 #include "qemu/error-report.h"
tests/test-vmstate.c +1 -0
index c52aff9..f30433a 100644
@@ -30,6 +30,7 @@
 #include "migration/qemu-file-types.h"
 #include "../migration/qemu-file.h"
 #include "../migration/qemu-file-channel.h"
+#include "../migration/savevm.h"
 #include "qemu/coroutine.h"
 #include "io/channel-file.h"
 
Signature · 1 line
2.9.3
#42 lore raw

PATCH 33/41 migration: Commands are only used inside migration.c

In reply to Juan Quintela

So, move them there. Notice that we export functions that send commands, not the command themselves.

---
 include/migration/migration.h | 15 --------------
 migration/migration.c         | 46 +++++++++++++++++++++++++++----------------
 2 files changed, 29 insertions(+), 32 deletions(-)
include/migration/migration.h +0 -15
index ac6e545..9884be6 100644
@@ -25,18 +25,6 @@
 /* for vl.c */
 extern int only_migratable;
 
-/* Messages sent on the return path from destination to source */
-enum mig_rp_message_type {
-    MIG_RP_MSG_INVALID = 0,  /* Must be 0 */
-    MIG_RP_MSG_SHUT,         /* sibling will not send any more RP messages */
-    MIG_RP_MSG_PONG,         /* Response to a PING; data (seq: be32 ) */
-
-    MIG_RP_MSG_REQ_PAGES_ID, /* data (start: be64, len: be32, id: string) */
-    MIG_RP_MSG_REQ_PAGES,    /* data (start: be64, len: be32) */
-
-    MIG_RP_MSG_MAX
-};
-
 typedef QLIST_HEAD(, LoadStateEntry) LoadStateEntry_Head;
 
 /* State for the incoming migration */
@@ -181,9 +169,6 @@ int migrate_decompress_threads(void);
 bool migrate_use_events(void);
 
 /* Sending on the return path - generic and then for each message type */
-void migrate_send_rp_message(MigrationIncomingState *mis,
-                             enum mig_rp_message_type message_type,
-                             uint16_t len, void *data);
 void migrate_send_rp_shut(MigrationIncomingState *mis,
                           uint32_t value);
 void migrate_send_rp_pong(MigrationIncomingState *mis,
migration/migration.c +29 -17

64 lines not on this page · raw message

Signature · 1 line
2.9.3
#43 lore raw

PATCH 34/41 migration: ram_control_* are implemented in qemu_file

In reply to Juan Quintela
---
 include/migration/migration.h | 18 ------------------
 migration/qemu-file.h         | 17 +++++++++++++++++
 2 files changed, 17 insertions(+), 18 deletions(-)
include/migration/migration.h +0 -18
index 9884be6..7bd87f8 100644
@@ -176,24 +176,6 @@ void migrate_send_rp_pong(MigrationIncomingState *mis,
 void migrate_send_rp_req_pages(MigrationIncomingState *mis, const char* rbname,
                               ram_addr_t start, size_t len);
 
-void ram_control_before_iterate(QEMUFile *f, uint64_t flags);
-void ram_control_after_iterate(QEMUFile *f, uint64_t flags);
-void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data);
-
-/* Whenever this is found in the data stream, the flags
- * will be passed to ram_control_load_hook in the incoming-migration
- * side. This lets before_ram_iterate/after_ram_iterate add
- * transport-specific sections to the RAM migration data.
- */
-#define RAM_SAVE_FLAG_HOOK     0x80
-
-#define RAM_SAVE_CONTROL_NOT_SUPP -1000
-#define RAM_SAVE_CONTROL_DELAYED  -2000
-
-size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
-                             ram_addr_t offset, size_t size,
-                             uint64_t *bytes_sent);
-
 void savevm_skip_section_footers(void);
 void register_global_state(void);
 void global_state_set_optional(void);
migration/qemu-file.h +17 -0
index 49fd697..aae4e5e 100644
@@ -156,5 +156,22 @@ void qemu_file_set_blocking(QEMUFile *f, bool block);
 
 size_t qemu_get_counted_string(QEMUFile *f, char buf[256]);
 
+void ram_control_before_iterate(QEMUFile *f, uint64_t flags);
+void ram_control_after_iterate(QEMUFile *f, uint64_t flags);
+void ram_control_load_hook(QEMUFile *f, uint64_t flags, void *data);
+
+/* Whenever this is found in the data stream, the flags
+ * will be passed to ram_control_load_hook in the incoming-migration
+ * side. This lets before_ram_iterate/after_ram_iterate add
+ * transport-specific sections to the RAM migration data.
+ */
+#define RAM_SAVE_FLAG_HOOK     0x80
+
+#define RAM_SAVE_CONTROL_NOT_SUPP -1000
+#define RAM_SAVE_CONTROL_DELAYED  -2000
+
+size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
+                             ram_addr_t offset, size_t size,
+                             uint64_t *bytes_sent);
 
 #endif
Signature · 1 line
2.9.3
#44 lore raw

PATCH 35/41 migration: create global_state.c

In reply to Juan Quintela

It don't belong anywhere else, just the global state where everybody can stick other things.

---
 hw/i386/pc_piix.c                |   1 +
 hw/ppc/spapr.c                   |   1 +
 include/migration/global_state.h |  26 +++++++
 include/migration/migration.h    |   4 --
 migration/Makefile.objs          |   2 +-
 migration/global_state.c         | 143 +++++++++++++++++++++++++++++++++++++++
 migration/migration.c            | 121 +--------------------------------
 migration/savevm.c               |   1 +
 vl.c                             |   1 +
 xen-common.c                     |   1 +
 10 files changed, 176 insertions(+), 125 deletions(-)
 create mode 100644 include/migration/global_state.h
 create mode 100644 migration/global_state.c
hw/i386/pc_piix.c +1 -0
index 9f102aa..6c72bd3 100644
@@ -52,6 +52,7 @@
 #include <xen/hvm/hvm_info_table.h>
 #include "hw/xen/xen_pt.h"
 #endif
+#include "migration/global_state.h"
 #include "migration/migration.h"
 #include "kvm_i386.h"
 
hw/ppc/spapr.c +1 -0
index 4c4701e..f779c35 100644
@@ -39,6 +39,7 @@
 #include "sysemu/hw_accel.h"
 #include "kvm_ppc.h"
 #include "migration/migration.h"
+#include "migration/global_state.h"
 #include "migration/register.h"
 #include "mmu-hash64.h"
 #include "qom/cpu.h"
include/migration/global_state.h new file +26 -0
new file mode 100644
index 0000000..84a19d0
@@ -0,0 +1,26 @@
+/*
+ * QEMU live migration
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_GLOBAL_STATE_H
+#define QEMU_MIGRATION_GLOBAL_STATE_H
+
+#include "sysemu/sysemu.h"
+
+void register_global_state(void);
+void global_state_set_optional(void);
+int global_state_store(void);
+void global_state_store_running(void);
+bool global_state_received(void);
+RunState global_state_get_runstate(void);
+
+#endif
include/migration/migration.h +0 -4
index 7bd87f8..fc31f8e 100644
@@ -177,10 +177,6 @@ void migrate_send_rp_req_pages(MigrationIncomingState *mis, const char* rbname,
                               ram_addr_t start, size_t len);
 
 void savevm_skip_section_footers(void);
-void register_global_state(void);
-void global_state_set_optional(void);
 void savevm_skip_configuration(void);
-int global_state_store(void);
-void global_state_store_running(void);
 
 #endif
migration/Makefile.objs +1 -1
index 812b2ec..775e4ad 100644
@@ -2,7 +2,7 @@ common-obj-y += migration.o socket.o fd.o exec.o
 common-obj-y += tls.o channel.o
 common-obj-y += colo-comm.o colo.o colo-failover.o
 common-obj-y += vmstate.o vmstate-types.o page_cache.o
-common-obj-y += qemu-file.o
+common-obj-y += qemu-file.o global_state.o
 common-obj-y += qemu-file-channel.o
 common-obj-y += xbzrle.o postcopy-ram.o
 common-obj-y += qjson.o
migration/global_state.c new file +143 -0

143 lines not on this page · raw message

migration/migration.c +1 -120

133 lines not on this page · raw message

migration/savevm.c +1 -0
index 1caf8ee..e7c05f3 100644
@@ -39,6 +39,7 @@
 #include "migration/snapshot.h"
 #include "migration/misc.h"
 #include "migration/register.h"
+#include "migration/global_state.h"
 #include "ram.h"
 #include "qemu-file-channel.h"
 #include "qemu-file.h"
vl.c +1 -0
index 605c98f..c0796e4 100644
@@ -88,6 +88,7 @@ int main(int argc, char **argv)
 #include "hw/block/block.h"
 #include "migration/misc.h"
 #include "migration/snapshot.h"
+#include "migration/global_state.h"
 #include "sysemu/tpm.h"
 #include "sysemu/dma.h"
 #include "audio/audio.h"
xen-common.c +1 -0
index fd2c928..172131a 100644
@@ -14,6 +14,7 @@
 #include "sysemu/char.h"
 #include "sysemu/accel.h"
 #include "migration/migration.h"
+#include "migration/global_state.h"
 
 //#define DEBUG_XEN
 
Signature · 1 line
2.9.3
#45 lore raw

PATCH 36/41 migration: Move more exported functions to migration/misc.h

In reply to Juan Quintela
---
 hw/i386/pc_piix.c             | 2 +-
 hw/ppc/spapr.c                | 2 +-
 include/migration/migration.h | 6 ------
 include/migration/misc.h      | 6 ++++++
 migration/migration.c         | 1 +
 qdev-monitor.c                | 2 +-
 vl.c                          | 1 -
 xen-common.c                  | 2 +-
 8 files changed, 11 insertions(+), 11 deletions(-)
hw/i386/pc_piix.c +1 -1
index 6c72bd3..d68859e 100644
@@ -53,7 +53,7 @@
 #include "hw/xen/xen_pt.h"
 #endif
 #include "migration/global_state.h"
-#include "migration/migration.h"
+#include "migration/misc.h"
 #include "kvm_i386.h"
 
 #define MAX_IDE_BUS 2
hw/ppc/spapr.c +1 -1
index f779c35..74cea96 100644
@@ -38,7 +38,7 @@
 #include "sysemu/cpus.h"
 #include "sysemu/hw_accel.h"
 #include "kvm_ppc.h"
-#include "migration/migration.h"
+#include "migration/misc.h"
 #include "migration/global_state.h"
 #include "migration/register.h"
 #include "mmu-hash64.h"
include/migration/migration.h +0 -6
index fc31f8e..1e18b24 100644
@@ -127,8 +127,6 @@ void migrate_set_state(int *state, int old_state, int new_state);
 
 void migration_fd_process_incoming(QEMUFile *f);
 
-void qemu_start_incoming_migration(const char *uri, Error **errp);
-
 uint64_t migrate_max_downtime(void);
 
 void migrate_fd_error(MigrationState *s, const Error *error);
@@ -140,7 +138,6 @@ void remove_migration_state_change_notifier(Notifier *notify);
 MigrationState *migrate_init(void);
 bool migration_is_blocked(Error **errp);
 bool migration_in_setup(MigrationState *);
-bool migration_is_idle(void);
 bool migration_has_finished(MigrationState *);
 bool migration_has_failed(MigrationState *);
 /* True if outgoing migration has entered postcopy phase */
@@ -176,7 +173,4 @@ void migrate_send_rp_pong(MigrationIncomingState *mis,
 void migrate_send_rp_req_pages(MigrationIncomingState *mis, const char* rbname,
                               ram_addr_t start, size_t len);
 
-void savevm_skip_section_footers(void);
-void savevm_skip_configuration(void);
-
 #endif
include/migration/misc.h +6 -0
index 21a9182..6709b15 100644
@@ -35,5 +35,11 @@ int64_t self_announce_delay(int round)
 /* migration/savevm.c */
 
 void dump_vmstate_json_to_file(FILE *out_fp);
+void savevm_skip_section_footers(void);
+void savevm_skip_configuration(void);
+
+/* migration/migration.c */
+void qemu_start_incoming_migration(const char *uri, Error **errp);
+bool migration_is_idle(void);
 
 #endif
migration/migration.c +1 -0
index 4cda97c..287b762 100644
@@ -24,6 +24,7 @@
 #include "ram.h"
 #include "rdma.h"
 #include "migration/global_state.h"
+#include "migration/misc.h"
 #include "migration/migration.h"
 #include "savevm.h"
 #include "qemu-file-channel.h"
qdev-monitor.c +1 -1
index e61d596..5ab468f 100644
@@ -29,7 +29,7 @@
 #include "qemu/error-report.h"
 #include "qemu/help_option.h"
 #include "sysemu/block-backend.h"
-#include "migration/migration.h"
+#include "migration/misc.h"
 
 /*
  * Aliases were a bad idea from the start.  Let's keep them
vl.c +0 -1
index c0796e4..d506c7e 100644
@@ -92,7 +92,6 @@ int main(int argc, char **argv)
 #include "sysemu/tpm.h"
 #include "sysemu/dma.h"
 #include "audio/audio.h"
-#include "migration/migration.h"
 #include "sysemu/cpus.h"
 #include "migration/colo.h"
 #include "sysemu/kvm.h"
xen-common.c +1 -1
index 172131a..2daf2aa 100644
@@ -13,7 +13,7 @@
 #include "qmp-commands.h"
 #include "sysemu/char.h"
 #include "sysemu/accel.h"
-#include "migration/migration.h"
+#include "migration/misc.h"
 #include "migration/global_state.h"
 
 //#define DEBUG_XEN
Signature · 1 line
2.9.3
#46 lore raw

PATCH 37/41 migration: Move last funtions to misc.h

In reply to Juan Quintela

After this, nothing outside of migration uses migration.h

---
 include/migration/migration.h | 7 -------
 include/migration/misc.h      | 8 +++++++-
 ui/spice-core.c               | 2 +-
 3 files changed, 8 insertions(+), 9 deletions(-)
include/migration/migration.h +0 -7
index 1e18b24..735f565 100644
@@ -133,17 +133,10 @@ void migrate_fd_error(MigrationState *s, const Error *error);
 
 void migrate_fd_connect(MigrationState *s);
 
-void add_migration_state_change_notifier(Notifier *notify);
-void remove_migration_state_change_notifier(Notifier *notify);
 MigrationState *migrate_init(void);
 bool migration_is_blocked(Error **errp);
-bool migration_in_setup(MigrationState *);
-bool migration_has_finished(MigrationState *);
-bool migration_has_failed(MigrationState *);
 /* True if outgoing migration has entered postcopy phase */
 bool migration_in_postcopy(void);
-/* ...and after the device transmission */
-bool migration_in_postcopy_after_devices(MigrationState *);
 MigrationState *migrate_get_current(void);
 
 bool migrate_release_ram(void);
include/migration/misc.h +7 -1
index 6709b15..28f69be 100644
@@ -41,5 +41,11 @@ void savevm_skip_configuration(void);
 /* migration/migration.c */
 void qemu_start_incoming_migration(const char *uri, Error **errp);
 bool migration_is_idle(void);
-
+void add_migration_state_change_notifier(Notifier *notify);
+void remove_migration_state_change_notifier(Notifier *notify);
+bool migration_in_setup(MigrationState *);
+bool migration_has_finished(MigrationState *);
+bool migration_has_failed(MigrationState *);
+/* ...and after the device transmission */
+bool migration_in_postcopy_after_devices(MigrationState *);
 #endif
ui/spice-core.c +1 -1
index 804abc5..a087ad5 100644
@@ -35,7 +35,7 @@
 #include "qapi/qmp/qstring.h"
 #include "qapi/qmp/qjson.h"
 #include "qemu/notify.h"
-#include "migration/migration.h"
+#include "migration/misc.h"
 #include "hw/hw.h"
 #include "ui/spice-display.h"
 #include "qapi-event.h"
Signature · 1 line
2.9.3
#47 lore raw

PATCH 38/41 migration: Move migration.h to migration/

In reply to Juan Quintela

Nothing uses it outside of migration.h

---
 migration/block.c                            | 2 +-
 migration/channel.c                          | 2 +-
 migration/colo-comm.c                        | 2 +-
 migration/colo.c                             | 2 +-
 migration/exec.c                             | 2 +-
 migration/fd.c                               | 2 +-
 migration/migration.c                        | 2 +-
 {include/migration => migration}/migration.h | 0
 migration/postcopy-ram.c                     | 2 +-
 migration/qemu-file.c                        | 2 +-
 migration/ram.c                              | 2 +-
 migration/rdma.c                             | 2 +-
 migration/savevm.c                           | 2 +-
 migration/socket.c                           | 2 +-
 migration/tls.c                              | 2 +-
 migration/vmstate-types.c                    | 2 +-
 migration/vmstate.c                          | 2 +-
 tests/test-vmstate.c                         | 2 +-
 18 files changed, 17 insertions(+), 17 deletions(-)
 rename {include/migration => migration}/migration.h (100%)
migration/block.c +1 -1
index 307f136..6457f25 100644
@@ -25,7 +25,7 @@
 #include "qemu/timer.h"
 #include "block.h"
 #include "migration/misc.h"
-#include "migration/migration.h"
+#include "migration.h"
 #include "migration/register.h"
 #include "sysemu/blockdev.h"
 #include "qemu-file.h"
migration/channel.c +1 -1
index 5a81a60..633423c 100644
@@ -16,7 +16,7 @@
 #include "qemu/osdep.h"
 #include "channel.h"
 #include "tls.h"
-#include "migration/migration.h"
+#include "migration.h"
 #include "qemu-file-channel.h"
 #include "trace.h"
 #include "qapi/error.h"
migration/colo-comm.c +1 -1
index b4288b8..1acdb94 100644
@@ -12,7 +12,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "migration/migration.h"
+#include "migration.h"
 #include "migration/vmstate.h"
 #include "colo.h"
 #include "trace.h"
migration/colo.c +1 -1
index 3757ad9..72001a5 100644
@@ -14,7 +14,7 @@
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
 #include "qemu-file-channel.h"
-#include "migration/migration.h"
+#include "migration.h"
 #include "qemu-file.h"
 #include "migration/savevm.h"
 #include "migration/colo.h"
migration/exec.c +1 -1
index c532c56..074943a 100644
@@ -22,7 +22,7 @@
 #include "qemu-common.h"
 #include "channel.h"
 #include "exec.h"
-#include "migration/migration.h"
+#include "migration.h"
 #include "io/channel-command.h"
 #include "trace.h"
 
migration/fd.c +1 -1
index 8a04dcd..b2384bf 100644
@@ -19,7 +19,7 @@
 #include "qemu-common.h"
 #include "channel.h"
 #include "fd.h"
-#include "migration/migration.h"
+#include "migration.h"
 #include "monitor/monitor.h"
 #include "io/channel-util.h"
 #include "trace.h"
migration/migration.c +1 -1
index 287b762..fccd779 100644
@@ -25,7 +25,7 @@
 #include "rdma.h"
 #include "migration/global_state.h"
 #include "migration/misc.h"
-#include "migration/migration.h"
+#include "migration.h"
 #include "savevm.h"
 #include "qemu-file-channel.h"
 #include "qemu-file.h"
migration/migration.h renamed from include/migration/migration.h +0 -0
similarity index 100%
rename from include/migration/migration.h
rename to migration/migration.h
migration/postcopy-ram.c +1 -1
index cae5d48..bd23971 100644
@@ -19,7 +19,7 @@
 #include "qemu/osdep.h"
 
 #include "qemu-common.h"
-#include "migration/migration.h"
+#include "migration.h"
 #include "qemu-file.h"
 #include "savevm.h"
 #include "postcopy-ram.h"
migration/qemu-file.c +1 -1
index ab26f4e..e65c373 100644
@@ -28,7 +28,7 @@
 #include "qemu/iov.h"
 #include "qemu/sockets.h"
 #include "qemu/coroutine.h"
-#include "migration/migration.h"
+#include "migration.h"
 #include "qemu-file.h"
 #include "trace.h"
 
migration/ram.c +1 -1
index b6cef70..14104f1 100644
@@ -37,7 +37,7 @@
 #include "qemu/main-loop.h"
 #include "xbzrle.h"
 #include "ram.h"
-#include "migration/migration.h"
+#include "migration.h"
 #include "migration/register.h"
 #include "migration/misc.h"
 #include "qemu-file.h"
migration/rdma.c +1 -1
index f8fea9b..1d91266 100644
@@ -18,7 +18,7 @@
 #include "qemu-common.h"
 #include "qemu/cutils.h"
 #include "rdma.h"
-#include "migration/migration.h"
+#include "migration.h"
 #include "qemu-file.h"
 #include "ram.h"
 #include "qemu-file-channel.h"
migration/savevm.c +1 -1
index e7c05f3..03ff007 100644
@@ -35,7 +35,7 @@
 #include "net/net.h"
 #include "sysemu/sysemu.h"
 #include "qemu/timer.h"
-#include "migration/migration.h"
+#include "migration.h"
 #include "migration/snapshot.h"
 #include "migration/misc.h"
 #include "migration/register.h"
migration/socket.c +1 -1
index acb3f0d..cc3d977 100644
@@ -21,7 +21,7 @@
 #include "qapi/error.h"
 #include "channel.h"
 #include "socket.h"
-#include "migration/migration.h"
+#include "migration.h"
 #include "qemu-file.h"
 #include "io/channel-socket.h"
 #include "trace.h"
migration/tls.c +1 -1
index d3abd6e..596e879 100644
@@ -20,7 +20,7 @@
 
 #include "qemu/osdep.h"
 #include "channel.h"
-#include "migration/migration.h"
+#include "migration.h"
 #include "tls.h"
 #include "io/channel-tls.h"
 #include "crypto/tlscreds.h"
migration/vmstate-types.c +1 -1
index c2bd334..0c92b23 100644
@@ -29,7 +29,7 @@
 #include "qemu-common.h"
 #include "exec/cpu-common.h"
 #include "qemu-file.h"
-#include "migration/migration.h"
+#include "migration.h"
 #include "migration/vmstate.h"
 #include "qemu/error-report.h"
 #include "qemu/queue.h"
migration/vmstate.c +1 -1
index 4b0cb2f..ec9d0f89 100644
@@ -27,7 +27,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu-common.h"
-#include "migration/migration.h"
+#include "migration.h"
 #include "migration/vmstate.h"
 #include "migration/savevm.h"
 #include "qemu-file.h"
tests/test-vmstate.c +1 -1
index f30433a..ee292c7 100644
@@ -25,7 +25,7 @@
 #include "qemu/osdep.h"
 
 #include "qemu-common.h"
-#include "migration/migration.h"
+#include "../migration/migration.h"
 #include "migration/vmstate.h"
 #include "migration/qemu-file-types.h"
 #include "../migration/qemu-file.h"
Signature · 1 line
2.9.3
#48 lore raw

PATCH 39/41 exec: Create include for target_page_size()

In reply to Juan Quintela

That is the only function that we need from exec.c, and having to include the whole sysemu.h for this.

---
 exec.c                     |  1 +
 include/exec/target_page.h | 20 ++++++++++++++++++++
 include/sysemu/sysemu.h    |  1 -
 migration/migration.c      |  1 +
 migration/postcopy-ram.c   |  1 +
 migration/savevm.c         |  1 +
 6 files changed, 24 insertions(+), 1 deletion(-)
 create mode 100644 include/exec/target_page.h
exec.c +1 -0
index eac6085..e9a201a 100644
@@ -24,6 +24,7 @@
 #include "qemu/cutils.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
+#include "exec/target_page.h"
 #include "tcg.h"
 #include "hw/qdev-core.h"
 #if !defined(CONFIG_USER_ONLY)
include/exec/target_page.h new file +20 -0
new file mode 100644
index 0000000..0961591
@@ -0,0 +1,20 @@
+
+ /*
+ * QEMU exec target page sizes
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef EXEC_TARGET_PAGE_H
+#define EXEC_TARGET_PAGE_H
+
+size_t qemu_target_page_size(void);
+
+#endif
include/sysemu/sysemu.h +0 -1
index 503b51f..5970ca4 100644
@@ -67,7 +67,6 @@ int qemu_reset_requested_get(void);
 void qemu_system_killed(int signal, pid_t pid);
 void qemu_system_reset(bool report);
 void qemu_system_guest_panicked(GuestPanicInformation *info);
-size_t qemu_target_page_size(void);
 
 void qemu_add_exit_notifier(Notifier *notify);
 void qemu_remove_exit_notifier(Notifier *notify);
migration/migration.c +1 -0
index fccd779..38740b4 100644
@@ -45,6 +45,7 @@
 #include "qom/cpu.h"
 #include "exec/memory.h"
 #include "exec/address-spaces.h"
+#include "exec/target_page.h"
 #include "io/channel-buffer.h"
 #include "colo.h"
 
migration/postcopy-ram.c +1 -0
index bd23971..88e1646 100644
@@ -19,6 +19,7 @@
 #include "qemu/osdep.h"
 
 #include "qemu-common.h"
+#include "exec/target_page.h"
 #include "migration.h"
 #include "qemu-file.h"
 #include "savevm.h"
migration/savevm.c +1 -0
index 03ff007..6a47dcd 100644
@@ -50,6 +50,7 @@
 #include "qemu/queue.h"
 #include "sysemu/cpus.h"
 #include "exec/memory.h"
+#include "exec/target_page.h"
 #include "qmp-commands.h"
 #include "trace.h"
 #include "qemu/bitops.h"
Signature · 1 line
2.9.3
#49 lore raw

PATCH 40/41 migration: Make savevm.c target independent

In reply to Juan Quintela

It only needed TARGET_PAGE_SIZE/BITS/BITS_MIN values, so just export them from exec.h

---
 Makefile.target            |  2 +-
 exec.c                     |  9 +++++++++
 include/exec/target_page.h |  2 ++
 migration/Makefile.objs    |  2 +-
 migration/savevm.c         | 14 +++++++-------
 5 files changed, 20 insertions(+), 9 deletions(-)
Makefile.target +1 -1
index e62021d..4020b01 100644
@@ -146,7 +146,7 @@ obj-$(CONFIG_KVM) += kvm-all.o
 obj-y += memory.o cputlb.o
 obj-y += memory_mapping.o
 obj-y += dump.o
-obj-y += migration/ram.o migration/savevm.o
+obj-y += migration/ram.o
 LIBS := $(libs_softmmu) $(LIBS)
 
 # xen support
exec.c +9 -0
index e9a201a..447ac63 100644
@@ -3387,6 +3387,15 @@ size_t qemu_target_page_size(void)
     return TARGET_PAGE_SIZE;
 }
 
+int qemu_target_page_bits(void)
+{
+    return TARGET_PAGE_BITS;
+}
+
+int qemu_target_page_bits_min(void)
+{
+    return TARGET_PAGE_BITS_MIN;
+}
 #endif
 
 /*
include/exec/target_page.h +2 -0
index 0961591..e3a19cc 100644
@@ -16,5 +16,7 @@
 #define EXEC_TARGET_PAGE_H
 
 size_t qemu_target_page_size(void);
+int qemu_target_page_bits(void);
+int qemu_target_page_bits_min(void);
 
 #endif
migration/Makefile.objs +1 -1
index 775e4ad..4277c88 100644
@@ -1,5 +1,5 @@
 common-obj-y += migration.o socket.o fd.o exec.o
-common-obj-y += tls.o channel.o
+common-obj-y += tls.o channel.o savevm.o
 common-obj-y += colo-comm.o colo.o colo-failover.o
 common-obj-y += vmstate.o vmstate-types.o page_cache.o
 common-obj-y += qemu-file.o global_state.o
migration/savevm.c +7 -7
index 6a47dcd..2e5f6a4 100644
@@ -27,7 +27,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "cpu.h"
 #include "hw/boards.h"
 #include "hw/hw.h"
 #include "hw/qdev.h"
@@ -315,7 +314,7 @@ static void configuration_pre_save(void *opaque)
 
     state->len = strlen(current_name);
     state->name = current_name;
-    state->target_page_bits = TARGET_PAGE_BITS;
+    state->target_page_bits = qemu_target_page_bits();
 }
 
 static int configuration_pre_load(void *opaque)
@@ -326,7 +325,7 @@ static int configuration_pre_load(void *opaque)
      * predates the variable-target-page-bits support and is using the
      * minimum possible value for this CPU.
      */
-    state->target_page_bits = TARGET_PAGE_BITS_MIN;
+    state->target_page_bits = qemu_target_page_bits_min();
     return 0;
 }
 
@@ -341,9 +340,9 @@ static int configuration_post_load(void *opaque, int version_id)
         return -EINVAL;
     }
 
-    if (state->target_page_bits != TARGET_PAGE_BITS) {
+    if (state->target_page_bits != qemu_target_page_bits()) {
         error_report("Received TARGET_PAGE_BITS is %d but local is %d",
-                     state->target_page_bits, TARGET_PAGE_BITS);
+                     state->target_page_bits, qemu_target_page_bits());
         return -EINVAL;
     }
 
@@ -359,7 +358,8 @@ static int configuration_post_load(void *opaque, int version_id)
  */
 static bool vmstate_target_page_bits_needed(void *opaque)
 {
-    return TARGET_PAGE_BITS > TARGET_PAGE_BITS_MIN;
+    return qemu_target_page_bits()
+        > qemu_target_page_bits_min();
 }
 
 static const VMStateDescription vmstate_target_page_bits = {
@@ -1165,7 +1165,7 @@ void qemu_savevm_state_complete_precopy(QEMUFile *f, bool iterable_only)
     }
 
     vmdesc = qjson_new();
-    json_prop_int(vmdesc, "page_size", TARGET_PAGE_SIZE);
+    json_prop_int(vmdesc, "page_size", qemu_target_page_size());
     json_start_array(vmdesc, "devices");
     QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
 
Signature · 1 line
2.9.3
#50 lore raw

PATCH 41/41 migration: Remove unneeded includes

In reply to Juan Quintela
---
 include/migration/misc.h  | 2 ++
 migration/block.c         | 6 ------
 migration/colo-failover.c | 2 ++
 migration/colo.c          | 2 --
 migration/colo.h          | 3 ---
 migration/exec.c          | 2 --
 migration/fd.c            | 2 --
 migration/global_state.c  | 1 -
 migration/migration.c     | 6 ------
 migration/migration.h     | 2 --
 migration/postcopy-ram.c  | 4 +---
 migration/qemu-file.c     | 2 --
 migration/ram.c           | 4 ----
 migration/savevm.c        | 6 ------
 14 files changed, 5 insertions(+), 39 deletions(-)
include/migration/misc.h +2 -0
index 28f69be..5c62e92 100644
@@ -14,6 +14,8 @@
 #ifndef MIGRATION_MISC_H
 #define MIGRATION_MISC_H
 
+#include "qemu/notify.h"
+
 /* migration/ram.c */
 
 void ram_mig_init(void);
migration/block.c +0 -6
index 6457f25..5c89436 100644
@@ -15,19 +15,13 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
-#include "block/block.h"
 #include "qemu/error-report.h"
-#include "qemu/main-loop.h"
-#include "hw/hw.h"
 #include "qemu/cutils.h"
 #include "qemu/queue.h"
-#include "qemu/timer.h"
 #include "block.h"
 #include "migration/misc.h"
 #include "migration.h"
 #include "migration/register.h"
-#include "sysemu/blockdev.h"
 #include "qemu-file.h"
 #include "migration/vmstate.h"
 #include "sysemu/block-backend.h"
migration/colo-failover.c +2 -0
index 85c4526..9f2fb71 100644
@@ -11,7 +11,9 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/main-loop.h"
 #include "colo.h"
+#include "migration.h"
 #include "colo-failover.h"
 #include "qmp-commands.h"
 #include "qapi/qmp/qerror.h"
migration/colo.c +0 -2
index 72001a5..4f41d2a 100644
@@ -11,7 +11,6 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu/timer.h"
 #include "sysemu/sysemu.h"
 #include "qemu-file-channel.h"
 #include "migration.h"
@@ -21,7 +20,6 @@
 #include "io/channel-buffer.h"
 #include "trace.h"
 #include "qemu/error-report.h"
-#include "qapi/error.h"
 #include "colo-failover.h"
 #include "replication.h"
 #include "qmp-commands.h"
migration/colo.h +0 -3
index ba0bb6e..be6beba 100644
@@ -14,9 +14,6 @@
 #define QEMU_COLO_H
 
 #include "qemu-common.h"
-#include "qemu/coroutine_int.h"
-#include "qemu/thread.h"
-#include "qemu/main-loop.h"
 
 bool colo_supported(void);
 void colo_info_init(void);
migration/exec.c +0 -2
index 074943a..6d535dc 100644
@@ -19,10 +19,8 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
 #include "channel.h"
 #include "exec.h"
-#include "migration.h"
 #include "io/channel-command.h"
 #include "trace.h"
 
migration/fd.c +0 -2
index b2384bf..30f5258 100644
@@ -16,10 +16,8 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
 #include "channel.h"
 #include "fd.h"
-#include "migration.h"
 #include "monitor/monitor.h"
 #include "io/channel-util.h"
 #include "trace.h"
migration/global_state.c +0 -1
index 3d67ba2..bf82aa7 100644
@@ -20,7 +20,6 @@
 #include "qapi/util.h"
 #include "migration/global_state.h"
 #include "migration/vmstate.h"
-#include "sysemu/sysemu.h"
 #include "trace.h"
 
 typedef struct {
migration/migration.c +0 -6
index 38740b4..83caa58 100644
@@ -16,7 +16,6 @@
 #include "qemu/osdep.h"
 #include "qemu/cutils.h"
 #include "qemu/error-report.h"
-#include "qemu/main-loop.h"
 #include "migration/blocker.h"
 #include "exec.h"
 #include "fd.h"
@@ -30,11 +29,9 @@
 #include "qemu-file-channel.h"
 #include "qemu-file.h"
 #include "migration/vmstate.h"
-#include "sysemu/sysemu.h"
 #include "block/block.h"
 #include "qapi/qmp/qerror.h"
 #include "qapi/util.h"
-#include "qemu/sockets.h"
 #include "qemu/rcu.h"
 #include "block.h"
 #include "postcopy-ram.h"
@@ -42,9 +39,6 @@
 #include "qmp-commands.h"
 #include "trace.h"
 #include "qapi-event.h"
-#include "qom/cpu.h"
-#include "exec/memory.h"
-#include "exec/address-spaces.h"
 #include "exec/target_page.h"
 #include "io/channel-buffer.h"
 #include "colo.h"
migration/migration.h +0 -2
index 735f565..f6bac81 100644
@@ -14,10 +14,8 @@
 #ifndef QEMU_MIGRATION_H
 #define QEMU_MIGRATION_H
 
-#include "qapi/qmp/qdict.h"
 #include "qemu-common.h"
 #include "qemu/thread.h"
-#include "qemu/notify.h"
 #include "qapi-types.h"
 #include "exec/cpu-common.h"
 #include "qemu/coroutine_int.h"
migration/postcopy-ram.c +1 -3
index 88e1646..e9a0b5c 100644
@@ -17,14 +17,12 @@
  */
 
 #include "qemu/osdep.h"
-
-#include "qemu-common.h"
 #include "exec/target_page.h"
 #include "migration.h"
 #include "qemu-file.h"
-#include "savevm.h"
 #include "postcopy-ram.h"
 #include "ram.h"
+#include "savevm.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/balloon.h"
 #include "qemu/error-report.h"
migration/qemu-file.c +0 -2
index e65c373..2ab2bf3 100644
@@ -26,8 +26,6 @@
 #include "qemu-common.h"
 #include "qemu/error-report.h"
 #include "qemu/iov.h"
-#include "qemu/sockets.h"
-#include "qemu/coroutine.h"
 #include "migration.h"
 #include "qemu-file.h"
 #include "trace.h"
migration/ram.c +0 -4
index 14104f1..1d69f64 100644
@@ -26,14 +26,12 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "qemu-common.h"
 #include "cpu.h"
 #include <zlib.h>
 #include "qapi-event.h"
 #include "qemu/cutils.h"
 #include "qemu/bitops.h"
 #include "qemu/bitmap.h"
-#include "qemu/timer.h"
 #include "qemu/main-loop.h"
 #include "xbzrle.h"
 #include "ram.h"
@@ -41,9 +39,7 @@
 #include "migration/register.h"
 #include "migration/misc.h"
 #include "qemu-file.h"
-#include "migration/vmstate.h"
 #include "postcopy-ram.h"
-#include "exec/address-spaces.h"
 #include "migration/page_cache.h"
 #include "qemu/error-report.h"
 #include "trace.h"
migration/savevm.c +0 -6
index 2e5f6a4..a84883f 100644
@@ -28,12 +28,8 @@
 
 #include "qemu/osdep.h"
 #include "hw/boards.h"
-#include "hw/hw.h"
-#include "hw/qdev.h"
 #include "hw/xen/xen.h"
 #include "net/net.h"
-#include "sysemu/sysemu.h"
-#include "qemu/timer.h"
 #include "migration.h"
 #include "migration/snapshot.h"
 #include "migration/misc.h"
@@ -46,13 +42,11 @@
 #include "postcopy-ram.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
-#include "qemu/queue.h"
 #include "sysemu/cpus.h"
 #include "exec/memory.h"
 #include "exec/target_page.h"
 #include "qmp-commands.h"
 #include "trace.h"
-#include "qemu/bitops.h"
 #include "qemu/iov.h"
 #include "block/snapshot.h"
 #include "qemu/cutils.h"
Signature · 1 line
2.9.3
#51 lore raw
In reply to Juan Quintela

* Juan Quintela ([email protected]) wrote:

High level question:
A lot of this is splitting migration.h which is a GPLv2 licensed file, and you're
carefully copying the authorship (Anthony) to each new header file and also the license. Can we fix the license while we're at it?
The migration.c has the clause saying contributions after 2012-01-13 are GPL2 or later but we don't seem to have it in the header.

I suggest for any case where you split it out to a new header and all the contributions in that header are from one easily contactable person, that you ask.

Dave

Quoted 237 lines

In this second version:
- Move inclnude files to migration/ instead of include/migration/
- Split misc patches to other series
- Split MigrationParams to other series
- Split HMP commands to other series
- Make migration.h private
- Create include/migration/misc.h for functions that don't belong anywhere else
- Create include/migration/register.h for functions that register new vmsdescriptions
- Create global_state.c for that VMState Description
- Make savevm.c target indepedent
- Exported functions reorganization to minimize the number of changes
- Remove migration stuff from sysemu/sysemu.h (Why was it there in the 1st place.)
- Split vmstate-types.c from vmstate.c (now there is only the interpreter there).

ToDo:
- RAMBlocks are defined in ram_addr_t, which includes ramlists.h Clearly we should be able to have a better organization here, but it is eluding me.
- Lots of files include sysemu/sysemu.h because runstate_* functions are there, I think they deserve their own file.
- Split qmp commands from migration.c
- Reorganize savevm.c and migration.c to have less dependencies between them.

Please, comment.

[v1]
This is a cleanup on top of my previous series. It does:
- create one .h file for each migration/* file
- export with meaningful include names the migration functions that we export
- untangle the includes mess (migration.h in8cluded vmstate.h who included qemu-file.h). Fixed all callers.
- once there, old MigrationParams are gone. Now block migration can be configured with migration capabilities like everything else in migration (old command line parameters are maintained, but on top of this)
- start moving hmp* functions to monitor.c

ToDo:
- move the two remaining hmp commands to monitor.c

really I should move them to block/* something, because they all use block functions, nothing from migration.c.

- savevm.c/vmstate.c/migration.c: they are still tangled, but I wanted to send the easy parts for review.

- half of the savevm.c functions are still exported from sysemu/sysemu.h moving that to a different file, have to think about it to make patches easier to understand.

- split capabilities/qmp commands/... from migration.c they don't belong there, and once they are out it would be easier to untangle the remaining bits.

- goal is still untangle normal migration/xbzrle/compression and rdma, they are still too untangled together.

- I can still remove some includes that are not needed, but with the current code, it gets really complicated until there is more cleanup there.

Please, comment.

Juan Quintela (41):
migration: Create migration/blocker.h
migration: Split migration/channel.c for channel operations
migration: Remove MigrationState from migration_channel_incomming()
migration: Export qemu-file-channel.c functions in its own file
migration: Remove migration.h from colo.h
migration: Move colo.h to migration/
migration: Move failover.h to migration/colo-failover.h
migration: Move page_cache.c to migration/
migration: Move qjson.h to migration/
migration: Move postcopy-ram.h to migration/
migration: Split vmstate-types.c from vmstate.c
migration: Remove qemu-file.h from vmstate.h
migration: Remove vmstate.h from migration.h
migration: migration.h was not needed
migration: Create include for migration snapshots
migration: Rename {save,load}_vmstate to {save,load}_snapshot
migration: Create savevm.h for functions exported from savevm.c
migration: Split qemu-file.h
migration: Remove unneeded includes of migration/vmstate.h
migration: Export exec.c functions in its own file
migration: Export fd.c functions in its own file
migration: Export socket.c functions in its own file
migration: Export tls.c functions in its own file
migration: Export ram.c functions in its own file
migration: Export rdma.c functions in its own file
migration: Move include/migration/block.h into migration/
migration: Move self_announce_delay() to misc.h
migration: Split registration functions from vmstate.h
migration: loadvm_free_handlers is only used in migration/
migration: Move dump_vmsate_json_to_file() to misc.h
migration: Move postcopy stuff to postcopy-ram.c
migration: Move constants to savevm.h
migration: Commands are only used inside migration.c
migration: ram_control_* are implemented in qemu_file
migration: create global_state.c
migration: Move more exported functions to migration/misc.h
migration: Move last funtions to misc.h
migration: Move migration.h to migration/
exec: Create include for target_page_size()
migration: Make savevm.c target independent
migration: Remove unneeded includes

 MAINTAINERS                                        |   4 +-
 Makefile.objs                                      |   1 -
 Makefile.target                                    |   2 +-
 block/qcow.c                                       |   2 +-
 block/qed.c                                        |   1 -
 block/vdi.c                                        |   2 +-
 block/vhdx.c                                       |   2 +-
 block/vmdk.c                                       |   2 +-
 block/vpc.c                                        |   2 +-
 block/vvfat.c                                      |   2 +-
 exec.c                                             |  10 +
 hmp.c                                              |   5 +-
 hw/9pfs/9p.c                                       |   2 +-
 hw/core/qdev.c                                     |   1 -
 hw/display/qxl.c                                   |   2 +-
 hw/display/virtio-gpu.c                            |   2 +-
 hw/i2c/i2c-ddc.c                                   |   1 +
 hw/i386/pc_piix.c                                  |   3 +-
 hw/i386/pc_q35.c                                   |   1 -
 hw/intc/arm_gic_kvm.c                              |   2 +-
 hw/intc/arm_gicv3_its_kvm.c                        |   2 +-
 hw/intc/arm_gicv3_kvm.c                            |   2 +-
 hw/intc/s390_flic.c                                |   1 -
 hw/intc/s390_flic_kvm.c                            |   1 -
 hw/misc/ivshmem.c                                  |   2 +-
 hw/net/virtio-net.c                                |   1 +
 hw/net/vmxnet3.c                                   |   1 +
 hw/ppc/spapr.c                                     |   4 +-
 hw/s390x/s390-skeys.c                              |   2 +-
 hw/s390x/s390-virtio-ccw.c                         |   1 +
 hw/scsi/vhost-scsi.c                               |   2 +-
 hw/virtio/vhost-user.c                             |   1 -
 hw/virtio/vhost-vsock.c                            |   1 -
 hw/virtio/vhost.c                                  |   2 +-
 hw/virtio/virtio.c                                 |   1 -
 include/block/block_int.h                          |   4 +-
 include/exec/target_page.h                         |  22 +
 include/hw/acpi/memory_hotplug.h                   |   1 -
 include/hw/acpi/pcihp.h                            |   1 -
 include/hw/hw.h                                    |   1 +
 include/hw/pci/shpc.h                              |   1 -
 include/migration/blocker.h                        |  35 ++
 include/migration/global_state.h                   |  26 +
 include/migration/migration.h                      | 353 -----------
 include/migration/misc.h                           |  53 ++
 include/migration/qemu-file-types.h                | 164 +++++
 include/migration/register.h                       |  64 ++
 include/migration/snapshot.h                       |  20 +
 include/migration/vmstate.h                        |  62 --
 include/net/net.h                                  |   1 -
 include/sysemu/sysemu.h                            |  51 --
 migration/Makefile.objs                            |   6 +-
 migration/block.c                                  |  14 +-
 {include/migration => migration}/block.h           |   1 -
 migration/channel.c                                |  72 +++
 migration/channel.h                                |  24 +
 migration/colo-comm.c                              |   4 +-
 migration/colo-failover.c                          |   6 +-
 .../failover.h => migration/colo-failover.h        |   0
 migration/colo.c                                   |   8 +-
 {include/migration => migration}/colo.h            |   4 -
 migration/exec.c                                   |   6 +-
 migration/exec.h                                   |  20 +
 migration/fd.c                                     |   6 +-
 migration/fd.h                                     |  20 +
 migration/global_state.c                           | 142 +++++
 migration/migration.c                              | 261 ++------
 migration/migration.h                              | 167 +++++
 page_cache.c => migration/page_cache.c             |   0
 {include/migration => migration}/page_cache.h      |   0
 migration/postcopy-ram.c                           |  28 +-
 {include/migration => migration}/postcopy-ram.h    |  26 +
 migration/qemu-file-channel.c                      |   4 +-
 migration/qemu-file-channel.h                      |  21 +
 migration/qemu-file.c                              |   6 +-
 {include/migration => migration}/qemu-file.h       | 178 +-----
 migration/qjson.c                                  |   2 +-
 {include/migration => migration}/qjson.h           |   0
 migration/ram.c                                    |  15 +-
 migration/ram.h                                    |  55 ++
 migration/rdma.c                                   |   8 +-
 migration/rdma.h                                   |  22 +
 migration/savevm.c                                 |  65 +-
 migration/savevm.h                                 |  58 ++
 migration/socket.c                                 |   9 +-
 migration/socket.h                                 |  25 +
 migration/tls.c                                    |   6 +-
 migration/tls.h                                    |  27 +
 migration/vmstate-types.c                          | 677 +++++++++++++++++++++
 migration/vmstate.c                                | 676 +-------------------
 migration/xbzrle.c                                 |   2 +-
 {include/migration => migration}/xbzrle.h          |   0
 monitor.c                                          |   1 -
 qdev-monitor.c                                     |   2 +-
 replay/replay-snapshot.c                           |   5 +-
 slirp/slirp.c                                      |   1 +
 stubs/migr-blocker.c                               |   2 +-
 target/alpha/cpu.c                                 |   1 -
 target/hppa/cpu.c                                  |   1 -
 target/i386/kvm.c                                  |   2 +-
 target/s390x/cpu.c                                 |   1 -
 target/tilegx/cpu.c                                |   1 -
 tests/Makefile.include                             |   4 +-
 tests/test-vmstate.c                               |   6 +-
 tests/test-xbzrle.c                                |   2 +-
 ui/spice-core.c                                    |   2 +-
 vl.c                                               |   7 +-
 xen-common.c                                       |   3 +-
 108 files changed, 2027 insertions(+), 1617 deletions(-)
 create mode 100644 include/exec/target_page.h
 create mode 100644 include/migration/blocker.h
 create mode 100644 include/migration/global_state.h
 delete mode 100644 include/migration/migration.h
 create mode 100644 include/migration/misc.h
 create mode 100644 include/migration/qemu-file-types.h
 create mode 100644 include/migration/register.h
 create mode 100644 include/migration/snapshot.h
 rename {include/migration => migration}/block.h (95%)
 create mode 100644 migration/channel.c
 create mode 100644 migration/channel.h
 rename include/migration/failover.h => migration/colo-failover.h (100%)
 rename {include/migration => migration}/colo.h (88%)
 create mode 100644 migration/exec.h
 create mode 100644 migration/fd.h
 create mode 100644 migration/global_state.c
 create mode 100644 migration/migration.h
 rename page_cache.c => migration/page_cache.c (100%)
 rename {include/migration => migration}/page_cache.h (100%)
 rename {include/migration => migration}/postcopy-ram.h (72%)
 create mode 100644 migration/qemu-file-channel.h
 rename {include/migration => migration}/qemu-file.h (62%)
Quoted 12 lines
 rename {include/migration => migration}/qjson.h (100%)
 create mode 100644 migration/ram.h
 create mode 100644 migration/rdma.h
 create mode 100644 migration/savevm.h
 create mode 100644 migration/socket.h
 create mode 100644 migration/tls.h
 create mode 100644 migration/vmstate-types.c
 rename {include/migration => migration}/xbzrle.h (100%)
Signature · 1 line
2.9.3

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#52 lore raw
Quoted 11 lines · Dr. David Alan Gilbert

* Juan Quintela ([email protected]) wrote:

High level question:
A lot of this is splitting migration.h which is a GPLv2 licensed file, and you're
carefully copying the authorship (Anthony) to each new header file and also the license.
Can we fix the license while we're at it?
The migration.c has the clause saying contributions after 2012-01-13 are GPL2 or later
but we don't seem to have it in the header.

Quoted 3 lines

I suggest for any case where you split it out to a new header and all the contributions
in that header are from one easily contactable person, that you ask.

/*
* QEMU live migration
*
* Copyright IBM, Corp. 2008
*
* Authors:
* Anthony Liguori <[email protected]>
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*
*/

This is what is on migration.h, where I have basically copied all of the stuff that is splitted. I tried not to enter in Copyrigth wars, so I left everything as it was.

Only place where I put a new Copyright was on vmstate.c, didn't have any, and I am the initial author O:-)

Later, Juan.