All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/41] Migration cleanup
@ 2017-04-25 22:04 Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 01/41] migration: Create migration/blocker.h Juan Quintela
                   ` (41 more replies)
  0 siblings, 42 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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%)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 01/41] migration: Create migration/blocker.h
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-27 11:58   ` Dr. David Alan Gilbert
  2017-05-10  9:55   ` Peter Xu
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 02/41] migration: Split migration/channel.c for channel operations Juan Quintela
                   ` (40 subsequent siblings)
  41 siblings, 2 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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%)

diff --git a/block/qcow.c b/block/qcow.c
index 9d6ac83..48e852c 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -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 */
diff --git a/block/vdi.c b/block/vdi.c
index 9b4f70e..5f7b29f 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -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"
diff --git a/block/vhdx.c b/block/vhdx.c
index 052a753..6128b7b 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -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 */
diff --git a/block/vmdk.c b/block/vmdk.c
index a9bd22b..f09f0b2 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -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>
 
diff --git a/block/vpc.c b/block/vpc.c
index f591d4b..cb2d4cf 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -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"
 
diff --git a/block/vvfat.c b/block/vvfat.c
index b509d55..3fcc59c 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -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"
diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index c80ba67..ab3e22f 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -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;
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 4d94cec..ad09bb9 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -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"
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index e1056f3..8ad27f3 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -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"
 
diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c
index ec952ec..af5cd36 100644
--- a/hw/intc/arm_gic_kvm.c
+++ b/hw/intc/arm_gic_kvm.c
@@ -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"
diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c
index bd4f3aa..a0441d6 100644
--- a/hw/intc/arm_gicv3_its_kvm.c
+++ b/hw/intc/arm_gicv3_its_kvm.c
@@ -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)
diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
index 19aab56..4ee2baa 100644
--- a/hw/intc/arm_gicv3_kvm.c
+++ b/hw/intc/arm_gicv3_kvm.c
@@ -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, ...) \
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 82ce837..475e36a 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -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"
diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
index f53bc17..0558737 100644
--- a/hw/scsi/vhost-scsi.c
+++ b/hw/scsi/vhost-scsi.c
@@ -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"
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 0001e60..03a46a7 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -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 */
diff --git a/include/migration/blocker.h b/include/migration/blocker.h
new file mode 100644
index 0000000..acd2701
--- /dev/null
+++ b/include/migration/blocker.h
@@ -0,0 +1,35 @@
+/*
+ * QEMU migration blockers
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * 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
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 9579280..02b074f 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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);
diff --git a/migration/migration.c b/migration/migration.c
index f094079..8625a6c 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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"
diff --git a/migration/ram.c b/migration/ram.c
index 5428026..4e562be 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -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"
diff --git a/migration/xbzrle.c b/migration/xbzrle.c
index 421bca0..1ba482d 100644
--- a/migration/xbzrle.c
+++ b/migration/xbzrle.c
@@ -12,7 +12,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu/cutils.h"
-#include "migration/xbzrle.h"
+#include "xbzrle.h"
 
 /*
   page = zrun nzrun
diff --git a/include/migration/xbzrle.h b/migration/xbzrle.h
similarity index 100%
rename from include/migration/xbzrle.h
rename to migration/xbzrle.h
diff --git a/stubs/migr-blocker.c b/stubs/migr-blocker.c
index a5ba18f..2b64ac9 100644
--- a/stubs/migr-blocker.c
+++ b/stubs/migr-blocker.c
@@ -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)
 {
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 55865db..011d4a5 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -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"
 
diff --git a/tests/test-xbzrle.c b/tests/test-xbzrle.c
index d97b5eb..f5e08de 100644
--- a/tests/test-xbzrle.c
+++ b/tests/test-xbzrle.c
@@ -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
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 02/41] migration: Split migration/channel.c for channel operations
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 01/41] migration: Create migration/blocker.h Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 03/41] migration: Remove MigrationState from migration_channel_incomming() Juan Quintela
                   ` (39 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Create an include for its exported functions.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 02b074f..bb81433 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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,
diff --git a/migration/Makefile.objs b/migration/Makefile.objs
index 480dd49..c83ca92 100644
--- a/migration/Makefile.objs
+++ b/migration/Makefile.objs
@@ -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
diff --git a/migration/channel.c b/migration/channel.c
new file mode 100644
index 0000000..6104de5
--- /dev/null
+++ b/migration/channel.c
@@ -0,0 +1,69 @@
+/*
+ * QEMU live migration
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ * Contributions after 2012-01-13 are licensed under the terms of the
+ * GNU GPL, version 2 or (at your option) any later version.
+ */
+
+#include "qemu/osdep.h"
+#include "channel.h"
+#include "migration/migration.h"
+#include "trace.h"
+#include "qapi/error.h"
+#include "io/channel-tls.h"
+
+void migration_channel_process_incoming(MigrationState *s,
+                                        QIOChannel *ioc)
+{
+    trace_migration_set_incoming_channel(
+        ioc, object_get_typename(OBJECT(ioc)));
+
+    if (s->parameters.tls_creds &&
+        *s->parameters.tls_creds &&
+        !object_dynamic_cast(OBJECT(ioc),
+                             TYPE_QIO_CHANNEL_TLS)) {
+        Error *local_err = NULL;
+        migration_tls_channel_process_incoming(s, ioc, &local_err);
+        if (local_err) {
+            error_report_err(local_err);
+        }
+    } else {
+        QEMUFile *f = qemu_fopen_channel_input(ioc);
+        migration_fd_process_incoming(f);
+    }
+}
+
+
+void migration_channel_connect(MigrationState *s,
+                               QIOChannel *ioc,
+                               const char *hostname)
+{
+    trace_migration_set_outgoing_channel(
+        ioc, object_get_typename(OBJECT(ioc)), hostname);
+
+    if (s->parameters.tls_creds &&
+        *s->parameters.tls_creds &&
+        !object_dynamic_cast(OBJECT(ioc),
+                             TYPE_QIO_CHANNEL_TLS)) {
+        Error *local_err = NULL;
+        migration_tls_channel_connect(s, ioc, hostname, &local_err);
+        if (local_err) {
+            migrate_fd_error(s, local_err);
+            error_free(local_err);
+        }
+    } else {
+        QEMUFile *f = qemu_fopen_channel_output(ioc);
+
+        s->to_dst_file = f;
+
+        migrate_fd_connect(s);
+    }
+}
diff --git a/migration/channel.h b/migration/channel.h
new file mode 100644
index 0000000..618acb7
--- /dev/null
+++ b/migration/channel.h
@@ -0,0 +1,25 @@
+/*
+ * QEMU live migration channel functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * 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
diff --git a/migration/exec.c b/migration/exec.c
index 9157721..203f587 100644
--- a/migration/exec.c
+++ b/migration/exec.c
@@ -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"
diff --git a/migration/fd.c b/migration/fd.c
index 58cb51a..05e0a5c 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -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"
diff --git a/migration/migration.c b/migration/migration.c
index 8625a6c..8c873c7 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -460,56 +460,6 @@ void migration_fd_process_incoming(QEMUFile *f)
     qemu_coroutine_enter(co);
 }
 
-
-void migration_channel_process_incoming(MigrationState *s,
-                                        QIOChannel *ioc)
-{
-    trace_migration_set_incoming_channel(
-        ioc, object_get_typename(OBJECT(ioc)));
-
-    if (s->parameters.tls_creds &&
-        *s->parameters.tls_creds &&
-        !object_dynamic_cast(OBJECT(ioc),
-                             TYPE_QIO_CHANNEL_TLS)) {
-        Error *local_err = NULL;
-        migration_tls_channel_process_incoming(s, ioc, &local_err);
-        if (local_err) {
-            error_report_err(local_err);
-        }
-    } else {
-        QEMUFile *f = qemu_fopen_channel_input(ioc);
-        migration_fd_process_incoming(f);
-    }
-}
-
-
-void migration_channel_connect(MigrationState *s,
-                               QIOChannel *ioc,
-                               const char *hostname)
-{
-    trace_migration_set_outgoing_channel(
-        ioc, object_get_typename(OBJECT(ioc)), hostname);
-
-    if (s->parameters.tls_creds &&
-        *s->parameters.tls_creds &&
-        !object_dynamic_cast(OBJECT(ioc),
-                             TYPE_QIO_CHANNEL_TLS)) {
-        Error *local_err = NULL;
-        migration_tls_channel_connect(s, ioc, hostname, &local_err);
-        if (local_err) {
-            migrate_fd_error(s, local_err);
-            error_free(local_err);
-        }
-    } else {
-        QEMUFile *f = qemu_fopen_channel_output(ioc);
-
-        s->to_dst_file = f;
-
-        migrate_fd_connect(s);
-    }
-}
-
-
 /*
  * Send a message on the return channel back to the source
  * of the migration.
diff --git a/migration/socket.c b/migration/socket.c
index dc88812..99bd7e7 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -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"
diff --git a/migration/tls.c b/migration/tls.c
index a33ecb7..34ad121 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -19,6 +19,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "channel.h"
 #include "migration/migration.h"
 #include "io/channel-tls.h"
 #include "crypto/tlscreds.h"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 03/41] migration: Remove MigrationState from migration_channel_incomming()
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 01/41] migration: Create migration/blocker.h Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 02/41] migration: Split migration/channel.c for channel operations Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 04/41] migration: Export qemu-file-channel.c functions in its own file Juan Quintela
                   ` (38 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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(-)

diff --git a/migration/channel.c b/migration/channel.c
index 6104de5..acb4dd6 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -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)));
 
diff --git a/migration/channel.h b/migration/channel.h
index 618acb7..fbc4bfb 100644
--- a/migration/channel.h
+++ b/migration/channel.h
@@ -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,
diff --git a/migration/exec.c b/migration/exec.c
index 203f587..405d0ab 100644
--- a/migration/exec.c
+++ b/migration/exec.c
@@ -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 */
 }
diff --git a/migration/fd.c b/migration/fd.c
index 05e0a5c..ccaa806 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -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 */
 }
diff --git a/migration/socket.c b/migration/socket.c
index 99bd7e7..a49cf44 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -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:
diff --git a/migration/tls.c b/migration/tls.c
index 34ad121..b4cb8fe 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -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));
 }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 04/41] migration: Export qemu-file-channel.c functions in its own file
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (2 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 03/41] migration: Remove MigrationState from migration_channel_incomming() Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 05/41] migration: Remove migration.h from colo.h Juan Quintela
                   ` (37 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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

diff --git a/include/migration/migration.h b/include/migration/migration.h
index bb81433..d465624 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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"
diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h
index 0cd648a..b5ac800 100644
--- a/include/migration/qemu-file.h
+++ b/include/migration/qemu-file.h
@@ -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);
diff --git a/migration/channel.c b/migration/channel.c
index acb4dd6..d9b51de 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -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"
diff --git a/migration/colo.c b/migration/colo.c
index 75e8807..cd9e767 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -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"
diff --git a/migration/migration.c b/migration/migration.c
index 8c873c7..dd8c9d5 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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"
diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c
index 45c13f1..dc991c9 100644
--- a/migration/qemu-file-channel.c
+++ b/migration/qemu-file-channel.c
@@ -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"
diff --git a/migration/qemu-file-channel.h b/migration/qemu-file-channel.h
new file mode 100644
index 0000000..d1bd5ff
--- /dev/null
+++ b/migration/qemu-file-channel.h
@@ -0,0 +1,21 @@
+/*
+ * QEMU migration file channel operations
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * 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
diff --git a/migration/rdma.c b/migration/rdma.c
index fe0a4b5..fffe2d6 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -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"
diff --git a/migration/savevm.c b/migration/savevm.c
index 97c6908..7a07ea6 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -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"
diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c
index f694a89..1c13570 100644
--- a/tests/test-vmstate.c
+++ b/tests/test-vmstate.c
@@ -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"
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 05/41] migration: Remove migration.h from colo.h
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (3 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 04/41] migration: Export qemu-file-channel.c functions in its own file Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 06/41] migration: Move colo.h to migration/ Juan Quintela
                   ` (36 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

migration.h is not included in any includes now.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/colo.h | 1 -
 migration/colo-comm.c    | 3 ++-
 migration/colo.c         | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/migration/colo.h b/include/migration/colo.h
index 2bbff9e..ba0bb6e 100644
--- a/include/migration/colo.h
+++ b/include/migration/colo.h
@@ -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"
diff --git a/migration/colo-comm.c b/migration/colo-comm.c
index 20b60ec..3d91798 100644
--- a/migration/colo-comm.c
+++ b/migration/colo-comm.c
@@ -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 {
diff --git a/migration/colo.c b/migration/colo.c
index cd9e767..fb00310 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 06/41] migration: Move colo.h to migration/
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (4 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 05/41] migration: Remove migration.h from colo.h Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-05-04 19:02   ` Dr. David Alan Gilbert
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 07/41] migration: Move failover.h to migration/colo-failover.h Juan Quintela
                   ` (35 subsequent siblings)
  41 siblings, 1 reply; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

There are functions only used by migration code.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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%)

diff --git a/MAINTAINERS b/MAINTAINERS
index cae3b09..3560ba2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1535,7 +1535,7 @@ COLO Framework
 M: zhanghailiang <zhang.zhanghailiang@huawei.com>
 S: Maintained
 F: migration/colo*
-F: include/migration/colo.h
+F: migration/colo.h
 F: include/migration/failover.h
 F: docs/COLO-FT.txt
 
diff --git a/migration/colo-comm.c b/migration/colo-comm.c
index 3d91798..9b35027 100644
--- a/migration/colo-comm.c
+++ b/migration/colo-comm.c
@@ -13,7 +13,7 @@
 
 #include "qemu/osdep.h"
 #include "migration/migration.h"
-#include "migration/colo.h"
+#include "colo.h"
 #include "trace.h"
 
 typedef struct {
diff --git a/migration/colo-failover.c b/migration/colo-failover.c
index cc229f5..29b8d63 100644
--- a/migration/colo-failover.c
+++ b/migration/colo-failover.c
@@ -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"
diff --git a/include/migration/colo.h b/migration/colo.h
similarity index 100%
rename from include/migration/colo.h
rename to migration/colo.h
diff --git a/migration/migration.c b/migration/migration.c
index dd8c9d5..fe30227 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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 */
 
diff --git a/migration/ram.c b/migration/ram.c
index 4e562be..47e66f4 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -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 */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 07/41] migration: Move failover.h to migration/colo-failover.h
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (5 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 06/41] migration: Move colo.h to migration/ Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 08/41] migration: Move page_cache.c to migration/ Juan Quintela
                   ` (34 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

This file is internal for migration/colo code.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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%)

diff --git a/MAINTAINERS b/MAINTAINERS
index 3560ba2..7435c9d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1536,7 +1536,7 @@ M: zhanghailiang <zhang.zhanghailiang@huawei.com>
 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
diff --git a/migration/colo-failover.c b/migration/colo-failover.c
index 29b8d63..85c4526 100644
--- a/migration/colo-failover.c
+++ b/migration/colo-failover.c
@@ -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"
diff --git a/include/migration/failover.h b/migration/colo-failover.h
similarity index 100%
rename from include/migration/failover.h
rename to migration/colo-failover.h
diff --git a/migration/colo.c b/migration/colo.c
index fb00310..31ab23f 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -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"
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 08/41] migration: Move page_cache.c to migration/
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (6 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 07/41] migration: Move failover.h to migration/colo-failover.h Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-05-04 19:03   ` Dr. David Alan Gilbert
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 09/41] migration: Move qjson.h " Juan Quintela
                   ` (33 subsequent siblings)
  41 siblings, 1 reply; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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%)

diff --git a/Makefile.objs b/Makefile.objs
index 6167e7b..2100845 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -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
 
diff --git a/migration/Makefile.objs b/migration/Makefile.objs
index c83ca92..ce8ce12 100644
--- a/migration/Makefile.objs
+++ b/migration/Makefile.objs
@@ -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
diff --git a/page_cache.c b/migration/page_cache.c
similarity index 100%
rename from page_cache.c
rename to migration/page_cache.c
diff --git a/include/migration/page_cache.h b/migration/page_cache.h
similarity index 100%
rename from include/migration/page_cache.h
rename to migration/page_cache.h
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 579ec07..0f98c04 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -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)
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 09/41] migration: Move qjson.h to migration/
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (7 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 08/41] migration: Move page_cache.c to migration/ Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 10/41] migration: Move postcopy-ram.h " Juan Quintela
                   ` (32 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

It is only used for migration code.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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%)

diff --git a/migration/qjson.c b/migration/qjson.c
index f345904..9d7f6eb 100644
--- a/migration/qjson.c
+++ b/migration/qjson.c
@@ -25,7 +25,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/qmp/qstring.h"
-#include "migration/qjson.h"
+#include "qjson.h"
 
 struct QJSON {
     QString *str;
diff --git a/include/migration/qjson.h b/migration/qjson.h
similarity index 100%
rename from include/migration/qjson.h
rename to migration/qjson.h
diff --git a/migration/vmstate.c b/migration/vmstate.c
index 7b4a607..66c50ee 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -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);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 10/41] migration: Move postcopy-ram.h to migration/
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (8 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 09/41] migration: Move qjson.h " Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-27 12:09   ` Dr. David Alan Gilbert
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 11/41] migration: Split vmstate-types.c from vmstate.c Juan Quintela
                   ` (31 subsequent siblings)
  41 siblings, 1 reply; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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%)

diff --git a/migration/migration.c b/migration/migration.c
index fe30227..fef1f0a 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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"
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index e3f4a37..cdadaf6 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -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"
diff --git a/include/migration/postcopy-ram.h b/migration/postcopy-ram.h
similarity index 100%
rename from include/migration/postcopy-ram.h
rename to migration/postcopy-ram.h
diff --git a/migration/ram.c b/migration/ram.c
index 47e66f4..5fcf593 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -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"
diff --git a/migration/savevm.c b/migration/savevm.c
index 7a07ea6..1b2a83c 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 11/41] migration: Split vmstate-types.c from vmstate.c
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (9 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 10/41] migration: Move postcopy-ram.h " Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 12/41] migration: Remove qemu-file.h from vmstate.h Juan Quintela
                   ` (30 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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

diff --git a/migration/Makefile.objs b/migration/Makefile.objs
index ce8ce12..812b2ec 100644
--- a/migration/Makefile.objs
+++ b/migration/Makefile.objs
@@ -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
diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c
new file mode 100644
index 0000000..0cf14d4
--- /dev/null
+++ b/migration/vmstate-types.c
@@ -0,0 +1,676 @@
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2009-2017 Red Hat Inc
+ *
+ * Authors:
+ *  Juan Quintela <quintela@redhat.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "migration/migration.h"
+#include "migration/qemu-file.h"
+#include "migration/vmstate.h"
+#include "qemu/error-report.h"
+#include "qemu/queue.h"
+#include "trace.h"
+
+/* bool */
+
+static int get_bool(QEMUFile *f, void *pv, size_t size, VMStateField *field)
+{
+    bool *v = pv;
+    *v = qemu_get_byte(f);
+    return 0;
+}
+
+static int put_bool(QEMUFile *f, void *pv, size_t size, VMStateField *field,
+                    QJSON *vmdesc)
+{
+    bool *v = pv;
+    qemu_put_byte(f, *v);
+    return 0;
+}
+
+const VMStateInfo vmstate_info_bool = {
+    .name = "bool",
+    .get  = get_bool,
+    .put  = put_bool,
+};
+
+/* 8 bit int */
+
+static int get_int8(QEMUFile *f, void *pv, size_t size, VMStateField *field)
+{
+    int8_t *v = pv;
+    qemu_get_s8s(f, v);
+    return 0;
+}
+
+static int put_int8(QEMUFile *f, void *pv, size_t size, VMStateField *field,
+                     QJSON *vmdesc)
+{
+    int8_t *v = pv;
+    qemu_put_s8s(f, v);
+    return 0;
+}
+
+const VMStateInfo vmstate_info_int8 = {
+    .name = "int8",
+    .get  = get_int8,
+    .put  = put_int8,
+};
+
+/* 16 bit int */
+
+static int get_int16(QEMUFile *f, void *pv, size_t size, VMStateField *field)
+{
+    int16_t *v = pv;
+    qemu_get_sbe16s(f, v);
+    return 0;
+}
+
+static int put_int16(QEMUFile *f, void *pv, size_t size, VMStateField *field,
+                     QJSON *vmdesc)
+{
+    int16_t *v = pv;
+    qemu_put_sbe16s(f, v);
+    return 0;
+}
+
+const VMStateInfo vmstate_info_int16 = {
+    .name = "int16",
+    .get  = get_int16,
+    .put  = put_int16,
+};
+
+/* 32 bit int */
+
+static int get_int32(QEMUFile *f, void *pv, size_t size, VMStateField *field)
+{
+    int32_t *v = pv;
+    qemu_get_sbe32s(f, v);
+    return 0;
+}
+
+static int put_int32(QEMUFile *f, void *pv, size_t size, VMStateField *field,
+                     QJSON *vmdesc)
+{
+    int32_t *v = pv;
+    qemu_put_sbe32s(f, v);
+    return 0;
+}
+
+const VMStateInfo vmstate_info_int32 = {
+    .name = "int32",
+    .get  = get_int32,
+    .put  = put_int32,
+};
+
+/* 32 bit int. See that the received value is the same than the one
+   in the field */
+
+static int get_int32_equal(QEMUFile *f, void *pv, size_t size,
+                           VMStateField *field)
+{
+    int32_t *v = pv;
+    int32_t v2;
+    qemu_get_sbe32s(f, &v2);
+
+    if (*v == v2) {
+        return 0;
+    }
+    error_report("%" PRIx32 " != %" PRIx32, *v, v2);
+    return -EINVAL;
+}
+
+const VMStateInfo vmstate_info_int32_equal = {
+    .name = "int32 equal",
+    .get  = get_int32_equal,
+    .put  = put_int32,
+};
+
+/* 32 bit int. Check that the received value is non-negative
+ * and less than or equal to the one in the field.
+ */
+
+static int get_int32_le(QEMUFile *f, void *pv, size_t size, VMStateField *field)
+{
+    int32_t *cur = pv;
+    int32_t loaded;
+    qemu_get_sbe32s(f, &loaded);
+
+    if (loaded >= 0 && loaded <= *cur) {
+        *cur = loaded;
+        return 0;
+    }
+    error_report("Invalid value %" PRId32
+                 " expecting positive value <= %" PRId32,
+                 loaded, *cur);
+    return -EINVAL;
+}
+
+const VMStateInfo vmstate_info_int32_le = {
+    .name = "int32 le",
+    .get  = get_int32_le,
+    .put  = put_int32,
+};
+
+/* 64 bit int */
+
+static int get_int64(QEMUFile *f, void *pv, size_t size, VMStateField *field)
+{
+    int64_t *v = pv;
+    qemu_get_sbe64s(f, v);
+    return 0;
+}
+
+static int put_int64(QEMUFile *f, void *pv, size_t size, VMStateField *field,
+                      QJSON *vmdesc)
+{
+    int64_t *v = pv;
+    qemu_put_sbe64s(f, v);
+    return 0;
+}
+
+const VMStateInfo vmstate_info_int64 = {
+    .name = "int64",
+    .get  = get_int64,
+    .put  = put_int64,
+};
+
+/* 8 bit unsigned int */
+
+static int get_uint8(QEMUFile *f, void *pv, size_t size, VMStateField *field)
+{
+    uint8_t *v = pv;
+    qemu_get_8s(f, v);
+    return 0;
+}
+
+static int put_uint8(QEMUFile *f, void *pv, size_t size, VMStateField *field,
+                     QJSON *vmdesc)
+{
+    uint8_t *v = pv;
+    qemu_put_8s(f, v);
+    return 0;
+}
+
+const VMStateInfo vmstate_info_uint8 = {
+    .name = "uint8",
+    .get  = get_uint8,
+    .put  = put_uint8,
+};
+
+/* 16 bit unsigned int */
+
+static int get_uint16(QEMUFile *f, void *pv, size_t size, VMStateField *field)
+{
+    uint16_t *v = pv;
+    qemu_get_be16s(f, v);
+    return 0;
+}
+
+static int put_uint16(QEMUFile *f, void *pv, size_t size, VMStateField *field,
+                      QJSON *vmdesc)
+{
+    uint16_t *v = pv;
+    qemu_put_be16s(f, v);
+    return 0;
+}
+
+const VMStateInfo vmstate_info_uint16 = {
+    .name = "uint16",
+    .get  = get_uint16,
+    .put  = put_uint16,
+};
+
+/* 32 bit unsigned int */
+
+static int get_uint32(QEMUFile *f, void *pv, size_t size, VMStateField *field)
+{
+    uint32_t *v = pv;
+    qemu_get_be32s(f, v);
+    return 0;
+}
+
+static int put_uint32(QEMUFile *f, void *pv, size_t size, VMStateField *field,
+                      QJSON *vmdesc)
+{
+    uint32_t *v = pv;
+    qemu_put_be32s(f, v);
+    return 0;
+}
+
+const VMStateInfo vmstate_info_uint32 = {
+    .name = "uint32",
+    .get  = get_uint32,
+    .put  = put_uint32,
+};
+
+/* 32 bit uint. See that the received value is the same than the one
+   in the field */
+
+static int get_uint32_equal(QEMUFile *f, void *pv, size_t size,
+                            VMStateField *field)
+{
+    uint32_t *v = pv;
+    uint32_t v2;
+    qemu_get_be32s(f, &v2);
+
+    if (*v == v2) {
+        return 0;
+    }
+    error_report("%" PRIx32 " != %" PRIx32, *v, v2);
+    return -EINVAL;
+}
+
+const VMStateInfo vmstate_info_uint32_equal = {
+    .name = "uint32 equal",
+    .get  = get_uint32_equal,
+    .put  = put_uint32,
+};
+
+/* 64 bit unsigned int */
+
+static int get_uint64(QEMUFile *f, void *pv, size_t size, VMStateField *field)
+{
+    uint64_t *v = pv;
+    qemu_get_be64s(f, v);
+    return 0;
+}
+
+static int put_uint64(QEMUFile *f, void *pv, size_t size, VMStateField *field,
+                      QJSON *vmdesc)
+{
+    uint64_t *v = pv;
+    qemu_put_be64s(f, v);
+    return 0;
+}
+
+const VMStateInfo vmstate_info_uint64 = {
+    .name = "uint64",
+    .get  = get_uint64,
+    .put  = put_uint64,
+};
+
+static int get_nullptr(QEMUFile *f, void *pv, size_t size, VMStateField *field)
+
+{
+    if (qemu_get_byte(f) == VMS_NULLPTR_MARKER) {
+        return  0;
+    }
+    error_report("vmstate: get_nullptr expected VMS_NULLPTR_MARKER");
+    return -EINVAL;
+}
+
+static int put_nullptr(QEMUFile *f, void *pv, size_t size,
+                        VMStateField *field, QJSON *vmdesc)
+
+{
+    if (pv == NULL) {
+        qemu_put_byte(f, VMS_NULLPTR_MARKER);
+        return 0;
+    }
+    error_report("vmstate: put_nullptr must be called with pv == NULL");
+    return -EINVAL;
+}
+
+const VMStateInfo vmstate_info_nullptr = {
+    .name = "uint64",
+    .get  = get_nullptr,
+    .put  = put_nullptr,
+};
+
+/* 64 bit unsigned int. See that the received value is the same than the one
+   in the field */
+
+static int get_uint64_equal(QEMUFile *f, void *pv, size_t size,
+                            VMStateField *field)
+{
+    uint64_t *v = pv;
+    uint64_t v2;
+    qemu_get_be64s(f, &v2);
+
+    if (*v == v2) {
+        return 0;
+    }
+    error_report("%" PRIx64 " != %" PRIx64, *v, v2);
+    return -EINVAL;
+}
+
+const VMStateInfo vmstate_info_uint64_equal = {
+    .name = "int64 equal",
+    .get  = get_uint64_equal,
+    .put  = put_uint64,
+};
+
+/* 8 bit int. See that the received value is the same than the one
+   in the field */
+
+static int get_uint8_equal(QEMUFile *f, void *pv, size_t size,
+                           VMStateField *field)
+{
+    uint8_t *v = pv;
+    uint8_t v2;
+    qemu_get_8s(f, &v2);
+
+    if (*v == v2) {
+        return 0;
+    }
+    error_report("%x != %x", *v, v2);
+    return -EINVAL;
+}
+
+const VMStateInfo vmstate_info_uint8_equal = {
+    .name = "uint8 equal",
+    .get  = get_uint8_equal,
+    .put  = put_uint8,
+};
+
+/* 16 bit unsigned int int. See that the received value is the same than the one
+   in the field */
+
+static int get_uint16_equal(QEMUFile *f, void *pv, size_t size,
+                            VMStateField *field)
+{
+    uint16_t *v = pv;
+    uint16_t v2;
+    qemu_get_be16s(f, &v2);
+
+    if (*v == v2) {
+        return 0;
+    }
+    error_report("%x != %x", *v, v2);
+    return -EINVAL;
+}
+
+const VMStateInfo vmstate_info_uint16_equal = {
+    .name = "uint16 equal",
+    .get  = get_uint16_equal,
+    .put  = put_uint16,
+};
+
+/* floating point */
+
+static int get_float64(QEMUFile *f, void *pv, size_t size,
+                       VMStateField *field)
+{
+    float64 *v = pv;
+
+    *v = make_float64(qemu_get_be64(f));
+    return 0;
+}
+
+static int put_float64(QEMUFile *f, void *pv, size_t size, VMStateField *field,
+                       QJSON *vmdesc)
+{
+    uint64_t *v = pv;
+
+    qemu_put_be64(f, float64_val(*v));
+    return 0;
+}
+
+const VMStateInfo vmstate_info_float64 = {
+    .name = "float64",
+    .get  = get_float64,
+    .put  = put_float64,
+};
+
+/* CPU_DoubleU type */
+
+static int get_cpudouble(QEMUFile *f, void *pv, size_t size,
+                         VMStateField *field)
+{
+    CPU_DoubleU *v = pv;
+    qemu_get_be32s(f, &v->l.upper);
+    qemu_get_be32s(f, &v->l.lower);
+    return 0;
+}
+
+static int put_cpudouble(QEMUFile *f, void *pv, size_t size,
+                         VMStateField *field, QJSON *vmdesc)
+{
+    CPU_DoubleU *v = pv;
+    qemu_put_be32s(f, &v->l.upper);
+    qemu_put_be32s(f, &v->l.lower);
+    return 0;
+}
+
+const VMStateInfo vmstate_info_cpudouble = {
+    .name = "CPU_Double_U",
+    .get  = get_cpudouble,
+    .put  = put_cpudouble,
+};
+
+/* uint8_t buffers */
+
+static int get_buffer(QEMUFile *f, void *pv, size_t size,
+                      VMStateField *field)
+{
+    uint8_t *v = pv;
+    qemu_get_buffer(f, v, size);
+    return 0;
+}
+
+static int put_buffer(QEMUFile *f, void *pv, size_t size, VMStateField *field,
+                      QJSON *vmdesc)
+{
+    uint8_t *v = pv;
+    qemu_put_buffer(f, v, size);
+    return 0;
+}
+
+const VMStateInfo vmstate_info_buffer = {
+    .name = "buffer",
+    .get  = get_buffer,
+    .put  = put_buffer,
+};
+
+/* unused buffers: space that was used for some fields that are
+   not useful anymore */
+
+static int get_unused_buffer(QEMUFile *f, void *pv, size_t size,
+                             VMStateField *field)
+{
+    uint8_t buf[1024];
+    int block_len;
+
+    while (size > 0) {
+        block_len = MIN(sizeof(buf), size);
+        size -= block_len;
+        qemu_get_buffer(f, buf, block_len);
+    }
+   return 0;
+}
+
+static int put_unused_buffer(QEMUFile *f, void *pv, size_t size,
+                             VMStateField *field, QJSON *vmdesc)
+{
+    static const uint8_t buf[1024];
+    int block_len;
+
+    while (size > 0) {
+        block_len = MIN(sizeof(buf), size);
+        size -= block_len;
+        qemu_put_buffer(f, buf, block_len);
+    }
+
+    return 0;
+}
+
+const VMStateInfo vmstate_info_unused_buffer = {
+    .name = "unused_buffer",
+    .get  = get_unused_buffer,
+    .put  = put_unused_buffer,
+};
+
+/* vmstate_info_tmp, see VMSTATE_WITH_TMP, the idea is that we allocate
+ * a temporary buffer and the pre_load/pre_save methods in the child vmsd
+ * copy stuff from the parent into the child and do calculations to fill
+ * in fields that don't really exist in the parent but need to be in the
+ * stream.
+ */
+static int get_tmp(QEMUFile *f, void *pv, size_t size, VMStateField *field)
+{
+    int ret;
+    const VMStateDescription *vmsd = field->vmsd;
+    int version_id = field->version_id;
+    void *tmp = g_malloc(size);
+
+    /* Writes the parent field which is at the start of the tmp */
+    *(void **)tmp = pv;
+    ret = vmstate_load_state(f, vmsd, tmp, version_id);
+    g_free(tmp);
+    return ret;
+}
+
+static int put_tmp(QEMUFile *f, void *pv, size_t size, VMStateField *field,
+                    QJSON *vmdesc)
+{
+    const VMStateDescription *vmsd = field->vmsd;
+    void *tmp = g_malloc(size);
+
+    /* Writes the parent field which is at the start of the tmp */
+    *(void **)tmp = pv;
+    vmstate_save_state(f, vmsd, tmp, vmdesc);
+    g_free(tmp);
+
+    return 0;
+}
+
+const VMStateInfo vmstate_info_tmp = {
+    .name = "tmp",
+    .get = get_tmp,
+    .put = put_tmp,
+};
+
+/* bitmaps (as defined by bitmap.h). Note that size here is the size
+ * of the bitmap in bits. The on-the-wire format of a bitmap is 64
+ * bit words with the bits in big endian order. The in-memory format
+ * is an array of 'unsigned long', which may be either 32 or 64 bits.
+ */
+/* This is the number of 64 bit words sent over the wire */
+#define BITS_TO_U64S(nr) DIV_ROUND_UP(nr, 64)
+static int get_bitmap(QEMUFile *f, void *pv, size_t size, VMStateField *field)
+{
+    unsigned long *bmp = pv;
+    int i, idx = 0;
+    for (i = 0; i < BITS_TO_U64S(size); i++) {
+        uint64_t w = qemu_get_be64(f);
+        bmp[idx++] = w;
+        if (sizeof(unsigned long) == 4 && idx < BITS_TO_LONGS(size)) {
+            bmp[idx++] = w >> 32;
+        }
+    }
+    return 0;
+}
+
+static int put_bitmap(QEMUFile *f, void *pv, size_t size, VMStateField *field,
+                      QJSON *vmdesc)
+{
+    unsigned long *bmp = pv;
+    int i, idx = 0;
+    for (i = 0; i < BITS_TO_U64S(size); i++) {
+        uint64_t w = bmp[idx++];
+        if (sizeof(unsigned long) == 4 && idx < BITS_TO_LONGS(size)) {
+            w |= ((uint64_t)bmp[idx++]) << 32;
+        }
+        qemu_put_be64(f, w);
+    }
+
+    return 0;
+}
+
+const VMStateInfo vmstate_info_bitmap = {
+    .name = "bitmap",
+    .get = get_bitmap,
+    .put = put_bitmap,
+};
+
+/* get for QTAILQ
+ * meta data about the QTAILQ is encoded in a VMStateField structure
+ */
+static int get_qtailq(QEMUFile *f, void *pv, size_t unused_size,
+                      VMStateField *field)
+{
+    int ret = 0;
+    const VMStateDescription *vmsd = field->vmsd;
+    /* size of a QTAILQ element */
+    size_t size = field->size;
+    /* offset of the QTAILQ entry in a QTAILQ element */
+    size_t entry_offset = field->start;
+    int version_id = field->version_id;
+    void *elm;
+
+    trace_get_qtailq(vmsd->name, version_id);
+    if (version_id > vmsd->version_id) {
+        error_report("%s %s",  vmsd->name, "too new");
+        trace_get_qtailq_end(vmsd->name, "too new", -EINVAL);
+
+        return -EINVAL;
+    }
+    if (version_id < vmsd->minimum_version_id) {
+        error_report("%s %s",  vmsd->name, "too old");
+        trace_get_qtailq_end(vmsd->name, "too old", -EINVAL);
+        return -EINVAL;
+    }
+
+    while (qemu_get_byte(f)) {
+        elm = g_malloc(size);
+        ret = vmstate_load_state(f, vmsd, elm, version_id);
+        if (ret) {
+            return ret;
+        }
+        QTAILQ_RAW_INSERT_TAIL(pv, elm, entry_offset);
+    }
+
+    trace_get_qtailq_end(vmsd->name, "end", ret);
+    return ret;
+}
+
+/* put for QTAILQ */
+static int put_qtailq(QEMUFile *f, void *pv, size_t unused_size,
+                      VMStateField *field, QJSON *vmdesc)
+{
+    const VMStateDescription *vmsd = field->vmsd;
+    /* offset of the QTAILQ entry in a QTAILQ element*/
+    size_t entry_offset = field->start;
+    void *elm;
+
+    trace_put_qtailq(vmsd->name, vmsd->version_id);
+
+    QTAILQ_RAW_FOREACH(elm, pv, entry_offset) {
+        qemu_put_byte(f, true);
+        vmstate_save_state(f, vmsd, elm, vmdesc);
+    }
+    qemu_put_byte(f, false);
+
+    trace_put_qtailq_end(vmsd->name, "end");
+
+    return 0;
+}
+const VMStateInfo vmstate_info_qtailq = {
+    .name = "qtailq",
+    .get  = get_qtailq,
+    .put  = put_qtailq,
+};
diff --git a/migration/vmstate.c b/migration/vmstate.c
index 66c50ee..c284769 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -1,3 +1,30 @@
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2009-2017 Red Hat Inc
+ *
+ * Authors:
+ *  Juan Quintela <quintela@redhat.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "migration/migration.h"
@@ -5,7 +32,6 @@
 #include "migration/vmstate.h"
 #include "qemu/bitops.h"
 #include "qemu/error-report.h"
-#include "qemu/queue.h"
 #include "trace.h"
 #include "qjson.h"
 
@@ -475,644 +501,3 @@ static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
         json_end_array(vmdesc);
     }
 }
-
-/* bool */
-
-static int get_bool(QEMUFile *f, void *pv, size_t size, VMStateField *field)
-{
-    bool *v = pv;
-    *v = qemu_get_byte(f);
-    return 0;
-}
-
-static int put_bool(QEMUFile *f, void *pv, size_t size, VMStateField *field,
-                    QJSON *vmdesc)
-{
-    bool *v = pv;
-    qemu_put_byte(f, *v);
-    return 0;
-}
-
-const VMStateInfo vmstate_info_bool = {
-    .name = "bool",
-    .get  = get_bool,
-    .put  = put_bool,
-};
-
-/* 8 bit int */
-
-static int get_int8(QEMUFile *f, void *pv, size_t size, VMStateField *field)
-{
-    int8_t *v = pv;
-    qemu_get_s8s(f, v);
-    return 0;
-}
-
-static int put_int8(QEMUFile *f, void *pv, size_t size, VMStateField *field,
-                     QJSON *vmdesc)
-{
-    int8_t *v = pv;
-    qemu_put_s8s(f, v);
-    return 0;
-}
-
-const VMStateInfo vmstate_info_int8 = {
-    .name = "int8",
-    .get  = get_int8,
-    .put  = put_int8,
-};
-
-/* 16 bit int */
-
-static int get_int16(QEMUFile *f, void *pv, size_t size, VMStateField *field)
-{
-    int16_t *v = pv;
-    qemu_get_sbe16s(f, v);
-    return 0;
-}
-
-static int put_int16(QEMUFile *f, void *pv, size_t size, VMStateField *field,
-                     QJSON *vmdesc)
-{
-    int16_t *v = pv;
-    qemu_put_sbe16s(f, v);
-    return 0;
-}
-
-const VMStateInfo vmstate_info_int16 = {
-    .name = "int16",
-    .get  = get_int16,
-    .put  = put_int16,
-};
-
-/* 32 bit int */
-
-static int get_int32(QEMUFile *f, void *pv, size_t size, VMStateField *field)
-{
-    int32_t *v = pv;
-    qemu_get_sbe32s(f, v);
-    return 0;
-}
-
-static int put_int32(QEMUFile *f, void *pv, size_t size, VMStateField *field,
-                     QJSON *vmdesc)
-{
-    int32_t *v = pv;
-    qemu_put_sbe32s(f, v);
-    return 0;
-}
-
-const VMStateInfo vmstate_info_int32 = {
-    .name = "int32",
-    .get  = get_int32,
-    .put  = put_int32,
-};
-
-/* 32 bit int. See that the received value is the same than the one
-   in the field */
-
-static int get_int32_equal(QEMUFile *f, void *pv, size_t size,
-                           VMStateField *field)
-{
-    int32_t *v = pv;
-    int32_t v2;
-    qemu_get_sbe32s(f, &v2);
-
-    if (*v == v2) {
-        return 0;
-    }
-    error_report("%" PRIx32 " != %" PRIx32, *v, v2);
-    return -EINVAL;
-}
-
-const VMStateInfo vmstate_info_int32_equal = {
-    .name = "int32 equal",
-    .get  = get_int32_equal,
-    .put  = put_int32,
-};
-
-/* 32 bit int. Check that the received value is non-negative
- * and less than or equal to the one in the field.
- */
-
-static int get_int32_le(QEMUFile *f, void *pv, size_t size, VMStateField *field)
-{
-    int32_t *cur = pv;
-    int32_t loaded;
-    qemu_get_sbe32s(f, &loaded);
-
-    if (loaded >= 0 && loaded <= *cur) {
-        *cur = loaded;
-        return 0;
-    }
-    error_report("Invalid value %" PRId32
-                 " expecting positive value <= %" PRId32,
-                 loaded, *cur);
-    return -EINVAL;
-}
-
-const VMStateInfo vmstate_info_int32_le = {
-    .name = "int32 le",
-    .get  = get_int32_le,
-    .put  = put_int32,
-};
-
-/* 64 bit int */
-
-static int get_int64(QEMUFile *f, void *pv, size_t size, VMStateField *field)
-{
-    int64_t *v = pv;
-    qemu_get_sbe64s(f, v);
-    return 0;
-}
-
-static int put_int64(QEMUFile *f, void *pv, size_t size, VMStateField *field,
-                      QJSON *vmdesc)
-{
-    int64_t *v = pv;
-    qemu_put_sbe64s(f, v);
-    return 0;
-}
-
-const VMStateInfo vmstate_info_int64 = {
-    .name = "int64",
-    .get  = get_int64,
-    .put  = put_int64,
-};
-
-/* 8 bit unsigned int */
-
-static int get_uint8(QEMUFile *f, void *pv, size_t size, VMStateField *field)
-{
-    uint8_t *v = pv;
-    qemu_get_8s(f, v);
-    return 0;
-}
-
-static int put_uint8(QEMUFile *f, void *pv, size_t size, VMStateField *field,
-                     QJSON *vmdesc)
-{
-    uint8_t *v = pv;
-    qemu_put_8s(f, v);
-    return 0;
-}
-
-const VMStateInfo vmstate_info_uint8 = {
-    .name = "uint8",
-    .get  = get_uint8,
-    .put  = put_uint8,
-};
-
-/* 16 bit unsigned int */
-
-static int get_uint16(QEMUFile *f, void *pv, size_t size, VMStateField *field)
-{
-    uint16_t *v = pv;
-    qemu_get_be16s(f, v);
-    return 0;
-}
-
-static int put_uint16(QEMUFile *f, void *pv, size_t size, VMStateField *field,
-                      QJSON *vmdesc)
-{
-    uint16_t *v = pv;
-    qemu_put_be16s(f, v);
-    return 0;
-}
-
-const VMStateInfo vmstate_info_uint16 = {
-    .name = "uint16",
-    .get  = get_uint16,
-    .put  = put_uint16,
-};
-
-/* 32 bit unsigned int */
-
-static int get_uint32(QEMUFile *f, void *pv, size_t size, VMStateField *field)
-{
-    uint32_t *v = pv;
-    qemu_get_be32s(f, v);
-    return 0;
-}
-
-static int put_uint32(QEMUFile *f, void *pv, size_t size, VMStateField *field,
-                      QJSON *vmdesc)
-{
-    uint32_t *v = pv;
-    qemu_put_be32s(f, v);
-    return 0;
-}
-
-const VMStateInfo vmstate_info_uint32 = {
-    .name = "uint32",
-    .get  = get_uint32,
-    .put  = put_uint32,
-};
-
-/* 32 bit uint. See that the received value is the same than the one
-   in the field */
-
-static int get_uint32_equal(QEMUFile *f, void *pv, size_t size,
-                            VMStateField *field)
-{
-    uint32_t *v = pv;
-    uint32_t v2;
-    qemu_get_be32s(f, &v2);
-
-    if (*v == v2) {
-        return 0;
-    }
-    error_report("%" PRIx32 " != %" PRIx32, *v, v2);
-    return -EINVAL;
-}
-
-const VMStateInfo vmstate_info_uint32_equal = {
-    .name = "uint32 equal",
-    .get  = get_uint32_equal,
-    .put  = put_uint32,
-};
-
-/* 64 bit unsigned int */
-
-static int get_uint64(QEMUFile *f, void *pv, size_t size, VMStateField *field)
-{
-    uint64_t *v = pv;
-    qemu_get_be64s(f, v);
-    return 0;
-}
-
-static int put_uint64(QEMUFile *f, void *pv, size_t size, VMStateField *field,
-                      QJSON *vmdesc)
-{
-    uint64_t *v = pv;
-    qemu_put_be64s(f, v);
-    return 0;
-}
-
-const VMStateInfo vmstate_info_uint64 = {
-    .name = "uint64",
-    .get  = get_uint64,
-    .put  = put_uint64,
-};
-
-static int get_nullptr(QEMUFile *f, void *pv, size_t size, VMStateField *field)
-
-{
-    if (qemu_get_byte(f) == VMS_NULLPTR_MARKER) {
-        return  0;
-    }
-    error_report("vmstate: get_nullptr expected VMS_NULLPTR_MARKER");
-    return -EINVAL;
-}
-
-static int put_nullptr(QEMUFile *f, void *pv, size_t size,
-                        VMStateField *field, QJSON *vmdesc)
-
-{
-    if (pv == NULL) {
-        qemu_put_byte(f, VMS_NULLPTR_MARKER);
-        return 0;
-    }
-    error_report("vmstate: put_nullptr must be called with pv == NULL");
-    return -EINVAL;
-}
-
-const VMStateInfo vmstate_info_nullptr = {
-    .name = "uint64",
-    .get  = get_nullptr,
-    .put  = put_nullptr,
-};
-
-/* 64 bit unsigned int. See that the received value is the same than the one
-   in the field */
-
-static int get_uint64_equal(QEMUFile *f, void *pv, size_t size,
-                            VMStateField *field)
-{
-    uint64_t *v = pv;
-    uint64_t v2;
-    qemu_get_be64s(f, &v2);
-
-    if (*v == v2) {
-        return 0;
-    }
-    error_report("%" PRIx64 " != %" PRIx64, *v, v2);
-    return -EINVAL;
-}
-
-const VMStateInfo vmstate_info_uint64_equal = {
-    .name = "int64 equal",
-    .get  = get_uint64_equal,
-    .put  = put_uint64,
-};
-
-/* 8 bit int. See that the received value is the same than the one
-   in the field */
-
-static int get_uint8_equal(QEMUFile *f, void *pv, size_t size,
-                           VMStateField *field)
-{
-    uint8_t *v = pv;
-    uint8_t v2;
-    qemu_get_8s(f, &v2);
-
-    if (*v == v2) {
-        return 0;
-    }
-    error_report("%x != %x", *v, v2);
-    return -EINVAL;
-}
-
-const VMStateInfo vmstate_info_uint8_equal = {
-    .name = "uint8 equal",
-    .get  = get_uint8_equal,
-    .put  = put_uint8,
-};
-
-/* 16 bit unsigned int int. See that the received value is the same than the one
-   in the field */
-
-static int get_uint16_equal(QEMUFile *f, void *pv, size_t size,
-                            VMStateField *field)
-{
-    uint16_t *v = pv;
-    uint16_t v2;
-    qemu_get_be16s(f, &v2);
-
-    if (*v == v2) {
-        return 0;
-    }
-    error_report("%x != %x", *v, v2);
-    return -EINVAL;
-}
-
-const VMStateInfo vmstate_info_uint16_equal = {
-    .name = "uint16 equal",
-    .get  = get_uint16_equal,
-    .put  = put_uint16,
-};
-
-/* floating point */
-
-static int get_float64(QEMUFile *f, void *pv, size_t size,
-                       VMStateField *field)
-{
-    float64 *v = pv;
-
-    *v = make_float64(qemu_get_be64(f));
-    return 0;
-}
-
-static int put_float64(QEMUFile *f, void *pv, size_t size, VMStateField *field,
-                       QJSON *vmdesc)
-{
-    uint64_t *v = pv;
-
-    qemu_put_be64(f, float64_val(*v));
-    return 0;
-}
-
-const VMStateInfo vmstate_info_float64 = {
-    .name = "float64",
-    .get  = get_float64,
-    .put  = put_float64,
-};
-
-/* CPU_DoubleU type */
-
-static int get_cpudouble(QEMUFile *f, void *pv, size_t size,
-                         VMStateField *field)
-{
-    CPU_DoubleU *v = pv;
-    qemu_get_be32s(f, &v->l.upper);
-    qemu_get_be32s(f, &v->l.lower);
-    return 0;
-}
-
-static int put_cpudouble(QEMUFile *f, void *pv, size_t size,
-                         VMStateField *field, QJSON *vmdesc)
-{
-    CPU_DoubleU *v = pv;
-    qemu_put_be32s(f, &v->l.upper);
-    qemu_put_be32s(f, &v->l.lower);
-    return 0;
-}
-
-const VMStateInfo vmstate_info_cpudouble = {
-    .name = "CPU_Double_U",
-    .get  = get_cpudouble,
-    .put  = put_cpudouble,
-};
-
-/* uint8_t buffers */
-
-static int get_buffer(QEMUFile *f, void *pv, size_t size,
-                      VMStateField *field)
-{
-    uint8_t *v = pv;
-    qemu_get_buffer(f, v, size);
-    return 0;
-}
-
-static int put_buffer(QEMUFile *f, void *pv, size_t size, VMStateField *field,
-                      QJSON *vmdesc)
-{
-    uint8_t *v = pv;
-    qemu_put_buffer(f, v, size);
-    return 0;
-}
-
-const VMStateInfo vmstate_info_buffer = {
-    .name = "buffer",
-    .get  = get_buffer,
-    .put  = put_buffer,
-};
-
-/* unused buffers: space that was used for some fields that are
-   not useful anymore */
-
-static int get_unused_buffer(QEMUFile *f, void *pv, size_t size,
-                             VMStateField *field)
-{
-    uint8_t buf[1024];
-    int block_len;
-
-    while (size > 0) {
-        block_len = MIN(sizeof(buf), size);
-        size -= block_len;
-        qemu_get_buffer(f, buf, block_len);
-    }
-   return 0;
-}
-
-static int put_unused_buffer(QEMUFile *f, void *pv, size_t size,
-                             VMStateField *field, QJSON *vmdesc)
-{
-    static const uint8_t buf[1024];
-    int block_len;
-
-    while (size > 0) {
-        block_len = MIN(sizeof(buf), size);
-        size -= block_len;
-        qemu_put_buffer(f, buf, block_len);
-    }
-
-    return 0;
-}
-
-const VMStateInfo vmstate_info_unused_buffer = {
-    .name = "unused_buffer",
-    .get  = get_unused_buffer,
-    .put  = put_unused_buffer,
-};
-
-/* vmstate_info_tmp, see VMSTATE_WITH_TMP, the idea is that we allocate
- * a temporary buffer and the pre_load/pre_save methods in the child vmsd
- * copy stuff from the parent into the child and do calculations to fill
- * in fields that don't really exist in the parent but need to be in the
- * stream.
- */
-static int get_tmp(QEMUFile *f, void *pv, size_t size, VMStateField *field)
-{
-    int ret;
-    const VMStateDescription *vmsd = field->vmsd;
-    int version_id = field->version_id;
-    void *tmp = g_malloc(size);
-
-    /* Writes the parent field which is at the start of the tmp */
-    *(void **)tmp = pv;
-    ret = vmstate_load_state(f, vmsd, tmp, version_id);
-    g_free(tmp);
-    return ret;
-}
-
-static int put_tmp(QEMUFile *f, void *pv, size_t size, VMStateField *field,
-                    QJSON *vmdesc)
-{
-    const VMStateDescription *vmsd = field->vmsd;
-    void *tmp = g_malloc(size);
-
-    /* Writes the parent field which is at the start of the tmp */
-    *(void **)tmp = pv;
-    vmstate_save_state(f, vmsd, tmp, vmdesc);
-    g_free(tmp);
-
-    return 0;
-}
-
-const VMStateInfo vmstate_info_tmp = {
-    .name = "tmp",
-    .get = get_tmp,
-    .put = put_tmp,
-};
-
-/* bitmaps (as defined by bitmap.h). Note that size here is the size
- * of the bitmap in bits. The on-the-wire format of a bitmap is 64
- * bit words with the bits in big endian order. The in-memory format
- * is an array of 'unsigned long', which may be either 32 or 64 bits.
- */
-/* This is the number of 64 bit words sent over the wire */
-#define BITS_TO_U64S(nr) DIV_ROUND_UP(nr, 64)
-static int get_bitmap(QEMUFile *f, void *pv, size_t size, VMStateField *field)
-{
-    unsigned long *bmp = pv;
-    int i, idx = 0;
-    for (i = 0; i < BITS_TO_U64S(size); i++) {
-        uint64_t w = qemu_get_be64(f);
-        bmp[idx++] = w;
-        if (sizeof(unsigned long) == 4 && idx < BITS_TO_LONGS(size)) {
-            bmp[idx++] = w >> 32;
-        }
-    }
-    return 0;
-}
-
-static int put_bitmap(QEMUFile *f, void *pv, size_t size, VMStateField *field,
-                      QJSON *vmdesc)
-{
-    unsigned long *bmp = pv;
-    int i, idx = 0;
-    for (i = 0; i < BITS_TO_U64S(size); i++) {
-        uint64_t w = bmp[idx++];
-        if (sizeof(unsigned long) == 4 && idx < BITS_TO_LONGS(size)) {
-            w |= ((uint64_t)bmp[idx++]) << 32;
-        }
-        qemu_put_be64(f, w);
-    }
-
-    return 0;
-}
-
-const VMStateInfo vmstate_info_bitmap = {
-    .name = "bitmap",
-    .get = get_bitmap,
-    .put = put_bitmap,
-};
-
-/* get for QTAILQ
- * meta data about the QTAILQ is encoded in a VMStateField structure
- */
-static int get_qtailq(QEMUFile *f, void *pv, size_t unused_size,
-                      VMStateField *field)
-{
-    int ret = 0;
-    const VMStateDescription *vmsd = field->vmsd;
-    /* size of a QTAILQ element */
-    size_t size = field->size;
-    /* offset of the QTAILQ entry in a QTAILQ element */
-    size_t entry_offset = field->start;
-    int version_id = field->version_id;
-    void *elm;
-
-    trace_get_qtailq(vmsd->name, version_id);
-    if (version_id > vmsd->version_id) {
-        error_report("%s %s",  vmsd->name, "too new");
-        trace_get_qtailq_end(vmsd->name, "too new", -EINVAL);
-
-        return -EINVAL;
-    }
-    if (version_id < vmsd->minimum_version_id) {
-        error_report("%s %s",  vmsd->name, "too old");
-        trace_get_qtailq_end(vmsd->name, "too old", -EINVAL);
-        return -EINVAL;
-    }
-
-    while (qemu_get_byte(f)) {
-        elm = g_malloc(size);
-        ret = vmstate_load_state(f, vmsd, elm, version_id);
-        if (ret) {
-            return ret;
-        }
-        QTAILQ_RAW_INSERT_TAIL(pv, elm, entry_offset);
-    }
-
-    trace_get_qtailq_end(vmsd->name, "end", ret);
-    return ret;
-}
-
-/* put for QTAILQ */
-static int put_qtailq(QEMUFile *f, void *pv, size_t unused_size,
-                      VMStateField *field, QJSON *vmdesc)
-{
-    const VMStateDescription *vmsd = field->vmsd;
-    /* offset of the QTAILQ entry in a QTAILQ element*/
-    size_t entry_offset = field->start;
-    void *elm;
-
-    trace_put_qtailq(vmsd->name, vmsd->version_id);
-
-    QTAILQ_RAW_FOREACH(elm, pv, entry_offset) {
-        qemu_put_byte(f, true);
-        vmstate_save_state(f, vmsd, elm, vmdesc);
-    }
-    qemu_put_byte(f, false);
-
-    trace_put_qtailq_end(vmsd->name, "end");
-
-    return 0;
-}
-const VMStateInfo vmstate_info_qtailq = {
-    .name = "qtailq",
-    .get  = get_qtailq,
-    .put  = put_qtailq,
-};
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 0f98c04..7eaf586 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -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)
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 12/41] migration: Remove qemu-file.h from vmstate.h
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (10 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 11/41] migration: Split vmstate-types.c from vmstate.c Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 13/41] migration: Remove vmstate.h from migration.h Juan Quintela
                   ` (29 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

--

minor rearangements due to the rebase

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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(-)

diff --git a/include/hw/hw.h b/include/hw/hw.h
index e22d4ce..af9eae1 100644
--- a/include/hw/hw.h
+++ b/include/hw/hw.h
@@ -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"
 
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 4396d7e..e9f5bc8 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -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);
diff --git a/migration/block.c b/migration/block.c
index fcfa823..d2923b3 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -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)
diff --git a/migration/colo.c b/migration/colo.c
index 31ab23f..94cdb89 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -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"
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index cdadaf6..019e031 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -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"
diff --git a/migration/ram.c b/migration/ram.c
index 5fcf593..8e1c136 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -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"
diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c
index 1c13570..25389bc 100644
--- a/tests/test-vmstate.c
+++ b/tests/test-vmstate.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 13/41] migration: Remove vmstate.h from migration.h
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (11 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 12/41] migration: Remove qemu-file.h from vmstate.h Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-05-13 20:47   ` Philippe Mathieu-Daudé
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 14/41] migration: migration.h was not needed Juan Quintela
                   ` (28 subsequent siblings)
  41 siblings, 1 reply; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

--

Minor rearrangements due to rebase

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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(-)

diff --git a/include/migration/migration.h b/include/migration/migration.h
index d465624..22578db 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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"
diff --git a/migration/block.c b/migration/block.c
index d2923b3..c919787 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -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)
diff --git a/migration/colo-comm.c b/migration/colo-comm.c
index 9b35027..b4288b8 100644
--- a/migration/colo-comm.c
+++ b/migration/colo-comm.c
@@ -13,6 +13,7 @@
 
 #include "qemu/osdep.h"
 #include "migration/migration.h"
+#include "migration/vmstate.h"
 #include "colo.h"
 #include "trace.h"
 
diff --git a/migration/migration.c b/migration/migration.c
index fef1f0a..4668236 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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"
diff --git a/migration/ram.c b/migration/ram.c
index 8e1c136..c431ef9 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 14/41] migration: migration.h was not needed
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (12 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 13/41] migration: Remove vmstate.h from migration.h Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 15/41] migration: Create include for migration snapshots Juan Quintela
                   ` (27 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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(-)

diff --git a/block/qed.c b/block/qed.c
index 5ec7fd8..0d2f3bf 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -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 = {
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index dd792a8..76b08f8 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -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
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 9334a8a..ebc8ccf 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -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>
diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index b481562..49e0022 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -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"
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 03592c5..2d2b6bf 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -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"
 
diff --git a/monitor.c b/monitor.c
index d02900d..ec5ad1f 100644
--- a/monitor.c
+++ b/monitor.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 15/41] migration: Create include for migration snapshots
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (13 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 14/41] migration: migration.h was not needed Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 16/41] migration: Rename {save, load}_vmstate to {save, load}_snapshot Juan Quintela
                   ` (26 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Start removing migration code from sysemu/sysemu.h.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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

diff --git a/hmp.c b/hmp.c
index d81f71e..235cc2a 100644
--- a/hmp.c
+++ b/hmp.c
@@ -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>
diff --git a/include/migration/snapshot.h b/include/migration/snapshot.h
new file mode 100644
index 0000000..a390fea
--- /dev/null
+++ b/include/migration/snapshot.h
@@ -0,0 +1,20 @@
+/*
+ * QEMU save vm functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * 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
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 3340202..0d496d3 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -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 */
diff --git a/migration/savevm.c b/migration/savevm.c
index 1b2a83c..2f76a8a 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -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"
diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c
index fdc4353..86ae8dd 100644
--- a/replay/replay-snapshot.c
+++ b/replay/replay-snapshot.c
@@ -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)
 {
diff --git a/vl.c b/vl.c
index 8b3ec2e..53a9d19 100644
--- a/vl.c
+++ b/vl.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 16/41] migration: Rename {save, load}_vmstate to {save, load}_snapshot
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (14 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 15/41] migration: Create include for migration snapshots Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 17/41] migration: Create savevm.h for functions exported from savevm.c Juan Quintela
                   ` (25 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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(-)

diff --git a/hmp.c b/hmp.c
index 235cc2a..73f97bb 100644
--- a/hmp.c
+++ b/hmp.c
@@ -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);
 }
 
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 4f8cd29..fa74559 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -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;
 
diff --git a/include/migration/snapshot.h b/include/migration/snapshot.h
index a390fea..f04bd79 100644
--- a/include/migration/snapshot.h
+++ b/include/migration/snapshot.h
@@ -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
diff --git a/migration/savevm.c b/migration/savevm.c
index 2f76a8a..a6bc1f9 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -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;
diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c
index 86ae8dd..0522cd2 100644
--- a/replay/replay-snapshot.c
+++ b/replay/replay-snapshot.c
@@ -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);
             }
diff --git a/vl.c b/vl.c
index 53a9d19..5b79f5b 100644
--- a/vl.c
+++ b/vl.c
@@ -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;
         }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 17/41] migration: Create savevm.h for functions exported from savevm.c
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (15 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 16/41] migration: Rename {save, load}_vmstate to {save, load}_snapshot Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 18/41] migration: Split qemu-file.h Juan Quintela
                   ` (24 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 0d496d3..503b51f 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -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 {
diff --git a/migration/colo.c b/migration/colo.c
index 94cdb89..ff268bd 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -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"
diff --git a/migration/migration.c b/migration/migration.c
index 4668236..367b039 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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"
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 019e031..0b02755 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -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"
diff --git a/migration/savevm.c b/migration/savevm.c
index a6bc1f9..483eda1 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -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);
diff --git a/migration/savevm.h b/migration/savevm.h
new file mode 100644
index 0000000..f4c4bc9
--- /dev/null
+++ b/migration/savevm.h
@@ -0,0 +1,41 @@
+/*
+ * QEMU save vm functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef MIGRATION_SAVEVM_H
+#define MIGRATION_SAVEVM_H
+
+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_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);
+
+#endif
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 18/41] migration: Split qemu-file.h
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (16 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 17/41] migration: Create savevm.h for functions exported from savevm.c Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 19/41] migration: Remove unneeded includes of migration/vmstate.h Juan Quintela
                   ` (23 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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%)

diff --git a/hw/i2c/i2c-ddc.c b/hw/i2c/i2c-ddc.c
index 66899d7..6b92e95 100644
--- a/hw/i2c/i2c-ddc.c
+++ b/hw/i2c/i2c-ddc.c
@@ -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"
diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c
index 711c114..a26e906 100644
--- a/hw/intc/s390_flic.c
+++ b/hw/intc/s390_flic.c
@@ -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"
diff --git a/hw/intc/s390_flic_kvm.c b/hw/intc/s390_flic_kvm.c
index cc44bc4..b4c61d8 100644
--- a/hw/intc/s390_flic_kvm.c
+++ b/hw/intc/s390_flic_kvm.c
@@ -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"
diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c
index e2d4e1a..619152c 100644
--- a/hw/s390x/s390-skeys.c
+++ b/hw/s390x/s390-skeys.c
@@ -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"
diff --git a/include/hw/hw.h b/include/hw/hw.h
index af9eae1..ab4950c 100644
--- a/include/hw/hw.h
+++ b/include/hw/hw.h
@@ -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"
 
diff --git a/include/migration/qemu-file-types.h b/include/migration/qemu-file-types.h
new file mode 100644
index 0000000..5a82c5d
--- /dev/null
+++ b/include/migration/qemu-file-types.h
@@ -0,0 +1,164 @@
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#ifndef QEMU_FILE_H
+#define QEMU_FILE_H
+
+void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, size_t size);
+void qemu_put_byte(QEMUFile *f, int v);
+
+#define qemu_put_sbyte qemu_put_byte
+
+void qemu_put_be16(QEMUFile *f, unsigned int v);
+void qemu_put_be32(QEMUFile *f, unsigned int v);
+void qemu_put_be64(QEMUFile *f, uint64_t v);
+size_t qemu_get_buffer(QEMUFile *f, uint8_t *buf, size_t size);
+
+int qemu_get_byte(QEMUFile *f);
+
+static inline unsigned int qemu_get_ubyte(QEMUFile *f)
+{
+    return (unsigned int)qemu_get_byte(f);
+}
+
+#define qemu_get_sbyte qemu_get_byte
+
+unsigned int qemu_get_be16(QEMUFile *f);
+unsigned int qemu_get_be32(QEMUFile *f);
+uint64_t qemu_get_be64(QEMUFile *f);
+
+static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv)
+{
+    qemu_put_be64(f, *pv);
+}
+
+static inline void qemu_put_be32s(QEMUFile *f, const uint32_t *pv)
+{
+    qemu_put_be32(f, *pv);
+}
+
+static inline void qemu_put_be16s(QEMUFile *f, const uint16_t *pv)
+{
+    qemu_put_be16(f, *pv);
+}
+
+static inline void qemu_put_8s(QEMUFile *f, const uint8_t *pv)
+{
+    qemu_put_byte(f, *pv);
+}
+
+static inline void qemu_get_be64s(QEMUFile *f, uint64_t *pv)
+{
+    *pv = qemu_get_be64(f);
+}
+
+static inline void qemu_get_be32s(QEMUFile *f, uint32_t *pv)
+{
+    *pv = qemu_get_be32(f);
+}
+
+static inline void qemu_get_be16s(QEMUFile *f, uint16_t *pv)
+{
+    *pv = qemu_get_be16(f);
+}
+
+static inline void qemu_get_8s(QEMUFile *f, uint8_t *pv)
+{
+    *pv = qemu_get_byte(f);
+}
+
+// Signed versions for type safety
+static inline void qemu_put_sbe16(QEMUFile *f, int v)
+{
+    qemu_put_be16(f, (unsigned int)v);
+}
+
+static inline void qemu_put_sbe32(QEMUFile *f, int v)
+{
+    qemu_put_be32(f, (unsigned int)v);
+}
+
+static inline void qemu_put_sbe64(QEMUFile *f, int64_t v)
+{
+    qemu_put_be64(f, (uint64_t)v);
+}
+
+static inline int qemu_get_sbe16(QEMUFile *f)
+{
+    return (int)qemu_get_be16(f);
+}
+
+static inline int qemu_get_sbe32(QEMUFile *f)
+{
+    return (int)qemu_get_be32(f);
+}
+
+static inline int64_t qemu_get_sbe64(QEMUFile *f)
+{
+    return (int64_t)qemu_get_be64(f);
+}
+
+static inline void qemu_put_s8s(QEMUFile *f, const int8_t *pv)
+{
+    qemu_put_8s(f, (const uint8_t *)pv);
+}
+
+static inline void qemu_put_sbe16s(QEMUFile *f, const int16_t *pv)
+{
+    qemu_put_be16s(f, (const uint16_t *)pv);
+}
+
+static inline void qemu_put_sbe32s(QEMUFile *f, const int32_t *pv)
+{
+    qemu_put_be32s(f, (const uint32_t *)pv);
+}
+
+static inline void qemu_put_sbe64s(QEMUFile *f, const int64_t *pv)
+{
+    qemu_put_be64s(f, (const uint64_t *)pv);
+}
+
+static inline void qemu_get_s8s(QEMUFile *f, int8_t *pv)
+{
+    qemu_get_8s(f, (uint8_t *)pv);
+}
+
+static inline void qemu_get_sbe16s(QEMUFile *f, int16_t *pv)
+{
+    qemu_get_be16s(f, (uint16_t *)pv);
+}
+
+static inline void qemu_get_sbe32s(QEMUFile *f, int32_t *pv)
+{
+    qemu_get_be32s(f, (uint32_t *)pv);
+}
+
+static inline void qemu_get_sbe64s(QEMUFile *f, int64_t *pv)
+{
+    qemu_get_be64s(f, (uint64_t *)pv);
+}
+
+int qemu_file_rate_limit(QEMUFile *f);
+
+#endif
diff --git a/migration/block.c b/migration/block.c
index c919787..c26bdb2 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -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"
 
diff --git a/migration/colo.c b/migration/colo.c
index ff268bd..3757ad9 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -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"
diff --git a/migration/migration.c b/migration/migration.c
index 367b039..f300b5e 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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"
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 0b02755..07fbc25 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -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"
diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c
index dc991c9..e202d73 100644
--- a/migration/qemu-file-channel.c
+++ b/migration/qemu-file-channel.c
@@ -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"
 
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index 195fa94..ab26f4e 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -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
diff --git a/include/migration/qemu-file.h b/migration/qemu-file.h
similarity index 62%
rename from include/migration/qemu-file.h
rename to migration/qemu-file.h
index b5ac800..49fd697 100644
--- a/include/migration/qemu-file.h
+++ b/migration/qemu-file.h
@@ -22,11 +22,8 @@
  * THE SOFTWARE.
  */
 
-#ifndef QEMU_FILE_H
-#define QEMU_FILE_H
-
-#include "qemu-common.h"
-#include "exec/cpu-common.h"
+#ifndef MIGRATION_QEMU_FILE_H
+#define MIGRATION_QEMU_FILE_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
@@ -122,8 +119,6 @@ int qemu_get_fd(QEMUFile *f);
 int qemu_fclose(QEMUFile *f);
 int64_t qemu_ftell(QEMUFile *f);
 int64_t qemu_ftell_fast(QEMUFile *f);
-void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, size_t size);
-void qemu_put_byte(QEMUFile *f, int v);
 /*
  * put_buffer without copying the buffer.
  * The buffer should be available till it is sent asynchronously.
@@ -133,19 +128,9 @@ void qemu_put_buffer_async(QEMUFile *f, const uint8_t *buf, size_t size,
 bool qemu_file_mode_is_not_valid(const char *mode);
 bool qemu_file_is_writable(QEMUFile *f);
 
+#include "migration/qemu-file-types.h"
 
-static inline void qemu_put_ubyte(QEMUFile *f, unsigned int v)
-{
-    qemu_put_byte(f, (int)v);
-}
-
-#define qemu_put_sbyte qemu_put_byte
-
-void qemu_put_be16(QEMUFile *f, unsigned int v);
-void qemu_put_be32(QEMUFile *f, unsigned int v);
-void qemu_put_be64(QEMUFile *f, uint64_t v);
 size_t qemu_peek_buffer(QEMUFile *f, uint8_t **buf, size_t size, size_t offset);
-size_t qemu_get_buffer(QEMUFile *f, uint8_t *buf, size_t size);
 size_t qemu_get_buffer_in_place(QEMUFile *f, uint8_t **buf, size_t size);
 ssize_t qemu_put_compression_data(QEMUFile *f, const uint8_t *p, size_t size,
                                   int level);
@@ -157,22 +142,8 @@ int qemu_put_qemu_file(QEMUFile *f_des, QEMUFile *f_src);
  * previously peeked +n-1.
  */
 int qemu_peek_byte(QEMUFile *f, int offset);
-int qemu_get_byte(QEMUFile *f);
 void qemu_file_skip(QEMUFile *f, int size);
 void qemu_update_position(QEMUFile *f, size_t size);
-
-static inline unsigned int qemu_get_ubyte(QEMUFile *f)
-{
-    return (unsigned int)qemu_get_byte(f);
-}
-
-#define qemu_get_sbyte qemu_get_byte
-
-unsigned int qemu_get_be16(QEMUFile *f);
-unsigned int qemu_get_be32(QEMUFile *f);
-uint64_t qemu_get_be64(QEMUFile *f);
-
-int qemu_file_rate_limit(QEMUFile *f);
 void qemu_file_reset_rate_limit(QEMUFile *f);
 void qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate);
 int64_t qemu_file_get_rate_limit(QEMUFile *f);
@@ -183,127 +154,7 @@ QEMUFile *qemu_file_get_return_path(QEMUFile *f);
 void qemu_fflush(QEMUFile *f);
 void qemu_file_set_blocking(QEMUFile *f, bool block);
 
-static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv)
-{
-    qemu_put_be64(f, *pv);
-}
-
-static inline void qemu_put_be32s(QEMUFile *f, const uint32_t *pv)
-{
-    qemu_put_be32(f, *pv);
-}
-
-static inline void qemu_put_be16s(QEMUFile *f, const uint16_t *pv)
-{
-    qemu_put_be16(f, *pv);
-}
-
-static inline void qemu_put_8s(QEMUFile *f, const uint8_t *pv)
-{
-    qemu_put_byte(f, *pv);
-}
-
-static inline void qemu_get_be64s(QEMUFile *f, uint64_t *pv)
-{
-    *pv = qemu_get_be64(f);
-}
-
-static inline void qemu_get_be32s(QEMUFile *f, uint32_t *pv)
-{
-    *pv = qemu_get_be32(f);
-}
-
-static inline void qemu_get_be16s(QEMUFile *f, uint16_t *pv)
-{
-    *pv = qemu_get_be16(f);
-}
-
-static inline void qemu_get_8s(QEMUFile *f, uint8_t *pv)
-{
-    *pv = qemu_get_byte(f);
-}
-
-// Signed versions for type safety
-static inline void qemu_put_sbuffer(QEMUFile *f, const int8_t *buf, size_t size)
-{
-    qemu_put_buffer(f, (const uint8_t *)buf, size);
-}
-
-static inline void qemu_put_sbe16(QEMUFile *f, int v)
-{
-    qemu_put_be16(f, (unsigned int)v);
-}
-
-static inline void qemu_put_sbe32(QEMUFile *f, int v)
-{
-    qemu_put_be32(f, (unsigned int)v);
-}
-
-static inline void qemu_put_sbe64(QEMUFile *f, int64_t v)
-{
-    qemu_put_be64(f, (uint64_t)v);
-}
-
-static inline size_t qemu_get_sbuffer(QEMUFile *f, int8_t *buf, int size)
-{
-    return qemu_get_buffer(f, (uint8_t *)buf, size);
-}
-
-static inline int qemu_get_sbe16(QEMUFile *f)
-{
-    return (int)qemu_get_be16(f);
-}
-
-static inline int qemu_get_sbe32(QEMUFile *f)
-{
-    return (int)qemu_get_be32(f);
-}
-
-static inline int64_t qemu_get_sbe64(QEMUFile *f)
-{
-    return (int64_t)qemu_get_be64(f);
-}
-
-static inline void qemu_put_s8s(QEMUFile *f, const int8_t *pv)
-{
-    qemu_put_8s(f, (const uint8_t *)pv);
-}
-
-static inline void qemu_put_sbe16s(QEMUFile *f, const int16_t *pv)
-{
-    qemu_put_be16s(f, (const uint16_t *)pv);
-}
-
-static inline void qemu_put_sbe32s(QEMUFile *f, const int32_t *pv)
-{
-    qemu_put_be32s(f, (const uint32_t *)pv);
-}
-
-static inline void qemu_put_sbe64s(QEMUFile *f, const int64_t *pv)
-{
-    qemu_put_be64s(f, (const uint64_t *)pv);
-}
-
-static inline void qemu_get_s8s(QEMUFile *f, int8_t *pv)
-{
-    qemu_get_8s(f, (uint8_t *)pv);
-}
-
-static inline void qemu_get_sbe16s(QEMUFile *f, int16_t *pv)
-{
-    qemu_get_be16s(f, (uint16_t *)pv);
-}
-
-static inline void qemu_get_sbe32s(QEMUFile *f, int32_t *pv)
-{
-    qemu_get_be32s(f, (uint32_t *)pv);
-}
-
-static inline void qemu_get_sbe64s(QEMUFile *f, int64_t *pv)
-{
-    qemu_get_be64s(f, (uint64_t *)pv);
-}
-
 size_t qemu_get_counted_string(QEMUFile *f, char buf[256]);
 
+
 #endif
diff --git a/migration/ram.c b/migration/ram.c
index c431ef9..36afa98 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -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"
diff --git a/migration/rdma.c b/migration/rdma.c
index fffe2d6..2fda7a5 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -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"
diff --git a/migration/savevm.c b/migration/savevm.c
index 483eda1..d3e4d8e 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -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"
diff --git a/migration/socket.c b/migration/socket.c
index a49cf44..6ee69ed 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -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"
 
diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c
index 0cf14d4..c2bd334 100644
--- a/migration/vmstate-types.c
+++ b/migration/vmstate-types.c
@@ -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"
diff --git a/migration/vmstate.c b/migration/vmstate.c
index c284769..57dc34f 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -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"
diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c
index 25389bc..c52aff9 100644
--- a/tests/test-vmstate.c
+++ b/tests/test-vmstate.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 19/41] migration: Remove unneeded includes of migration/vmstate.h
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (17 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 18/41] migration: Split qemu-file.h Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-05-13 20:46   ` Philippe Mathieu-Daudé
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 20/41] migration: Export exec.c functions in its own file Juan Quintela
                   ` (22 subsequent siblings)
  41 siblings, 1 reply; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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(-)

diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 17ff638..23ccf9f 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -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;
diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h
index db8ebc9..77c6576 100644
--- a/include/hw/acpi/memory_hotplug.h
+++ b/include/hw/acpi/memory_hotplug.h
@@ -3,7 +3,6 @@
 
 #include "hw/qdev-core.h"
 #include "hw/acpi/acpi.h"
-#include "migration/vmstate.h"
 #include "hw/acpi/aml-build.h"
 
 /**
diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h
index 04528b7..8a65f99 100644
--- a/include/hw/acpi/pcihp.h
+++ b/include/hw/acpi/pcihp.h
@@ -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"
diff --git a/include/hw/pci/shpc.h b/include/hw/pci/shpc.h
index b208554..71e836b 100644
--- a/include/hw/pci/shpc.h
+++ b/include/hw/pci/shpc.h
@@ -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"
 
diff --git a/include/net/net.h b/include/net/net.h
index 99b28d5..ba663bd 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -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"
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
index b4f9798..8186c9d 100644
--- a/target/alpha/cpu.c
+++ b/target/alpha/cpu.c
@@ -23,7 +23,6 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu-common.h"
-#include "migration/vmstate.h"
 #include "exec/exec-all.h"
 
 
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index 1d791d0..30299e9 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -22,7 +22,6 @@
 #include "qapi/error.h"
 #include "cpu.h"
 #include "qemu-common.h"
-#include "migration/vmstate.h"
 #include "exec/exec-all.h"
 
 
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index 066dcd1..cfd3b70 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -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"
diff --git a/target/tilegx/cpu.c b/target/tilegx/cpu.c
index d90e38e..4532639 100644
--- a/target/tilegx/cpu.c
+++ b/target/tilegx/cpu.c
@@ -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"
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 20/41] migration: Export exec.c functions in its own file
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (18 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 19/41] migration: Remove unneeded includes of migration/vmstate.h Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 21/41] migration: Export fd.c " Juan Quintela
                   ` (21 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 22578db..3786f05 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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);
diff --git a/migration/exec.c b/migration/exec.c
index 405d0ab..c532c56 100644
--- a/migration/exec.c
+++ b/migration/exec.c
@@ -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"
diff --git a/migration/exec.h b/migration/exec.h
new file mode 100644
index 0000000..c97a7e9
--- /dev/null
+++ b/migration/exec.h
@@ -0,0 +1,20 @@
+/*
+ * QEMU live migration exec functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * 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
diff --git a/migration/migration.c b/migration/migration.c
index f300b5e..994f25f 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 21/41] migration: Export fd.c functions in its own file
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (19 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 20/41] migration: Export exec.c functions in its own file Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 22/41] migration: Export socket.c " Juan Quintela
                   ` (20 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 3786f05..fd7d40d 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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);
diff --git a/migration/fd.c b/migration/fd.c
index ccaa806..8a04dcd 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -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"
diff --git a/migration/fd.h b/migration/fd.h
new file mode 100644
index 0000000..4ec3298
--- /dev/null
+++ b/migration/fd.h
@@ -0,0 +1,20 @@
+/*
+ * QEMU live migration fd functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * 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
diff --git a/migration/migration.c b/migration/migration.c
index 994f25f..ca5a576 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 22/41] migration: Export socket.c functions in its own file
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (20 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 21/41] migration: Export fd.c " Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 23/41] migration: Export tls.c " Juan Quintela
                   ` (19 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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

diff --git a/include/migration/migration.h b/include/migration/migration.h
index fd7d40d..18ec906 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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);
diff --git a/migration/migration.c b/migration/migration.c
index ca5a576..f349a8c 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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"
diff --git a/migration/socket.c b/migration/socket.c
index 6ee69ed..acb3f0d 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -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"
diff --git a/migration/socket.h b/migration/socket.h
new file mode 100644
index 0000000..800fde1
--- /dev/null
+++ b/migration/socket.h
@@ -0,0 +1,25 @@
+/*
+ * QEMU live migration socket functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * 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
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 23/41] migration: Export tls.c functions in its own file
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (21 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 22/41] migration: Export socket.c " Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 24/41] migration: Export ram.c " Juan Quintela
                   ` (18 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 18ec906..08867c6 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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);
diff --git a/migration/channel.c b/migration/channel.c
index d9b51de..5a81a60 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -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"
diff --git a/migration/migration.c b/migration/migration.c
index f349a8c..175e5c9 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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 */
diff --git a/migration/tls.c b/migration/tls.c
index b4cb8fe..d3abd6e 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -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"
diff --git a/migration/tls.h b/migration/tls.h
new file mode 100644
index 0000000..1d63263
--- /dev/null
+++ b/migration/tls.h
@@ -0,0 +1,27 @@
+/*
+ * QEMU live migration tls functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * 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
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 24/41] migration: Export ram.c functions in its own file
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (22 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 23/41] migration: Export tls.c " Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 25/41] migration: Export rdma.c " Juan Quintela
                   ` (17 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 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

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 08867c6..38ba508 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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);
diff --git a/include/migration/misc.h b/include/migration/misc.h
new file mode 100644
index 0000000..0b37714
--- /dev/null
+++ b/include/migration/misc.h
@@ -0,0 +1,21 @@
+/*
+ * QEMU migration miscellaneus exported functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * 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
diff --git a/migration/migration.c b/migration/migration.c
index 175e5c9..ef966ca 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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"
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 07fbc25..3359224 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -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"
diff --git a/migration/ram.c b/migration/ram.c
index 36afa98..89637eb 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -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"
diff --git a/migration/ram.h b/migration/ram.h
new file mode 100644
index 0000000..1d9d6c4
--- /dev/null
+++ b/migration/ram.h
@@ -0,0 +1,55 @@
+/*
+ * QEMU migration ram
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * 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_RAM_H
+#define QEMU_MIGRATION_RAM_H
+
+#include "qemu-common.h"
+#include "exec/cpu-common.h"
+
+int64_t xbzrle_cache_resize(int64_t new_size);
+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_cache_miss(void);
+double xbzrle_mig_cache_miss_rate(void);
+uint64_t xbzrle_mig_pages_overflow(void);
+uint64_t ram_bytes_transferred(void);
+uint64_t ram_bytes_remaining(void);
+uint64_t ram_dirty_sync_count(void);
+uint64_t ram_dirty_pages_rate(void);
+uint64_t ram_postcopy_requests(void);
+uint64_t ram_bytes_total(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_pagesize_summary(void);
+void migration_page_queue_free(void);
+int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len);
+void acct_update_position(QEMUFile *f, size_t size, bool zero);
+void free_xbzrle_decoded_buf(void);
+void ram_debug_dump_bitmap(unsigned long *todump, bool expected,
+                           unsigned long pages);
+void ram_postcopy_migrated_memory_release(MigrationState *ms);
+/* 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_handle_compressed(void *host, uint8_t ch, uint64_t size);
+#endif
diff --git a/migration/rdma.c b/migration/rdma.c
index 2fda7a5..96a90dd 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -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"
diff --git a/migration/savevm.c b/migration/savevm.c
index d3e4d8e..a80bc83 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -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"
diff --git a/vl.c b/vl.c
index 5b79f5b..17c0297 100644
--- a/vl.c
+++ b/vl.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 25/41] migration: Export rdma.c functions in its own file
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (23 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 24/41] migration: Export ram.c " Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-27 11:52   ` Dr. David Alan Gilbert
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 26/41] migration: Move include/migration/block.h into migration/ Juan Quintela
                   ` (16 subsequent siblings)
  41 siblings, 1 reply; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 38ba508..9063c32 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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);
diff --git a/migration/migration.c b/migration/migration.c
index ef966ca..394930d 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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"
diff --git a/migration/rdma.c b/migration/rdma.c
index 96a90dd..f8fea9b 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -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"
diff --git a/migration/rdma.h b/migration/rdma.h
new file mode 100644
index 0000000..d2cf481
--- /dev/null
+++ b/migration/rdma.h
@@ -0,0 +1,22 @@
+/*
+ * QEMU migration rdma functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * 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
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 26/41] migration: Move include/migration/block.h into migration/
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (24 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 25/41] migration: Export rdma.c " Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 27/41] migration: Move self_announce_delay() to misc.h Juan Quintela
                   ` (15 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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%)

diff --git a/include/migration/misc.h b/include/migration/misc.h
index 0b37714..9e64c16 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -18,4 +18,8 @@
 
 void ram_mig_init(void);
 
+/* migration/block.c */
+
+void blk_mig_init(void);
+
 #endif
diff --git a/migration/block.c b/migration/block.c
index c26bdb2..d19dc15 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -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"
diff --git a/include/migration/block.h b/migration/block.h
similarity index 95%
rename from include/migration/block.h
rename to migration/block.h
index 41a1ac8..9f6febb 100644
--- a/include/migration/block.h
+++ b/migration/block.h
@@ -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);
diff --git a/migration/migration.c b/migration/migration.c
index 394930d..ff32086 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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"
diff --git a/vl.c b/vl.c
index 17c0297..605c98f 100644
--- a/vl.c
+++ b/vl.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 27/41] migration: Move self_announce_delay() to misc.h
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (25 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 26/41] migration: Move include/migration/block.h into migration/ Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 28/41] migration: Split registration functions from vmstate.h Juan Quintela
                   ` (14 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 7d091c9..2259156 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -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
 
diff --git a/include/migration/misc.h b/include/migration/misc.h
index 9e64c16..45ef9c9 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -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
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index e9f5bc8..655558d 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -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);
diff --git a/migration/savevm.c b/migration/savevm.c
index a80bc83..6aeebb8 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 28/41] migration: Split registration functions from vmstate.h
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (26 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 27/41] migration: Move self_announce_delay() to misc.h Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 29/41] migration: loadvm_free_handlers is only used in migration/ Juan Quintela
                   ` (13 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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

diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index 8b1fab2..21ac646 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -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"
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 35db949..4c4701e 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -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"
 
diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c
index 619152c..58f084a 100644
--- a/hw/s390x/s390-skeys.c
+++ b/hw/s390x/s390-skeys.c
@@ -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
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 04bd0eb..22716e1 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -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,
diff --git a/include/migration/register.h b/include/migration/register.h
new file mode 100644
index 0000000..844afaf
--- /dev/null
+++ b/include/migration/register.h
@@ -0,0 +1,64 @@
+/*
+ * QEMU migration vmstate registration
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef MIGRATION_REGISTER_H
+#define MIGRATION_REGISTER_H
+
+typedef void SaveStateHandler(QEMUFile *f, void *opaque);
+typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
+
+typedef struct SaveVMHandlers {
+    /* This runs inside the iothread lock.  */
+    SaveStateHandler *save_state;
+
+    void (*cleanup)(void *opaque);
+    int (*save_live_complete_postcopy)(QEMUFile *f, void *opaque);
+    int (*save_live_complete_precopy)(QEMUFile *f, void *opaque);
+
+    /* This runs both outside and inside the iothread lock.  */
+    bool (*is_active)(void *opaque);
+
+    /* This runs outside the iothread lock in the migration case, and
+     * within the lock in the savevm case.  The callback had better only
+     * use data that is local to the migration thread or protected
+     * by other locks.
+     */
+    int (*save_live_iterate)(QEMUFile *f, void *opaque);
+
+    /* This runs outside the iothread lock!  */
+    int (*save_live_setup)(QEMUFile *f, void *opaque);
+    void (*save_live_pending)(QEMUFile *f, void *opaque,
+                              uint64_t threshold_size,
+                              uint64_t *non_postcopiable_pending,
+                              uint64_t *postcopiable_pending);
+    LoadStateHandler *load_state;
+} SaveVMHandlers;
+
+int register_savevm(DeviceState *dev,
+                    const char *idstr,
+                    int instance_id,
+                    int version_id,
+                    SaveStateHandler *save_state,
+                    LoadStateHandler *load_state,
+                    void *opaque);
+
+int register_savevm_live(DeviceState *dev,
+                         const char *idstr,
+                         int instance_id,
+                         int version_id,
+                         SaveVMHandlers *ops,
+                         void *opaque);
+
+void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque);
+
+#endif
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 655558d..6b7031f 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -29,53 +29,8 @@
 
 #include "migration/qjson.h"
 
-typedef void SaveStateHandler(QEMUFile *f, void *opaque);
 typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
 
-typedef struct SaveVMHandlers {
-    /* This runs inside the iothread lock.  */
-    SaveStateHandler *save_state;
-
-    void (*cleanup)(void *opaque);
-    int (*save_live_complete_postcopy)(QEMUFile *f, void *opaque);
-    int (*save_live_complete_precopy)(QEMUFile *f, void *opaque);
-
-    /* This runs both outside and inside the iothread lock.  */
-    bool (*is_active)(void *opaque);
-
-    /* This runs outside the iothread lock in the migration case, and
-     * within the lock in the savevm case.  The callback had better only
-     * use data that is local to the migration thread or protected
-     * by other locks.
-     */
-    int (*save_live_iterate)(QEMUFile *f, void *opaque);
-
-    /* This runs outside the iothread lock!  */
-    int (*save_live_setup)(QEMUFile *f, void *opaque);
-    void (*save_live_pending)(QEMUFile *f, void *opaque,
-                              uint64_t threshold_size,
-                              uint64_t *non_postcopiable_pending,
-                              uint64_t *postcopiable_pending);
-    LoadStateHandler *load_state;
-} SaveVMHandlers;
-
-int register_savevm(DeviceState *dev,
-                    const char *idstr,
-                    int instance_id,
-                    int version_id,
-                    SaveStateHandler *save_state,
-                    LoadStateHandler *load_state,
-                    void *opaque);
-
-int register_savevm_live(DeviceState *dev,
-                         const char *idstr,
-                         int instance_id,
-                         int version_id,
-                         SaveVMHandlers *ops,
-                         void *opaque);
-
-void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque);
-
 typedef struct VMStateInfo VMStateInfo;
 typedef struct VMStateDescription VMStateDescription;
 typedef struct VMStateField VMStateField;
diff --git a/migration/block.c b/migration/block.c
index d19dc15..307f136 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -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"
diff --git a/migration/ram.c b/migration/ram.c
index 89637eb..b6cef70 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -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"
diff --git a/migration/savevm.c b/migration/savevm.c
index 6aeebb8..1caf8ee 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -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"
diff --git a/slirp/slirp.c b/slirp/slirp.c
index 9a50918..8f59a26 100644
--- a/slirp/slirp.c
+++ b/slirp/slirp.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 29/41] migration: loadvm_free_handlers is only used in migration/
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (27 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 28/41] migration: Split registration functions from vmstate.h Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 30/41] migration: Move dump_vmsate_json_to_file() to misc.h Juan Quintela
                   ` (12 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/vmstate.h | 2 --
 migration/savevm.h          | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 6b7031f..afa43ac 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -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,
diff --git a/migration/savevm.h b/migration/savevm.h
index f4c4bc9..75b2b8c 100644
--- a/migration/savevm.h
+++ b/migration/savevm.h
@@ -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
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 30/41] migration: Move dump_vmsate_json_to_file() to misc.h
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (28 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 29/41] migration: loadvm_free_handlers is only used in migration/ Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 31/41] migration: Move postcopy stuff to postcopy-ram.c Juan Quintela
                   ` (11 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

It was not from vmstate.c to start with.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/misc.h    | 4 ++++
 include/migration/vmstate.h | 2 --
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/migration/misc.h b/include/migration/misc.h
index 45ef9c9..21a9182 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -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
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index afa43ac..5811804 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -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
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 31/41] migration: Move postcopy stuff to postcopy-ram.c
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (29 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 30/41] migration: Move dump_vmsate_json_to_file() to misc.h Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-28 17:15   ` Dr. David Alan Gilbert
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 32/41] migration: Move constants to savevm.h Juan Quintela
                   ` (10 subsequent siblings)
  41 siblings, 1 reply; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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(-)

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 9063c32..5c27fe7 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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
diff --git a/migration/migration.c b/migration/migration.c
index ff32086..d2f3c5e 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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);
-}
-
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 3359224..cae5d48 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -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);
+}
diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h
index 4c25f03..52d51e8 100644
--- a/migration/postcopy-ram.h
+++ b/migration/postcopy-ram.h
@@ -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
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 32/41] migration: Move constants to savevm.h
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (30 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 31/41] migration: Move postcopy stuff to postcopy-ram.c Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 33/41] migration: Commands are only used inside migration.c Juan Quintela
                   ` (9 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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(-)

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 5c27fe7..ac6e545 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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;
 
diff --git a/migration/savevm.h b/migration/savevm.h
index 75b2b8c..b4c1f3c 100644
--- a/migration/savevm.h
+++ b/migration/savevm.h
@@ -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);
diff --git a/migration/vmstate.c b/migration/vmstate.c
index 57dc34f..4b0cb2f 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -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"
diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c
index c52aff9..f30433a 100644
--- a/tests/test-vmstate.c
+++ b/tests/test-vmstate.c
@@ -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"
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 33/41] migration: Commands are only used inside migration.c
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (31 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 32/41] migration: Move constants to savevm.h Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 34/41] migration: ram_control_* are implemented in qemu_file Juan Quintela
                   ` (8 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/migration.h | 15 --------------
 migration/migration.c         | 46 +++++++++++++++++++++++++++----------------
 2 files changed, 29 insertions(+), 32 deletions(-)

diff --git a/include/migration/migration.h b/include/migration/migration.h
index ac6e545..9884be6 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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,
diff --git a/migration/migration.c b/migration/migration.c
index d2f3c5e..6e43ae3 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -85,6 +85,18 @@ static NotifierList migration_state_notifiers =
 
 static bool deferred_incoming;
 
+/* 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
+};
+
 /* When we add fault tolerance, we could have several
    migrations at once.  For now we don't need to add
    dynamic creation of migration */
@@ -281,6 +293,23 @@ static void deferred_incoming_migration(Error **errp)
     deferred_incoming = true;
 }
 
+/*
+ * Send a message on the return channel back to the source
+ * of the migration.
+ */
+static void migrate_send_rp_message(MigrationIncomingState *mis,
+                                    enum mig_rp_message_type message_type,
+                                    uint16_t len, void *data)
+{
+    trace_migrate_send_rp_message((int)message_type, len);
+    qemu_mutex_lock(&mis->rp_mutex);
+    qemu_put_be16(mis->to_src_file, (unsigned int)message_type);
+    qemu_put_be16(mis->to_src_file, len);
+    qemu_put_buffer(mis->to_src_file, data, len);
+    qemu_fflush(mis->to_src_file);
+    qemu_mutex_unlock(&mis->rp_mutex);
+}
+
 /* Request a range of pages from the source VM at the given
  * start address.
  *   rbname: Name of the RAMBlock to request the page in, if NULL it's the same
@@ -461,23 +490,6 @@ void migration_fd_process_incoming(QEMUFile *f)
 }
 
 /*
- * Send a message on the return channel back to the source
- * of the migration.
- */
-void migrate_send_rp_message(MigrationIncomingState *mis,
-                             enum mig_rp_message_type message_type,
-                             uint16_t len, void *data)
-{
-    trace_migrate_send_rp_message((int)message_type, len);
-    qemu_mutex_lock(&mis->rp_mutex);
-    qemu_put_be16(mis->to_src_file, (unsigned int)message_type);
-    qemu_put_be16(mis->to_src_file, len);
-    qemu_put_buffer(mis->to_src_file, data, len);
-    qemu_fflush(mis->to_src_file);
-    qemu_mutex_unlock(&mis->rp_mutex);
-}
-
-/*
  * Send a 'SHUT' message on the return channel with the given value
  * to indicate that we've finished with the RP.  Non-0 value indicates
  * error.
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 34/41] migration: ram_control_* are implemented in qemu_file
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (32 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 33/41] migration: Commands are only used inside migration.c Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 35/41] migration: create global_state.c Juan Quintela
                   ` (7 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/migration.h | 18 ------------------
 migration/qemu-file.h         | 17 +++++++++++++++++
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 9884be6..7bd87f8 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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);
diff --git a/migration/qemu-file.h b/migration/qemu-file.h
index 49fd697..aae4e5e 100644
--- a/migration/qemu-file.h
+++ b/migration/qemu-file.h
@@ -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
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 35/41] migration: create global_state.c
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (33 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 34/41] migration: ram_control_* are implemented in qemu_file Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 36/41] migration: Move more exported functions to migration/misc.h Juan Quintela
                   ` (6 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 9f102aa..6c72bd3 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -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"
 
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 4c4701e..f779c35 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -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"
diff --git a/include/migration/global_state.h b/include/migration/global_state.h
new file mode 100644
index 0000000..84a19d0
--- /dev/null
+++ b/include/migration/global_state.h
@@ -0,0 +1,26 @@
+/*
+ * QEMU live migration
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * 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
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 7bd87f8..fc31f8e 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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
diff --git a/migration/Makefile.objs b/migration/Makefile.objs
index 812b2ec..775e4ad 100644
--- a/migration/Makefile.objs
+++ b/migration/Makefile.objs
@@ -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
diff --git a/migration/global_state.c b/migration/global_state.c
new file mode 100644
index 0000000..3d67ba2
--- /dev/null
+++ b/migration/global_state.c
@@ -0,0 +1,143 @@
+/*
+ * QEMU live migration global state
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ * Contributions after 2012-01-13 are licensed under the terms of the
+ * GNU GPL, version 2 or (at your option) any later version.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/cutils.h"
+#include "qemu/error-report.h"
+#include "qapi/error.h"
+#include "qapi/util.h"
+#include "migration/global_state.h"
+#include "migration/vmstate.h"
+#include "sysemu/sysemu.h"
+#include "trace.h"
+
+typedef struct {
+    bool optional;
+    uint32_t size;
+    uint8_t runstate[100];
+    RunState state;
+    bool received;
+} GlobalState;
+
+static GlobalState global_state;
+
+int global_state_store(void)
+{
+    if (!runstate_store((char *)global_state.runstate,
+                        sizeof(global_state.runstate))) {
+        error_report("runstate name too big: %s", global_state.runstate);
+        trace_migrate_state_too_big();
+        return -EINVAL;
+    }
+    return 0;
+}
+
+void global_state_store_running(void)
+{
+    const char *state = RunState_lookup[RUN_STATE_RUNNING];
+    strncpy((char *)global_state.runstate,
+           state, sizeof(global_state.runstate));
+}
+
+bool global_state_received(void)
+{
+    return global_state.received;
+}
+
+RunState global_state_get_runstate(void)
+{
+    return global_state.state;
+}
+
+void global_state_set_optional(void)
+{
+    global_state.optional = true;
+}
+
+static bool global_state_needed(void *opaque)
+{
+    GlobalState *s = opaque;
+    char *runstate = (char *)s->runstate;
+
+    /* If it is not optional, it is mandatory */
+
+    if (s->optional == false) {
+        return true;
+    }
+
+    /* If state is running or paused, it is not needed */
+
+    if (strcmp(runstate, "running") == 0 ||
+        strcmp(runstate, "paused") == 0) {
+        return false;
+    }
+
+    /* for any other state it is needed */
+    return true;
+}
+
+static int global_state_post_load(void *opaque, int version_id)
+{
+    GlobalState *s = opaque;
+    Error *local_err = NULL;
+    int r;
+    char *runstate = (char *)s->runstate;
+
+    s->received = true;
+    trace_migrate_global_state_post_load(runstate);
+
+    r = qapi_enum_parse(RunState_lookup, runstate, RUN_STATE__MAX,
+                                -1, &local_err);
+
+    if (r == -1) {
+        if (local_err) {
+            error_report_err(local_err);
+        }
+        return -EINVAL;
+    }
+    s->state = r;
+
+    return 0;
+}
+
+static void global_state_pre_save(void *opaque)
+{
+    GlobalState *s = opaque;
+
+    trace_migrate_global_state_pre_save((char *)s->runstate);
+    s->size = strlen((char *)s->runstate) + 1;
+}
+
+static const VMStateDescription vmstate_globalstate = {
+    .name = "globalstate",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .post_load = global_state_post_load,
+    .pre_save = global_state_pre_save,
+    .needed = global_state_needed,
+    .fields = (VMStateField[]) {
+        VMSTATE_UINT32(size, GlobalState),
+        VMSTATE_BUFFER(runstate, GlobalState),
+        VMSTATE_END_OF_LIST()
+    },
+};
+
+void register_global_state(void)
+{
+    /* We would use it independently that we receive it */
+    strcpy((char *)&global_state.runstate, "");
+    global_state.received = false;
+    vmstate_register(NULL, 0, &vmstate_globalstate, &global_state);
+}
diff --git a/migration/migration.c b/migration/migration.c
index 6e43ae3..4cda97c 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -23,6 +23,7 @@
 #include "socket.h"
 #include "ram.h"
 #include "rdma.h"
+#include "migration/global_state.h"
 #include "migration/migration.h"
 #include "savevm.h"
 #include "qemu-file-channel.h"
@@ -153,126 +154,6 @@ void migration_incoming_state_destroy(void)
     loadvm_free_handlers(mis);
 }
 
-
-typedef struct {
-    bool optional;
-    uint32_t size;
-    uint8_t runstate[100];
-    RunState state;
-    bool received;
-} GlobalState;
-
-static GlobalState global_state;
-
-int global_state_store(void)
-{
-    if (!runstate_store((char *)global_state.runstate,
-                        sizeof(global_state.runstate))) {
-        error_report("runstate name too big: %s", global_state.runstate);
-        trace_migrate_state_too_big();
-        return -EINVAL;
-    }
-    return 0;
-}
-
-void global_state_store_running(void)
-{
-    const char *state = RunState_lookup[RUN_STATE_RUNNING];
-    strncpy((char *)global_state.runstate,
-           state, sizeof(global_state.runstate));
-}
-
-static bool global_state_received(void)
-{
-    return global_state.received;
-}
-
-static RunState global_state_get_runstate(void)
-{
-    return global_state.state;
-}
-
-void global_state_set_optional(void)
-{
-    global_state.optional = true;
-}
-
-static bool global_state_needed(void *opaque)
-{
-    GlobalState *s = opaque;
-    char *runstate = (char *)s->runstate;
-
-    /* If it is not optional, it is mandatory */
-
-    if (s->optional == false) {
-        return true;
-    }
-
-    /* If state is running or paused, it is not needed */
-
-    if (strcmp(runstate, "running") == 0 ||
-        strcmp(runstate, "paused") == 0) {
-        return false;
-    }
-
-    /* for any other state it is needed */
-    return true;
-}
-
-static int global_state_post_load(void *opaque, int version_id)
-{
-    GlobalState *s = opaque;
-    Error *local_err = NULL;
-    int r;
-    char *runstate = (char *)s->runstate;
-
-    s->received = true;
-    trace_migrate_global_state_post_load(runstate);
-
-    r = qapi_enum_parse(RunState_lookup, runstate, RUN_STATE__MAX,
-                                -1, &local_err);
-
-    if (r == -1) {
-        if (local_err) {
-            error_report_err(local_err);
-        }
-        return -EINVAL;
-    }
-    s->state = r;
-
-    return 0;
-}
-
-static void global_state_pre_save(void *opaque)
-{
-    GlobalState *s = opaque;
-
-    trace_migrate_global_state_pre_save((char *)s->runstate);
-    s->size = strlen((char *)s->runstate) + 1;
-}
-
-static const VMStateDescription vmstate_globalstate = {
-    .name = "globalstate",
-    .version_id = 1,
-    .minimum_version_id = 1,
-    .post_load = global_state_post_load,
-    .pre_save = global_state_pre_save,
-    .needed = global_state_needed,
-    .fields = (VMStateField[]) {
-        VMSTATE_UINT32(size, GlobalState),
-        VMSTATE_BUFFER(runstate, GlobalState),
-        VMSTATE_END_OF_LIST()
-    },
-};
-
-void register_global_state(void)
-{
-    /* We would use it independently that we receive it */
-    strcpy((char *)&global_state.runstate, "");
-    global_state.received = false;
-    vmstate_register(NULL, 0, &vmstate_globalstate, &global_state);
-}
-
 static void migrate_generate_event(int new_state)
 {
     if (migrate_use_events()) {
diff --git a/migration/savevm.c b/migration/savevm.c
index 1caf8ee..e7c05f3 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -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"
diff --git a/vl.c b/vl.c
index 605c98f..c0796e4 100644
--- a/vl.c
+++ b/vl.c
@@ -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"
diff --git a/xen-common.c b/xen-common.c
index fd2c928..172131a 100644
--- a/xen-common.c
+++ b/xen-common.c
@@ -14,6 +14,7 @@
 #include "sysemu/char.h"
 #include "sysemu/accel.h"
 #include "migration/migration.h"
+#include "migration/global_state.h"
 
 //#define DEBUG_XEN
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 36/41] migration: Move more exported functions to migration/misc.h
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (34 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 35/41] migration: create global_state.c Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 37/41] migration: Move last funtions to misc.h Juan Quintela
                   ` (5 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 6c72bd3..d68859e 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -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
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index f779c35..74cea96 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -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"
diff --git a/include/migration/migration.h b/include/migration/migration.h
index fc31f8e..1e18b24 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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
diff --git a/include/migration/misc.h b/include/migration/misc.h
index 21a9182..6709b15 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -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
diff --git a/migration/migration.c b/migration/migration.c
index 4cda97c..287b762 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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"
diff --git a/qdev-monitor.c b/qdev-monitor.c
index e61d596..5ab468f 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -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
diff --git a/vl.c b/vl.c
index c0796e4..d506c7e 100644
--- a/vl.c
+++ b/vl.c
@@ -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"
diff --git a/xen-common.c b/xen-common.c
index 172131a..2daf2aa 100644
--- a/xen-common.c
+++ b/xen-common.c
@@ -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
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 37/41] migration: Move last funtions to misc.h
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (35 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 36/41] migration: Move more exported functions to migration/misc.h Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 38/41] migration: Move migration.h to migration/ Juan Quintela
                   ` (4 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

After this, nothing outside of migration uses migration.h

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/migration.h | 7 -------
 include/migration/misc.h      | 8 +++++++-
 ui/spice-core.c               | 2 +-
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 1e18b24..735f565 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -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);
diff --git a/include/migration/misc.h b/include/migration/misc.h
index 6709b15..28f69be 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -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
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 804abc5..a087ad5 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 38/41] migration: Move migration.h to migration/
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (36 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 37/41] migration: Move last funtions to misc.h Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 39/41] exec: Create include for target_page_size() Juan Quintela
                   ` (3 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Nothing uses it outside of migration.h

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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%)

diff --git a/migration/block.c b/migration/block.c
index 307f136..6457f25 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -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"
diff --git a/migration/channel.c b/migration/channel.c
index 5a81a60..633423c 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -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"
diff --git a/migration/colo-comm.c b/migration/colo-comm.c
index b4288b8..1acdb94 100644
--- a/migration/colo-comm.c
+++ b/migration/colo-comm.c
@@ -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"
diff --git a/migration/colo.c b/migration/colo.c
index 3757ad9..72001a5 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -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"
diff --git a/migration/exec.c b/migration/exec.c
index c532c56..074943a 100644
--- a/migration/exec.c
+++ b/migration/exec.c
@@ -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"
 
diff --git a/migration/fd.c b/migration/fd.c
index 8a04dcd..b2384bf 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -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"
diff --git a/migration/migration.c b/migration/migration.c
index 287b762..fccd779 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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"
diff --git a/include/migration/migration.h b/migration/migration.h
similarity index 100%
rename from include/migration/migration.h
rename to migration/migration.h
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index cae5d48..bd23971 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -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"
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index ab26f4e..e65c373 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -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"
 
diff --git a/migration/ram.c b/migration/ram.c
index b6cef70..14104f1 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -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"
diff --git a/migration/rdma.c b/migration/rdma.c
index f8fea9b..1d91266 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -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"
diff --git a/migration/savevm.c b/migration/savevm.c
index e7c05f3..03ff007 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -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"
diff --git a/migration/socket.c b/migration/socket.c
index acb3f0d..cc3d977 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -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"
diff --git a/migration/tls.c b/migration/tls.c
index d3abd6e..596e879 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -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"
diff --git a/migration/vmstate-types.c b/migration/vmstate-types.c
index c2bd334..0c92b23 100644
--- a/migration/vmstate-types.c
+++ b/migration/vmstate-types.c
@@ -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"
diff --git a/migration/vmstate.c b/migration/vmstate.c
index 4b0cb2f..ec9d0f89 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -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"
diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c
index f30433a..ee292c7 100644
--- a/tests/test-vmstate.c
+++ b/tests/test-vmstate.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 39/41] exec: Create include for target_page_size()
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (37 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 38/41] migration: Move migration.h to migration/ Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 40/41] migration: Make savevm.c target independent Juan Quintela
                   ` (2 subsequent siblings)
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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

diff --git a/exec.c b/exec.c
index eac6085..e9a201a 100644
--- a/exec.c
+++ b/exec.c
@@ -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)
diff --git a/include/exec/target_page.h b/include/exec/target_page.h
new file mode 100644
index 0000000..0961591
--- /dev/null
+++ b/include/exec/target_page.h
@@ -0,0 +1,20 @@
+
+ /*
+ * QEMU exec target page sizes
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * 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
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 503b51f..5970ca4 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -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);
diff --git a/migration/migration.c b/migration/migration.c
index fccd779..38740b4 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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"
 
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index bd23971..88e1646 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -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"
diff --git a/migration/savevm.c b/migration/savevm.c
index 03ff007..6a47dcd 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 40/41] migration: Make savevm.c target independent
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (38 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 39/41] exec: Create include for target_page_size() Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 41/41] migration: Remove unneeded includes Juan Quintela
  2017-04-27 12:02 ` [Qemu-devel] [PATCH 00/41] Migration cleanup Dr. David Alan Gilbert
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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(-)

diff --git a/Makefile.target b/Makefile.target
index e62021d..4020b01 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -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
diff --git a/exec.c b/exec.c
index e9a201a..447ac63 100644
--- a/exec.c
+++ b/exec.c
@@ -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
 
 /*
diff --git a/include/exec/target_page.h b/include/exec/target_page.h
index 0961591..e3a19cc 100644
--- a/include/exec/target_page.h
+++ b/include/exec/target_page.h
@@ -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
diff --git a/migration/Makefile.objs b/migration/Makefile.objs
index 775e4ad..4277c88 100644
--- a/migration/Makefile.objs
+++ b/migration/Makefile.objs
@@ -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
diff --git a/migration/savevm.c b/migration/savevm.c
index 6a47dcd..2e5f6a4 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -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) {
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* [Qemu-devel] [PATCH 41/41] migration: Remove unneeded includes
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (39 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 40/41] migration: Make savevm.c target independent Juan Quintela
@ 2017-04-25 22:04 ` Juan Quintela
  2017-04-27 12:02 ` [Qemu-devel] [PATCH 00/41] Migration cleanup Dr. David Alan Gilbert
  41 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-25 22:04 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 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(-)

diff --git a/include/migration/misc.h b/include/migration/misc.h
index 28f69be..5c62e92 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -14,6 +14,8 @@
 #ifndef MIGRATION_MISC_H
 #define MIGRATION_MISC_H
 
+#include "qemu/notify.h"
+
 /* migration/ram.c */
 
 void ram_mig_init(void);
diff --git a/migration/block.c b/migration/block.c
index 6457f25..5c89436 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -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"
diff --git a/migration/colo-failover.c b/migration/colo-failover.c
index 85c4526..9f2fb71 100644
--- a/migration/colo-failover.c
+++ b/migration/colo-failover.c
@@ -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"
diff --git a/migration/colo.c b/migration/colo.c
index 72001a5..4f41d2a 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -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"
diff --git a/migration/colo.h b/migration/colo.h
index ba0bb6e..be6beba 100644
--- a/migration/colo.h
+++ b/migration/colo.h
@@ -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);
diff --git a/migration/exec.c b/migration/exec.c
index 074943a..6d535dc 100644
--- a/migration/exec.c
+++ b/migration/exec.c
@@ -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"
 
diff --git a/migration/fd.c b/migration/fd.c
index b2384bf..30f5258 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -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"
diff --git a/migration/global_state.c b/migration/global_state.c
index 3d67ba2..bf82aa7 100644
--- a/migration/global_state.c
+++ b/migration/global_state.c
@@ -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 {
diff --git a/migration/migration.c b/migration/migration.c
index 38740b4..83caa58 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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"
diff --git a/migration/migration.h b/migration/migration.h
index 735f565..f6bac81 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -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"
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 88e1646..e9a0b5c 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -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"
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index e65c373..2ab2bf3 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -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"
diff --git a/migration/ram.c b/migration/ram.c
index 14104f1..1d69f64 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -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"
diff --git a/migration/savevm.c b/migration/savevm.c
index 2e5f6a4..a84883f 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -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"
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 53+ messages in thread

* Re: [Qemu-devel] [PATCH 25/41] migration: Export rdma.c functions in its own file
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 25/41] migration: Export rdma.c " Juan Quintela
@ 2017-04-27 11:52   ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 53+ messages in thread
From: Dr. David Alan Gilbert @ 2017-04-27 11:52 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel, lvivier, peterx

* Juan Quintela (quintela@redhat.com) wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  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
> 
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index 38ba508..9063c32 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -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);
> diff --git a/migration/migration.c b/migration/migration.c
> index ef966ca..394930d 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -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"
> diff --git a/migration/rdma.c b/migration/rdma.c
> index 96a90dd..f8fea9b 100644
> --- a/migration/rdma.c
> +++ b/migration/rdma.c
> @@ -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"
> diff --git a/migration/rdma.h b/migration/rdma.h
> new file mode 100644
> index 0000000..d2cf481
> --- /dev/null
> +++ b/migration/rdma.h
> @@ -0,0 +1,22 @@
> +/*
> + * QEMU migration rdma functions
> + *
> + * Copyright IBM, Corp. 2008
> + *
> + * Authors:
> + *  Anthony Liguori   <aliguori@us.ibm.com>
> + *
> + * 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

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

> -- 
> 2.9.3
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [Qemu-devel] [PATCH 01/41] migration: Create migration/blocker.h
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 01/41] migration: Create migration/blocker.h Juan Quintela
@ 2017-04-27 11:58   ` Dr. David Alan Gilbert
  2017-05-10  9:55   ` Peter Xu
  1 sibling, 0 replies; 53+ messages in thread
From: Dr. David Alan Gilbert @ 2017-04-27 11:58 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel, lvivier, peterx

* Juan Quintela (quintela@redhat.com) wrote:
> This allows us to remove lots of includes of migration/migration.h
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

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

Dave

> ---
>  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%)
> 
> diff --git a/block/qcow.c b/block/qcow.c
> index 9d6ac83..48e852c 100644
> --- a/block/qcow.c
> +++ b/block/qcow.c
> @@ -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 */
> diff --git a/block/vdi.c b/block/vdi.c
> index 9b4f70e..5f7b29f 100644
> --- a/block/vdi.c
> +++ b/block/vdi.c
> @@ -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"
> diff --git a/block/vhdx.c b/block/vhdx.c
> index 052a753..6128b7b 100644
> --- a/block/vhdx.c
> +++ b/block/vhdx.c
> @@ -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 */
> diff --git a/block/vmdk.c b/block/vmdk.c
> index a9bd22b..f09f0b2 100644
> --- a/block/vmdk.c
> +++ b/block/vmdk.c
> @@ -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>
>  
> diff --git a/block/vpc.c b/block/vpc.c
> index f591d4b..cb2d4cf 100644
> --- a/block/vpc.c
> +++ b/block/vpc.c
> @@ -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"
>  
> diff --git a/block/vvfat.c b/block/vvfat.c
> index b509d55..3fcc59c 100644
> --- a/block/vvfat.c
> +++ b/block/vvfat.c
> @@ -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"
> diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
> index c80ba67..ab3e22f 100644
> --- a/hw/9pfs/9p.c
> +++ b/hw/9pfs/9p.c
> @@ -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;
> diff --git a/hw/display/qxl.c b/hw/display/qxl.c
> index 4d94cec..ad09bb9 100644
> --- a/hw/display/qxl.c
> +++ b/hw/display/qxl.c
> @@ -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"
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index e1056f3..8ad27f3 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -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"
>  
> diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c
> index ec952ec..af5cd36 100644
> --- a/hw/intc/arm_gic_kvm.c
> +++ b/hw/intc/arm_gic_kvm.c
> @@ -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"
> diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c
> index bd4f3aa..a0441d6 100644
> --- a/hw/intc/arm_gicv3_its_kvm.c
> +++ b/hw/intc/arm_gicv3_its_kvm.c
> @@ -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)
> diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
> index 19aab56..4ee2baa 100644
> --- a/hw/intc/arm_gicv3_kvm.c
> +++ b/hw/intc/arm_gicv3_kvm.c
> @@ -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, ...) \
> diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
> index 82ce837..475e36a 100644
> --- a/hw/misc/ivshmem.c
> +++ b/hw/misc/ivshmem.c
> @@ -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"
> diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c
> index f53bc17..0558737 100644
> --- a/hw/scsi/vhost-scsi.c
> +++ b/hw/scsi/vhost-scsi.c
> @@ -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"
> diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
> index 0001e60..03a46a7 100644
> --- a/hw/virtio/vhost.c
> +++ b/hw/virtio/vhost.c
> @@ -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 */
> diff --git a/include/migration/blocker.h b/include/migration/blocker.h
> new file mode 100644
> index 0000000..acd2701
> --- /dev/null
> +++ b/include/migration/blocker.h
> @@ -0,0 +1,35 @@
> +/*
> + * QEMU migration blockers
> + *
> + * Copyright IBM, Corp. 2008
> + *
> + * Authors:
> + *  Anthony Liguori   <aliguori@us.ibm.com>
> + *
> + * 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
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index 9579280..02b074f 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -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);
> diff --git a/migration/migration.c b/migration/migration.c
> index f094079..8625a6c 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -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"
> diff --git a/migration/ram.c b/migration/ram.c
> index 5428026..4e562be 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -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"
> diff --git a/migration/xbzrle.c b/migration/xbzrle.c
> index 421bca0..1ba482d 100644
> --- a/migration/xbzrle.c
> +++ b/migration/xbzrle.c
> @@ -12,7 +12,7 @@
>   */
>  #include "qemu/osdep.h"
>  #include "qemu/cutils.h"
> -#include "migration/xbzrle.h"
> +#include "xbzrle.h"
>  
>  /*
>    page = zrun nzrun
> diff --git a/include/migration/xbzrle.h b/migration/xbzrle.h
> similarity index 100%
> rename from include/migration/xbzrle.h
> rename to migration/xbzrle.h
> diff --git a/stubs/migr-blocker.c b/stubs/migr-blocker.c
> index a5ba18f..2b64ac9 100644
> --- a/stubs/migr-blocker.c
> +++ b/stubs/migr-blocker.c
> @@ -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)
>  {
> diff --git a/target/i386/kvm.c b/target/i386/kvm.c
> index 55865db..011d4a5 100644
> --- a/target/i386/kvm.c
> +++ b/target/i386/kvm.c
> @@ -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"
>  
> diff --git a/tests/test-xbzrle.c b/tests/test-xbzrle.c
> index d97b5eb..f5e08de 100644
> --- a/tests/test-xbzrle.c
> +++ b/tests/test-xbzrle.c
> @@ -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
>  
> -- 
> 2.9.3
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [Qemu-devel] [PATCH 00/41] Migration cleanup
  2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
                   ` (40 preceding siblings ...)
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 41/41] migration: Remove unneeded includes Juan Quintela
@ 2017-04-27 12:02 ` Dr. David Alan Gilbert
  2017-04-27 15:02   ` Juan Quintela
  41 siblings, 1 reply; 53+ messages in thread
From: Dr. David Alan Gilbert @ 2017-04-27 12:02 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel, lvivier, peterx, peter.maydell

* Juan Quintela (quintela@redhat.com) 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

> 
> 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%)
> 
> -- 
> 2.9.3
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [Qemu-devel] [PATCH 10/41] migration: Move postcopy-ram.h to migration/
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 10/41] migration: Move postcopy-ram.h " Juan Quintela
@ 2017-04-27 12:09   ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 53+ messages in thread
From: Dr. David Alan Gilbert @ 2017-04-27 12:09 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel, lvivier, peterx

* Juan Quintela (quintela@redhat.com) wrote:
> It is internal to migration, not intended for other users.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  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%)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index fe30227..fef1f0a 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -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

>  #include "qemu/thread.h"
>  #include "qmp-commands.h"
>  #include "trace.h"
> diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
> index e3f4a37..cdadaf6 100644
> --- a/migration/postcopy-ram.c
> +++ b/migration/postcopy-ram.c
> @@ -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"
> diff --git a/include/migration/postcopy-ram.h b/migration/postcopy-ram.h
> similarity index 100%
> rename from include/migration/postcopy-ram.h
> rename to migration/postcopy-ram.h
> diff --git a/migration/ram.c b/migration/ram.c
> index 47e66f4..5fcf593 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -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"
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 7a07ea6..1b2a83c 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -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"
> -- 
> 2.9.3
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [Qemu-devel] [PATCH 00/41] Migration cleanup
  2017-04-27 12:02 ` [Qemu-devel] [PATCH 00/41] Migration cleanup Dr. David Alan Gilbert
@ 2017-04-27 15:02   ` Juan Quintela
  0 siblings, 0 replies; 53+ messages in thread
From: Juan Quintela @ 2017-04-27 15:02 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: qemu-devel, lvivier, peterx, peter.maydell

"Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> * Juan Quintela (quintela@redhat.com) 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.

/*
 * QEMU live migration
 *
 * Copyright IBM, Corp. 2008
 *
 * Authors:
 *  Anthony Liguori   <aliguori@us.ibm.com>
 *
 * 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.

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [Qemu-devel] [PATCH 31/41] migration: Move postcopy stuff to postcopy-ram.c
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 31/41] migration: Move postcopy stuff to postcopy-ram.c Juan Quintela
@ 2017-04-28 17:15   ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 53+ messages in thread
From: Dr. David Alan Gilbert @ 2017-04-28 17:15 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel, lvivier, peterx

* Juan Quintela (quintela@redhat.com) wrote:
> Yes, we don't have a good place to put that stuff.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  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(-)
> 
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index 9063c32..5c27fe7 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -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
> diff --git a/migration/migration.c b/migration/migration.c
> index ff32086..d2f3c5e 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -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);
> -}
> -
> diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
> index 3359224..cae5d48 100644
> --- a/migration/postcopy-ram.c
> +++ b/migration/postcopy-ram.c
> @@ -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);
> +}
> diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h
> index 4c25f03..52d51e8 100644
> --- a/migration/postcopy-ram.h
> +++ b/migration/postcopy-ram.h
> @@ -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
> -- 
> 2.9.3
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [Qemu-devel] [PATCH 06/41] migration: Move colo.h to migration/
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 06/41] migration: Move colo.h to migration/ Juan Quintela
@ 2017-05-04 19:02   ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 53+ messages in thread
From: Dr. David Alan Gilbert @ 2017-05-04 19:02 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel, lvivier, peterx

* Juan Quintela (quintela@redhat.com) wrote:
> There are functions only used by migration code.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  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%)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index cae3b09..3560ba2 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1535,7 +1535,7 @@ COLO Framework
>  M: zhanghailiang <zhang.zhanghailiang@huawei.com>
>  S: Maintained
>  F: migration/colo*
> -F: include/migration/colo.h
> +F: migration/colo.h
>  F: include/migration/failover.h
>  F: docs/COLO-FT.txt
>  
> diff --git a/migration/colo-comm.c b/migration/colo-comm.c
> index 3d91798..9b35027 100644
> --- a/migration/colo-comm.c
> +++ b/migration/colo-comm.c
> @@ -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

>  typedef struct {
> diff --git a/migration/colo-failover.c b/migration/colo-failover.c
> index cc229f5..29b8d63 100644
> --- a/migration/colo-failover.c
> +++ b/migration/colo-failover.c
> @@ -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"
> diff --git a/include/migration/colo.h b/migration/colo.h
> similarity index 100%
> rename from include/migration/colo.h
> rename to migration/colo.h
> diff --git a/migration/migration.c b/migration/migration.c
> index dd8c9d5..fe30227 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -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 */
>  
> diff --git a/migration/ram.c b/migration/ram.c
> index 4e562be..47e66f4 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -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 */
> -- 
> 2.9.3
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [Qemu-devel] [PATCH 08/41] migration: Move page_cache.c to migration/
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 08/41] migration: Move page_cache.c to migration/ Juan Quintela
@ 2017-05-04 19:03   ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 53+ messages in thread
From: Dr. David Alan Gilbert @ 2017-05-04 19:03 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel, lvivier, peterx

* Juan Quintela (quintela@redhat.com) wrote:
> It is only used by migration, so move it there.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  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%)
> 
> diff --git a/Makefile.objs b/Makefile.objs
> index 6167e7b..2100845 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -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
>  
> diff --git a/migration/Makefile.objs b/migration/Makefile.objs
> index c83ca92..ce8ce12 100644
> --- a/migration/Makefile.objs
> +++ b/migration/Makefile.objs
> @@ -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
> diff --git a/page_cache.c b/migration/page_cache.c
> similarity index 100%
> rename from page_cache.c
> rename to migration/page_cache.c
> diff --git a/include/migration/page_cache.h b/migration/page_cache.h
> similarity index 100%
> rename from include/migration/page_cache.h
> rename to migration/page_cache.h
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index 579ec07..0f98c04 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -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)
> -- 
> 2.9.3
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [Qemu-devel] [PATCH 01/41] migration: Create migration/blocker.h
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 01/41] migration: Create migration/blocker.h Juan Quintela
  2017-04-27 11:58   ` Dr. David Alan Gilbert
@ 2017-05-10  9:55   ` Peter Xu
  1 sibling, 0 replies; 53+ messages in thread
From: Peter Xu @ 2017-05-10  9:55 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel, dgilbert, lvivier

On Wed, Apr 26, 2017 at 12:04:11AM +0200, Juan Quintela wrote:
> This allows us to remove lots of includes of migration/migration.h
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

If without all the "xbzrle.h" changes:

Reviewed-by: Peter Xu <peterx@redhat.com>

-- 
Peter Xu

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [Qemu-devel] [PATCH 19/41] migration: Remove unneeded includes of migration/vmstate.h
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 19/41] migration: Remove unneeded includes of migration/vmstate.h Juan Quintela
@ 2017-05-13 20:46   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 53+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-05-13 20:46 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: lvivier, dgilbert, peterx

On 04/25/2017 07:04 PM, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  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(-)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 17ff638..23ccf9f 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -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;
> diff --git a/include/hw/acpi/memory_hotplug.h b/include/hw/acpi/memory_hotplug.h
> index db8ebc9..77c6576 100644
> --- a/include/hw/acpi/memory_hotplug.h
> +++ b/include/hw/acpi/memory_hotplug.h
> @@ -3,7 +3,6 @@
>
>  #include "hw/qdev-core.h"
>  #include "hw/acpi/acpi.h"
> -#include "migration/vmstate.h"
>  #include "hw/acpi/aml-build.h"
>
>  /**
> diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h
> index 04528b7..8a65f99 100644
> --- a/include/hw/acpi/pcihp.h
> +++ b/include/hw/acpi/pcihp.h
> @@ -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"
> diff --git a/include/hw/pci/shpc.h b/include/hw/pci/shpc.h
> index b208554..71e836b 100644
> --- a/include/hw/pci/shpc.h
> +++ b/include/hw/pci/shpc.h
> @@ -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"
>
> diff --git a/include/net/net.h b/include/net/net.h
> index 99b28d5..ba663bd 100644
> --- a/include/net/net.h
> +++ b/include/net/net.h
> @@ -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"
> diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
> index b4f9798..8186c9d 100644
> --- a/target/alpha/cpu.c
> +++ b/target/alpha/cpu.c
> @@ -23,7 +23,6 @@
>  #include "qapi/error.h"
>  #include "cpu.h"
>  #include "qemu-common.h"
> -#include "migration/vmstate.h"
>  #include "exec/exec-all.h"
>
>
> diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
> index 1d791d0..30299e9 100644
> --- a/target/hppa/cpu.c
> +++ b/target/hppa/cpu.c
> @@ -22,7 +22,6 @@
>  #include "qapi/error.h"
>  #include "cpu.h"
>  #include "qemu-common.h"
> -#include "migration/vmstate.h"
>  #include "exec/exec-all.h"
>
>
> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
> index 066dcd1..cfd3b70 100644
> --- a/target/s390x/cpu.c
> +++ b/target/s390x/cpu.c
> @@ -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"
> diff --git a/target/tilegx/cpu.c b/target/tilegx/cpu.c
> index d90e38e..4532639 100644
> --- a/target/tilegx/cpu.c
> +++ b/target/tilegx/cpu.c
> @@ -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"
>
>

^ permalink raw reply	[flat|nested] 53+ messages in thread

* Re: [Qemu-devel] [PATCH 13/41] migration: Remove vmstate.h from migration.h
  2017-04-25 22:04 ` [Qemu-devel] [PATCH 13/41] migration: Remove vmstate.h from migration.h Juan Quintela
@ 2017-05-13 20:47   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 53+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-05-13 20:47 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: lvivier, dgilbert, peterx

On 04/25/2017 07:04 PM, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> --
>
> Minor rearrangements due to rebase
>
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  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(-)
>
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index d465624..22578db 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -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"
> diff --git a/migration/block.c b/migration/block.c
> index d2923b3..c919787 100644
> --- a/migration/block.c
> +++ b/migration/block.c
> @@ -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)
> diff --git a/migration/colo-comm.c b/migration/colo-comm.c
> index 9b35027..b4288b8 100644
> --- a/migration/colo-comm.c
> +++ b/migration/colo-comm.c
> @@ -13,6 +13,7 @@
>
>  #include "qemu/osdep.h"
>  #include "migration/migration.h"
> +#include "migration/vmstate.h"
>  #include "colo.h"
>  #include "trace.h"
>
> diff --git a/migration/migration.c b/migration/migration.c
> index fef1f0a..4668236 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -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"
> diff --git a/migration/ram.c b/migration/ram.c
> index 8e1c136..c431ef9 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -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"
>

^ permalink raw reply	[flat|nested] 53+ messages in thread

end of thread, other threads:[~2017-05-13 20:47 UTC | newest]

Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25 22:04 [Qemu-devel] [PATCH 00/41] Migration cleanup Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 01/41] migration: Create migration/blocker.h Juan Quintela
2017-04-27 11:58   ` Dr. David Alan Gilbert
2017-05-10  9:55   ` Peter Xu
2017-04-25 22:04 ` [Qemu-devel] [PATCH 02/41] migration: Split migration/channel.c for channel operations Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 03/41] migration: Remove MigrationState from migration_channel_incomming() Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 04/41] migration: Export qemu-file-channel.c functions in its own file Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 05/41] migration: Remove migration.h from colo.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 06/41] migration: Move colo.h to migration/ Juan Quintela
2017-05-04 19:02   ` Dr. David Alan Gilbert
2017-04-25 22:04 ` [Qemu-devel] [PATCH 07/41] migration: Move failover.h to migration/colo-failover.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 08/41] migration: Move page_cache.c to migration/ Juan Quintela
2017-05-04 19:03   ` Dr. David Alan Gilbert
2017-04-25 22:04 ` [Qemu-devel] [PATCH 09/41] migration: Move qjson.h " Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 10/41] migration: Move postcopy-ram.h " Juan Quintela
2017-04-27 12:09   ` Dr. David Alan Gilbert
2017-04-25 22:04 ` [Qemu-devel] [PATCH 11/41] migration: Split vmstate-types.c from vmstate.c Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 12/41] migration: Remove qemu-file.h from vmstate.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 13/41] migration: Remove vmstate.h from migration.h Juan Quintela
2017-05-13 20:47   ` Philippe Mathieu-Daudé
2017-04-25 22:04 ` [Qemu-devel] [PATCH 14/41] migration: migration.h was not needed Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 15/41] migration: Create include for migration snapshots Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 16/41] migration: Rename {save, load}_vmstate to {save, load}_snapshot Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 17/41] migration: Create savevm.h for functions exported from savevm.c Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 18/41] migration: Split qemu-file.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 19/41] migration: Remove unneeded includes of migration/vmstate.h Juan Quintela
2017-05-13 20:46   ` Philippe Mathieu-Daudé
2017-04-25 22:04 ` [Qemu-devel] [PATCH 20/41] migration: Export exec.c functions in its own file Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 21/41] migration: Export fd.c " Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 22/41] migration: Export socket.c " Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 23/41] migration: Export tls.c " Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 24/41] migration: Export ram.c " Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 25/41] migration: Export rdma.c " Juan Quintela
2017-04-27 11:52   ` Dr. David Alan Gilbert
2017-04-25 22:04 ` [Qemu-devel] [PATCH 26/41] migration: Move include/migration/block.h into migration/ Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 27/41] migration: Move self_announce_delay() to misc.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 28/41] migration: Split registration functions from vmstate.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 29/41] migration: loadvm_free_handlers is only used in migration/ Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 30/41] migration: Move dump_vmsate_json_to_file() to misc.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 31/41] migration: Move postcopy stuff to postcopy-ram.c Juan Quintela
2017-04-28 17:15   ` Dr. David Alan Gilbert
2017-04-25 22:04 ` [Qemu-devel] [PATCH 32/41] migration: Move constants to savevm.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 33/41] migration: Commands are only used inside migration.c Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 34/41] migration: ram_control_* are implemented in qemu_file Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 35/41] migration: create global_state.c Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 36/41] migration: Move more exported functions to migration/misc.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 37/41] migration: Move last funtions to misc.h Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 38/41] migration: Move migration.h to migration/ Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 39/41] exec: Create include for target_page_size() Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 40/41] migration: Make savevm.c target independent Juan Quintela
2017-04-25 22:04 ` [Qemu-devel] [PATCH 41/41] migration: Remove unneeded includes Juan Quintela
2017-04-27 12:02 ` [Qemu-devel] [PATCH 00/41] Migration cleanup Dr. David Alan Gilbert
2017-04-27 15:02   ` Juan Quintela

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.