All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/11] Misc migration cleanups
@ 2017-06-01 21:29 Juan Quintela
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 01/11] migration: Remove MigrationState from migration_channel_incomming() Juan Quintela
                   ` (11 more replies)
  0 siblings, 12 replies; 30+ messages in thread
From: Juan Quintela @ 2017-06-01 21:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Hi

This are a bit of everything:
- Remove unneeded argumets for migration_channel_incomming
- Lots of changes to make migration.h local to only migration
  * Move self_annonce_delay() to misc.h
    I know this conflicts for announce changes from Vlad, but
    I want to remove migration.h from being exported.
  * split registrantion functions to register.h
  * Almost everything uses vmsd's for registration
  * Move constants to the places that use it
    And they are not used outside of migration/*
  * create global_state.c, as they don't belong anywhere else

ToSend:
  * RAMState is a dynamic variable on my tree
  * save_{setup,cleanup} and load_{setup,cleanup}
    Yes Kevin, that is for block layer
  * move all ram.c to use load_setup/cleanup

ToDo easy: (probably post 2.10)
  * split qapi functions from migration.c
    They don't belong there, and it would be clearer about what is configuratio and what is code
  * block.c and page_cache.c still use DPRINTF, they should move to use tracing
    this is easy, volunteers, please.
  * Now that it is clear what functions are exported and which not, writting documentation could
    be a good idea for them.

ToDo, difficult:
  * rdma.c -> this needs some love, it uses a completely different set of hooks that everything
    else, should have to integrate somehow everything together.
  * abstract compression, xbzrle, postcopy and rdma into something that
    is easier to understand.

Please, review.

Thanks, Juan.


Juan Quintela (11):
  migration: Remove MigrationState from migration_channel_incomming()
  migration: Move self_announce_delay() to misc.h
  migration: Split registration functions from vmstate.h
  migration: Move dump_vmsate_json_to_file() to misc.h
  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 remaining exported functions to migration/misc.h
  migration: Move migration.h to migration/
  migration: Remove unneeded includes

 hw/i386/pc_piix.c                            |   3 +-
 hw/net/virtio-net.c                          |   1 +
 hw/net/vmxnet3.c                             |   1 +
 hw/ppc/spapr.c                               |   4 +-
 hw/s390x/s390-skeys.c                        |   1 +
 hw/s390x/s390-virtio-ccw.c                   |   1 +
 hw/xen/xen-common.c                          |   3 +-
 include/migration/colo.h                     |   3 -
 include/migration/global_state.h             |  25 ++++
 include/migration/misc.h                     |  28 +++++
 include/migration/register.h                 |  64 ++++++++++
 include/migration/vmstate.h                  |  57 ---------
 migration/Makefile.objs                      |   2 +-
 migration/block.c                            |   9 +-
 migration/channel.c                          |   7 +-
 migration/channel.h                          |   3 +-
 migration/colo-comm.c                        |   2 +-
 migration/colo-failover.c                    |   2 +
 migration/colo.c                             |   4 +-
 migration/exec.c                             |   4 +-
 migration/fd.c                               |   4 +-
 migration/global_state.c                     | 139 +++++++++++++++++++++
 migration/migration.c                        | 176 +++++----------------------
 {include/migration => migration}/migration.h |  67 ----------
 migration/postcopy-ram.c                     |   6 +-
 migration/qemu-file.c                        |   4 +-
 migration/qemu-file.h                        |  17 +++
 migration/ram.c                              |   7 +-
 migration/rdma.c                             |   2 +-
 migration/savevm.c                           |  11 +-
 migration/savevm.h                           |  15 +++
 migration/socket.c                           |   5 +-
 migration/tls.c                              |   4 +-
 migration/vmstate-types.c                    |   2 +-
 migration/vmstate.c                          |   3 +-
 qdev-monitor.c                               |   2 +-
 slirp/slirp.c                                |   1 +
 tests/test-vmstate.c                         |   3 +-
 ui/spice-core.c                              |   2 +-
 vl.c                                         |   2 +-
 40 files changed, 368 insertions(+), 328 deletions(-)
 create mode 100644 include/migration/global_state.h
 create mode 100644 include/migration/register.h
 create mode 100644 migration/global_state.c
 rename {include/migration => migration}/migration.h (62%)

-- 
2.9.4

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

* [Qemu-devel] [PATCH 01/11] migration: Remove MigrationState from migration_channel_incomming()
  2017-06-01 21:29 [Qemu-devel] [PATCH 00/11] Misc migration cleanups Juan Quintela
@ 2017-06-01 21:29 ` Juan Quintela
  2017-06-12  9:19   ` Peter Xu
  2017-06-12 10:03   ` Laurent Vivier
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 02/11] migration: Move self_announce_delay() to misc.h Juan Quintela
                   ` (10 subsequent siblings)
  11 siblings, 2 replies; 30+ messages in thread
From: Juan Quintela @ 2017-06-01 21:29 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 eae1d9e..92f6f99 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -19,9 +19,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 2e0a7e3..e4b4057 100644
--- a/migration/channel.h
+++ b/migration/channel.h
@@ -18,8 +18,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 9077024..fc78eeb 100644
--- a/migration/exec.c
+++ b/migration/exec.c
@@ -49,7 +49,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 0077a50..8a04dcd 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -49,7 +49,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 85bfdcc..50dc8d8 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -148,8 +148,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 bae9aca..d3abd6e 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -74,7 +74,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.4

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

* [Qemu-devel] [PATCH 02/11] migration: Move self_announce_delay() to misc.h
  2017-06-01 21:29 [Qemu-devel] [PATCH 00/11] Misc migration cleanups Juan Quintela
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 01/11] migration: Remove MigrationState from migration_channel_incomming() Juan Quintela
@ 2017-06-01 21:29 ` Juan Quintela
  2017-06-12  9:22   ` Peter Xu
  2017-06-12 10:31   ` Laurent Vivier
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 03/11] migration: Split registration functions from vmstate.h Juan Quintela
                   ` (9 subsequent siblings)
  11 siblings, 2 replies; 30+ messages in thread
From: Juan Quintela @ 2017-06-01 21:29 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 9a3d769..91eddaf 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 d7892b7..60486d4 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -26,4 +26,14 @@ void blk_mig_init(void);
 static inline void blk_mig_init(void) {}
 #endif
 
+#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 6689562..b95c9bb 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -1018,8 +1018,6 @@ extern const VMStateInfo vmstate_info_qtailq;
 #define VMSTATE_END_OF_LIST()                                         \
     {}
 
-#define SELF_ANNOUNCE_ROUNDS 5
-
 int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
                        void *opaque, int version_id);
 void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
@@ -1051,14 +1049,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_check_only_migratable(const VMStateDescription *vmsd);
diff --git a/migration/savevm.c b/migration/savevm.c
index 9c320f5..d683877 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -36,6 +36,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.4

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

* [Qemu-devel] [PATCH 03/11] migration: Split registration functions from vmstate.h
  2017-06-01 21:29 [Qemu-devel] [PATCH 00/11] Misc migration cleanups Juan Quintela
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 01/11] migration: Remove MigrationState from migration_channel_incomming() Juan Quintela
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 02/11] migration: Move self_announce_delay() to misc.h Juan Quintela
@ 2017-06-01 21:29 ` Juan Quintela
  2017-06-12  9:29   ` Peter Xu
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 04/11] migration: Move dump_vmsate_json_to_file() to misc.h Juan Quintela
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Juan Quintela @ 2017-06-01 21:29 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 ab3aab1..a44efbf 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 "mmu-book3s-v3.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 c9021f2..51d14d3 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 b95c9bb..6de554d 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 4d8c2e9..30ab531 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 f387e9c..31b4d6a 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 d683877..543635b 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -37,6 +37,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 2f2ec2c..e988523 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.4

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

* [Qemu-devel] [PATCH 04/11] migration: Move dump_vmsate_json_to_file() to misc.h
  2017-06-01 21:29 [Qemu-devel] [PATCH 00/11] Misc migration cleanups Juan Quintela
                   ` (2 preceding siblings ...)
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 03/11] migration: Split registration functions from vmstate.h Juan Quintela
@ 2017-06-01 21:29 ` Juan Quintela
  2017-06-12  9:33   ` Peter Xu
  2017-06-12 10:42   ` Laurent Vivier
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 05/11] migration: Move constants to savevm.h Juan Quintela
                   ` (7 subsequent siblings)
  11 siblings, 2 replies; 30+ messages in thread
From: Juan Quintela @ 2017-06-01 21:29 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 60486d4..026b561 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -36,4 +36,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 6de554d..ad243d4 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -1004,8 +1004,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_check_only_migratable(const VMStateDescription *vmsd);
 
 #endif
-- 
2.9.4

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

* [Qemu-devel] [PATCH 05/11] migration: Move constants to savevm.h
  2017-06-01 21:29 [Qemu-devel] [PATCH 00/11] Misc migration cleanups Juan Quintela
                   ` (3 preceding siblings ...)
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 04/11] migration: Move dump_vmsate_json_to_file() to misc.h Juan Quintela
@ 2017-06-01 21:29 ` Juan Quintela
  2017-06-12 10:44   ` Laurent Vivier
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 06/11] migration: Commands are only used inside migration.c Juan Quintela
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Juan Quintela @ 2017-06-01 21:29 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 79b5484..dd52d3c 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
-
 /* Messages sent on the return path from destination to source */
 enum mig_rp_message_type {
     MIG_RP_MSG_INVALID = 0,  /* Must be 0 */
diff --git a/migration/savevm.h b/migration/savevm.h
index eb44877..45b59c1 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 51a19b6..377d951 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -14,6 +14,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.4

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

* [Qemu-devel] [PATCH 06/11] migration: Commands are only used inside migration.c
  2017-06-01 21:29 [Qemu-devel] [PATCH 00/11] Misc migration cleanups Juan Quintela
                   ` (4 preceding siblings ...)
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 05/11] migration: Move constants to savevm.h Juan Quintela
@ 2017-06-01 21:29 ` Juan Quintela
  2017-06-12 11:34   ` Laurent Vivier
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 07/11] migration: ram_control_* are implemented in qemu_file Juan Quintela
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Juan Quintela @ 2017-06-01 21:29 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 dd52d3c..108212c 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -22,18 +22,6 @@
 #include "exec/cpu-common.h"
 #include "qemu/coroutine_int.h"
 
-/* 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
-};
-
 /* State for the incoming migration */
 struct MigrationIncomingState {
     QEMUFile *from_src_file;
@@ -176,9 +164,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 48c94c9..603d39d 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -86,6 +86,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 */
@@ -292,6 +304,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
@@ -462,23 +491,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.4

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

* [Qemu-devel] [PATCH 07/11] migration: ram_control_* are implemented in qemu_file
  2017-06-01 21:29 [Qemu-devel] [PATCH 00/11] Misc migration cleanups Juan Quintela
                   ` (5 preceding siblings ...)
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 06/11] migration: Commands are only used inside migration.c Juan Quintela
@ 2017-06-01 21:29 ` Juan Quintela
  2017-06-12 11:39   ` Laurent Vivier
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 08/11] migration: create global_state.c Juan Quintela
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Juan Quintela @ 2017-06-01 21:29 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 108212c..cb894b8 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -171,24 +171,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.4

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

* [Qemu-devel] [PATCH 08/11] migration: create global_state.c
  2017-06-01 21:29 [Qemu-devel] [PATCH 00/11] Misc migration cleanups Juan Quintela
                   ` (6 preceding siblings ...)
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 07/11] migration: ram_control_* are implemented in qemu_file Juan Quintela
@ 2017-06-01 21:29 ` Juan Quintela
  2017-06-12 11:45   ` Laurent Vivier
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 09/11] migration: Move remaining exported functions to migration/misc.h Juan Quintela
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Juan Quintela @ 2017-06-01 21:29 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 +
 hw/xen/xen-common.c              |   1 +
 include/migration/global_state.h |  25 +++++++
 include/migration/migration.h    |   4 --
 migration/Makefile.objs          |   2 +-
 migration/global_state.c         | 140 +++++++++++++++++++++++++++++++++++++++
 migration/migration.c            | 121 +--------------------------------
 migration/savevm.c               |   1 +
 vl.c                             |   1 +
 10 files changed, 172 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 2234bd0..dc19d96 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"
 #include "sysemu/numa.h"
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index a44efbf..ac8a317 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 "mmu-book3s-v3.h"
diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c
index a9055e9..e265445 100644
--- a/hw/xen/xen-common.c
+++ b/hw/xen/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
 
diff --git a/include/migration/global_state.h b/include/migration/global_state.h
new file mode 100644
index 0000000..90faea7
--- /dev/null
+++ b/include/migration/global_state.h
@@ -0,0 +1,25 @@
+/*
+ * Global State configuration
+ *
+ * Copyright (c) 2014-2017 Red Hat Inc
+ *
+ * Authors:
+ *  Juan Quintela <quintela@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * 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 cb894b8..5050454 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -172,10 +172,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 90f8c1f..1c7770d 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 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
+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..16ac63f
--- /dev/null
+++ b/migration/global_state.c
@@ -0,0 +1,140 @@
+/*
+ * Global State configuration
+ *
+ * Copyright (c) 2014-2017 Red Hat Inc
+ *
+ * Authors:
+ *  Juan Quintela <quintela@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#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 603d39d..6a7620b 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -23,6 +23,7 @@
 #include "socket.h"
 #include "rdma.h"
 #include "ram.h"
+#include "migration/global_state.h"
 #include "migration/migration.h"
 #include "savevm.h"
 #include "qemu-file-channel.h"
@@ -164,126 +165,6 @@ void migration_incoming_state_destroy(void)
     qemu_event_destroy(&mis->main_thread_load_event);
 }
 
-
-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 543635b..265e908 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -38,6 +38,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 80b86c0..bf9aa6a 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 "hw/audio/soundhw.h"
-- 
2.9.4

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

* [Qemu-devel] [PATCH 09/11] migration: Move remaining exported functions to migration/misc.h
  2017-06-01 21:29 [Qemu-devel] [PATCH 00/11] Misc migration cleanups Juan Quintela
                   ` (7 preceding siblings ...)
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 08/11] migration: create global_state.c Juan Quintela
@ 2017-06-01 21:29 ` Juan Quintela
  2017-06-12  9:51   ` Peter Xu
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 10/11] migration: Move migration.h to migration/ Juan Quintela
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 30+ messages in thread
From: Juan Quintela @ 2017-06-01 21:29 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 +-
 hw/xen/xen-common.c           |  2 +-
 include/migration/migration.h | 13 -------------
 include/migration/misc.h      | 12 ++++++++++++
 migration/migration.c         |  1 +
 qdev-monitor.c                |  2 +-
 ui/spice-core.c               |  2 +-
 vl.c                          |  1 -
 9 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index dc19d96..46a2bc4 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"
 #include "sysemu/numa.h"
 
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index ac8a317..0aadde6 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/hw/xen/xen-common.c b/hw/xen/xen-common.c
index e265445..19ad79c 100644
--- a/hw/xen/xen-common.c
+++ b/hw/xen/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
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 5050454..601e4ab 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -122,26 +122,16 @@ 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);
 
 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_is_idle(void);
-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);
@@ -171,7 +161,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 026b561..d5a433a 100644
--- a/include/migration/misc.h
+++ b/include/migration/misc.h
@@ -39,5 +39,17 @@ 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);
+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/migration/migration.c b/migration/migration.c
index 6a7620b..b6c0cfd 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -24,6 +24,7 @@
 #include "rdma.h"
 #include "ram.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 3ecbf0b..8fd6df9 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/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"
diff --git a/vl.c b/vl.c
index bf9aa6a..d442e42 100644
--- a/vl.c
+++ b/vl.c
@@ -93,7 +93,6 @@ int main(int argc, char **argv)
 #include "sysemu/dma.h"
 #include "hw/audio/soundhw.h"
 #include "audio/audio.h"
-#include "migration/migration.h"
 #include "sysemu/cpus.h"
 #include "migration/colo.h"
 #include "sysemu/kvm.h"
-- 
2.9.4

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

* [Qemu-devel] [PATCH 10/11] migration: Move migration.h to migration/
  2017-06-01 21:29 [Qemu-devel] [PATCH 00/11] Misc migration cleanups Juan Quintela
                   ` (8 preceding siblings ...)
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 09/11] migration: Move remaining exported functions to migration/misc.h Juan Quintela
@ 2017-06-01 21:29 ` Juan Quintela
  2017-06-12  9:51   ` Peter Xu
  2017-06-12 11:51   ` Laurent Vivier
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 11/11] migration: Remove unneeded includes Juan Quintela
  2017-06-02  5:00 ` [Qemu-devel] [PATCH 00/11] Misc migration cleanups Philippe Mathieu-Daudé
  11 siblings, 2 replies; 30+ messages in thread
From: Juan Quintela @ 2017-06-01 21:29 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 30ab531..21c7fac 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 92f6f99..3b7252f 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -13,7 +13,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 8bfdf68..b61aa19 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/colo.h"
 #include "migration/vmstate.h"
 #include "trace.h"
diff --git a/migration/colo.c b/migration/colo.c
index 111b715..45e9b46 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 "savevm.h"
 #include "migration/colo.h"
diff --git a/migration/exec.c b/migration/exec.c
index fc78eeb..b1de445 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 b6c0cfd..956e36c 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -25,7 +25,7 @@
 #include "ram.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 9c41887..c8c4500 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -20,7 +20,7 @@
 
 #include "qemu-common.h"
 #include "exec/target_page.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 31b4d6a..fe307ce 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 e446c6f..c6bc607 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 265e908..ba709bb 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -34,7 +34,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 50dc8d8..757d382 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 7287c6b..02f05a3 100644
--- a/migration/vmstate-types.c
+++ b/migration/vmstate-types.c
@@ -14,7 +14,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 377d951..3226e8e 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -12,7 +12,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.4

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

* [Qemu-devel] [PATCH 11/11] migration: Remove unneeded includes
  2017-06-01 21:29 [Qemu-devel] [PATCH 00/11] Misc migration cleanups Juan Quintela
                   ` (9 preceding siblings ...)
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 10/11] migration: Move migration.h to migration/ Juan Quintela
@ 2017-06-01 21:29 ` Juan Quintela
  2017-06-02  5:00 ` [Qemu-devel] [PATCH 00/11] Misc migration cleanups Philippe Mathieu-Daudé
  11 siblings, 0 replies; 30+ messages in thread
From: Juan Quintela @ 2017-06-01 21:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert, lvivier, peterx

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/colo.h  | 3 ---
 include/migration/misc.h  | 2 ++
 migration/block.c         | 6 ------
 migration/colo-failover.c | 2 ++
 migration/colo.c          | 2 --
 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/colo.h b/include/migration/colo.h
index ba0bb6e..be6beba 100644
--- a/include/migration/colo.h
+++ b/include/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/include/migration/misc.h b/include/migration/misc.h
index d5a433a..65c7070 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 21c7fac..14a8a84 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 cc229f5..f991486 100644
--- a/migration/colo-failover.c
+++ b/migration/colo-failover.c
@@ -13,6 +13,8 @@
 #include "qemu/osdep.h"
 #include "migration/colo.h"
 #include "migration/failover.h"
+#include "qemu/main-loop.h"
+#include "migration.h"
 #include "qmp-commands.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
diff --git a/migration/colo.c b/migration/colo.c
index 45e9b46..c436d63 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"
@@ -22,7 +21,6 @@
 #include "io/channel-buffer.h"
 #include "trace.h"
 #include "qemu/error-report.h"
-#include "qapi/error.h"
 #include "migration/failover.h"
 #include "replication.h"
 #include "qmp-commands.h"
diff --git a/migration/exec.c b/migration/exec.c
index b1de445..08b599e 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 16ac63f..f792cf5 100644
--- a/migration/global_state.c
+++ b/migration/global_state.c
@@ -17,7 +17,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 956e36c..60da9d6 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 "migration/colo.h"
diff --git a/migration/migration.h b/migration/migration.h
index 601e4ab..d9a268a 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 c8c4500..922702b 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 fe307ce..db7f4b0 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 ba709bb..8489abf 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.4

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

* Re: [Qemu-devel] [PATCH 00/11] Misc migration cleanups
  2017-06-01 21:29 [Qemu-devel] [PATCH 00/11] Misc migration cleanups Juan Quintela
                   ` (10 preceding siblings ...)
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 11/11] migration: Remove unneeded includes Juan Quintela
@ 2017-06-02  5:00 ` Philippe Mathieu-Daudé
  11 siblings, 0 replies; 30+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-06-02  5:00 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: lvivier, dgilbert, peterx

for patches 1 to 10:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

On 06/01/2017 06:29 PM, Juan Quintela wrote:
> Hi
>
> This are a bit of everything:
> - Remove unneeded argumets for migration_channel_incomming
> - Lots of changes to make migration.h local to only migration
>   * Move self_annonce_delay() to misc.h
>     I know this conflicts for announce changes from Vlad, but
>     I want to remove migration.h from being exported.
>   * split registrantion functions to register.h
>   * Almost everything uses vmsd's for registration
>   * Move constants to the places that use it
>     And they are not used outside of migration/*
>   * create global_state.c, as they don't belong anywhere else
>
> ToSend:
>   * RAMState is a dynamic variable on my tree
>   * save_{setup,cleanup} and load_{setup,cleanup}
>     Yes Kevin, that is for block layer
>   * move all ram.c to use load_setup/cleanup
>
> ToDo easy: (probably post 2.10)
>   * split qapi functions from migration.c
>     They don't belong there, and it would be clearer about what is configuratio and what is code
>   * block.c and page_cache.c still use DPRINTF, they should move to use tracing
>     this is easy, volunteers, please.
>   * Now that it is clear what functions are exported and which not, writting documentation could
>     be a good idea for them.
>
> ToDo, difficult:
>   * rdma.c -> this needs some love, it uses a completely different set of hooks that everything
>     else, should have to integrate somehow everything together.
>   * abstract compression, xbzrle, postcopy and rdma into something that
>     is easier to understand.
>
> Please, review.
>
> Thanks, Juan.
>
>
> Juan Quintela (11):
>   migration: Remove MigrationState from migration_channel_incomming()
>   migration: Move self_announce_delay() to misc.h
>   migration: Split registration functions from vmstate.h
>   migration: Move dump_vmsate_json_to_file() to misc.h
>   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 remaining exported functions to migration/misc.h
>   migration: Move migration.h to migration/
>   migration: Remove unneeded includes
>
>  hw/i386/pc_piix.c                            |   3 +-
>  hw/net/virtio-net.c                          |   1 +
>  hw/net/vmxnet3.c                             |   1 +
>  hw/ppc/spapr.c                               |   4 +-
>  hw/s390x/s390-skeys.c                        |   1 +
>  hw/s390x/s390-virtio-ccw.c                   |   1 +
>  hw/xen/xen-common.c                          |   3 +-
>  include/migration/colo.h                     |   3 -
>  include/migration/global_state.h             |  25 ++++
>  include/migration/misc.h                     |  28 +++++
>  include/migration/register.h                 |  64 ++++++++++
>  include/migration/vmstate.h                  |  57 ---------
>  migration/Makefile.objs                      |   2 +-
>  migration/block.c                            |   9 +-
>  migration/channel.c                          |   7 +-
>  migration/channel.h                          |   3 +-
>  migration/colo-comm.c                        |   2 +-
>  migration/colo-failover.c                    |   2 +
>  migration/colo.c                             |   4 +-
>  migration/exec.c                             |   4 +-
>  migration/fd.c                               |   4 +-
>  migration/global_state.c                     | 139 +++++++++++++++++++++
>  migration/migration.c                        | 176 +++++----------------------
>  {include/migration => migration}/migration.h |  67 ----------
>  migration/postcopy-ram.c                     |   6 +-
>  migration/qemu-file.c                        |   4 +-
>  migration/qemu-file.h                        |  17 +++
>  migration/ram.c                              |   7 +-
>  migration/rdma.c                             |   2 +-
>  migration/savevm.c                           |  11 +-
>  migration/savevm.h                           |  15 +++
>  migration/socket.c                           |   5 +-
>  migration/tls.c                              |   4 +-
>  migration/vmstate-types.c                    |   2 +-
>  migration/vmstate.c                          |   3 +-
>  qdev-monitor.c                               |   2 +-
>  slirp/slirp.c                                |   1 +
>  tests/test-vmstate.c                         |   3 +-
>  ui/spice-core.c                              |   2 +-
>  vl.c                                         |   2 +-
>  40 files changed, 368 insertions(+), 328 deletions(-)
>  create mode 100644 include/migration/global_state.h
>  create mode 100644 include/migration/register.h
>  create mode 100644 migration/global_state.c
>  rename {include/migration => migration}/migration.h (62%)
>

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

* Re: [Qemu-devel] [PATCH 01/11] migration: Remove MigrationState from migration_channel_incomming()
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 01/11] migration: Remove MigrationState from migration_channel_incomming() Juan Quintela
@ 2017-06-12  9:19   ` Peter Xu
  2017-06-12 10:03   ` Laurent Vivier
  1 sibling, 0 replies; 30+ messages in thread
From: Peter Xu @ 2017-06-12  9:19 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel, dgilbert, lvivier

On Thu, Jun 01, 2017 at 11:29:11PM +0200, Juan Quintela wrote:
> All callers were calling migrate_get_current(), so do it inside the function.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

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

-- 
Peter Xu

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

* Re: [Qemu-devel] [PATCH 02/11] migration: Move self_announce_delay() to misc.h
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 02/11] migration: Move self_announce_delay() to misc.h Juan Quintela
@ 2017-06-12  9:22   ` Peter Xu
  2017-06-12 10:31   ` Laurent Vivier
  1 sibling, 0 replies; 30+ messages in thread
From: Peter Xu @ 2017-06-12  9:22 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel, dgilbert, lvivier

On Thu, Jun 01, 2017 at 11:29:12PM +0200, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>

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

-- 
Peter Xu

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

* Re: [Qemu-devel] [PATCH 03/11] migration: Split registration functions from vmstate.h
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 03/11] migration: Split registration functions from vmstate.h Juan Quintela
@ 2017-06-12  9:29   ` Peter Xu
  2017-06-12 10:36     ` Juan Quintela
  0 siblings, 1 reply; 30+ messages in thread
From: Peter Xu @ 2017-06-12  9:29 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel, dgilbert, lvivier

On Thu, Jun 01, 2017 at 11:29:13PM +0200, Juan Quintela wrote:
> 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 ab3aab1..a44efbf 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 "mmu-book3s-v3.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 c9021f2..51d14d3 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);

Looks like this patch needs a rebasing since this function is already
remove...

> +
> +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 b95c9bb..6de554d 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);

Should be removed too?

Other than mentioned above:

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

Thanks,

>  
> -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;

-- 
Peter Xu

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

* Re: [Qemu-devel] [PATCH 04/11] migration: Move dump_vmsate_json_to_file() to misc.h
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 04/11] migration: Move dump_vmsate_json_to_file() to misc.h Juan Quintela
@ 2017-06-12  9:33   ` Peter Xu
  2017-06-12 10:42   ` Laurent Vivier
  1 sibling, 0 replies; 30+ messages in thread
From: Peter Xu @ 2017-06-12  9:33 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel, dgilbert, lvivier

On Thu, Jun 01, 2017 at 11:29:14PM +0200, Juan Quintela wrote:
> It was not from vmstate.c to start with.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Peter Xu <peterx@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 60486d4..026b561 100644
> --- a/include/migration/misc.h
> +++ b/include/migration/misc.h
> @@ -36,4 +36,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 6de554d..ad243d4 100644
> --- a/include/migration/vmstate.h
> +++ b/include/migration/vmstate.h
> @@ -1004,8 +1004,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_check_only_migratable(const VMStateDescription *vmsd);
>  
>  #endif
> -- 
> 2.9.4
> 

-- 
Peter Xu

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

* Re: [Qemu-devel] [PATCH 09/11] migration: Move remaining exported functions to migration/misc.h
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 09/11] migration: Move remaining exported functions to migration/misc.h Juan Quintela
@ 2017-06-12  9:51   ` Peter Xu
  0 siblings, 0 replies; 30+ messages in thread
From: Peter Xu @ 2017-06-12  9:51 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel, dgilbert, lvivier

On Thu, Jun 01, 2017 at 11:29:19PM +0200, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>

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

-- 
Peter Xu

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

* Re: [Qemu-devel] [PATCH 10/11] migration: Move migration.h to migration/
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 10/11] migration: Move migration.h to migration/ Juan Quintela
@ 2017-06-12  9:51   ` Peter Xu
  2017-06-12 11:51   ` Laurent Vivier
  1 sibling, 0 replies; 30+ messages in thread
From: Peter Xu @ 2017-06-12  9:51 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel, dgilbert, lvivier

On Thu, Jun 01, 2017 at 11:29:20PM +0200, Juan Quintela wrote:
> Nothing uses it outside of migration.h
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

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

-- 
Peter Xu

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

* Re: [Qemu-devel] [PATCH 01/11] migration: Remove MigrationState from migration_channel_incomming()
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 01/11] migration: Remove MigrationState from migration_channel_incomming() Juan Quintela
  2017-06-12  9:19   ` Peter Xu
@ 2017-06-12 10:03   ` Laurent Vivier
  1 sibling, 0 replies; 30+ messages in thread
From: Laurent Vivier @ 2017-06-12 10:03 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: dgilbert, peterx

On 01/06/2017 23:29, Juan Quintela wrote:
> All callers were calling migrate_get_current(), so do it inside the function.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Laurent Vivier <lvivier@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 eae1d9e..92f6f99 100644
> --- a/migration/channel.c
> +++ b/migration/channel.c
> @@ -19,9 +19,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 2e0a7e3..e4b4057 100644
> --- a/migration/channel.h
> +++ b/migration/channel.h
> @@ -18,8 +18,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 9077024..fc78eeb 100644
> --- a/migration/exec.c
> +++ b/migration/exec.c
> @@ -49,7 +49,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 0077a50..8a04dcd 100644
> --- a/migration/fd.c
> +++ b/migration/fd.c
> @@ -49,7 +49,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 85bfdcc..50dc8d8 100644
> --- a/migration/socket.c
> +++ b/migration/socket.c
> @@ -148,8 +148,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 bae9aca..d3abd6e 100644
> --- a/migration/tls.c
> +++ b/migration/tls.c
> @@ -74,7 +74,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));
>  }
> 

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

* Re: [Qemu-devel] [PATCH 02/11] migration: Move self_announce_delay() to misc.h
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 02/11] migration: Move self_announce_delay() to misc.h Juan Quintela
  2017-06-12  9:22   ` Peter Xu
@ 2017-06-12 10:31   ` Laurent Vivier
  2017-06-12 10:35     ` Juan Quintela
  1 sibling, 1 reply; 30+ messages in thread
From: Laurent Vivier @ 2017-06-12 10:31 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: dgilbert, peterx

On 01/06/2017 23:29, Juan Quintela wrote:
> 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 9a3d769..91eddaf 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 d7892b7..60486d4 100644
> --- a/include/migration/misc.h
> +++ b/include/migration/misc.h
> @@ -26,4 +26,14 @@ void blk_mig_init(void);
>  static inline void blk_mig_init(void) {}
>  #endif
>  
> +#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;
> +}
> +

It seems it is not used in a migration purpose by virtio-net, so it
should be moved out of include/migration, perhaps in include/qemu/timer.h ?

Thanks,
Laurent

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

* Re: [Qemu-devel] [PATCH 02/11] migration: Move self_announce_delay() to misc.h
  2017-06-12 10:31   ` Laurent Vivier
@ 2017-06-12 10:35     ` Juan Quintela
  2017-06-12 10:43       ` Laurent Vivier
  0 siblings, 1 reply; 30+ messages in thread
From: Juan Quintela @ 2017-06-12 10:35 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: qemu-devel, dgilbert, peterx

Laurent Vivier <lvivier@redhat.com> wrote:
> On 01/06/2017 23:29, Juan Quintela wrote:
>> 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 9a3d769..91eddaf 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 d7892b7..60486d4 100644
>> --- a/include/migration/misc.h
>> +++ b/include/migration/misc.h
>> @@ -26,4 +26,14 @@ void blk_mig_init(void);
>>  static inline void blk_mig_init(void) {}
>>  #endif
>>  
>> +#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;
>> +}
>> +
>
> It seems it is not used in a migration purpose by virtio-net, so it
> should be moved out of include/migration, perhaps in include/qemu/timer.h ?

There are some series from Vlad that touched this, but I need to move it
_anyways_ because I move migration.h to be internal to migration/.

I already asked him to move them to net/<anywhere>

Later, Juan.

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

* Re: [Qemu-devel] [PATCH 03/11] migration: Split registration functions from vmstate.h
  2017-06-12  9:29   ` Peter Xu
@ 2017-06-12 10:36     ` Juan Quintela
  0 siblings, 0 replies; 30+ messages in thread
From: Juan Quintela @ 2017-06-12 10:36 UTC (permalink / raw)
  To: Peter Xu; +Cc: qemu-devel, dgilbert, lvivier

Peter Xu <peterx@redhat.com> wrote:
> On Thu, Jun 01, 2017 at 11:29:13PM +0200, Juan Quintela wrote:
>> They are indpendent, and nowadays almost every device register things
>> with qdev->vmsd.
>> 
>> Signed-off-by: Juan Quintela <quintela@redhat.com>

>> +
>> +int register_savevm(DeviceState *dev,
>> +                    const char *idstr,
>> +                    int instance_id,
>> +                    int version_id,
>> +                    SaveStateHandler *save_state,
>> +                    LoadStateHandler *load_state,
>> +                    void *opaque);
>
> Looks like this patch needs a rebasing since this function is already
> remove...
>
>> +
>> +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 b95c9bb..6de554d 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);
>
> Should be removed too?
>
> Other than mentioned above:
>
> Reviewed-by: Peter Xu <peterx@redhat.com>

Local copy already have this two bits fixed.  It is just that I posted
this series before that changes got into upstream.

Later, Juan.

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

* Re: [Qemu-devel] [PATCH 04/11] migration: Move dump_vmsate_json_to_file() to misc.h
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 04/11] migration: Move dump_vmsate_json_to_file() to misc.h Juan Quintela
  2017-06-12  9:33   ` Peter Xu
@ 2017-06-12 10:42   ` Laurent Vivier
  1 sibling, 0 replies; 30+ messages in thread
From: Laurent Vivier @ 2017-06-12 10:42 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: dgilbert, peterx

On 01/06/2017 23:29, Juan Quintela wrote:
> It was not from vmstate.c to start with.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Laurent Vivier <lvivier@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 60486d4..026b561 100644
> --- a/include/migration/misc.h
> +++ b/include/migration/misc.h
> @@ -36,4 +36,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 6de554d..ad243d4 100644
> --- a/include/migration/vmstate.h
> +++ b/include/migration/vmstate.h
> @@ -1004,8 +1004,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_check_only_migratable(const VMStateDescription *vmsd);
>  
>  #endif
> 

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

* Re: [Qemu-devel] [PATCH 02/11] migration: Move self_announce_delay() to misc.h
  2017-06-12 10:35     ` Juan Quintela
@ 2017-06-12 10:43       ` Laurent Vivier
  0 siblings, 0 replies; 30+ messages in thread
From: Laurent Vivier @ 2017-06-12 10:43 UTC (permalink / raw)
  To: quintela; +Cc: qemu-devel, peterx, dgilbert

On 12/06/2017 12:35, Juan Quintela wrote:
> Laurent Vivier <lvivier@redhat.com> wrote:
>> On 01/06/2017 23:29, Juan Quintela wrote:
>>> 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 9a3d769..91eddaf 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 d7892b7..60486d4 100644
>>> --- a/include/migration/misc.h
>>> +++ b/include/migration/misc.h
>>> @@ -26,4 +26,14 @@ void blk_mig_init(void);
>>>  static inline void blk_mig_init(void) {}
>>>  #endif
>>>  
>>> +#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;
>>> +}
>>> +
>>
>> It seems it is not used in a migration purpose by virtio-net, so it
>> should be moved out of include/migration, perhaps in include/qemu/timer.h ?
> 
> There are some series from Vlad that touched this, but I need to move it
> _anyways_ because I move migration.h to be internal to migration/.
> 
> I already asked him to move them to net/<anywhere>
> 
> Later, Juan.
> 

ok, so:

Reviewed-by: Laurent Vivier <lvivier@redhat.com>

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

* Re: [Qemu-devel] [PATCH 05/11] migration: Move constants to savevm.h
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 05/11] migration: Move constants to savevm.h Juan Quintela
@ 2017-06-12 10:44   ` Laurent Vivier
  0 siblings, 0 replies; 30+ messages in thread
From: Laurent Vivier @ 2017-06-12 10:44 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: dgilbert, peterx

On 01/06/2017 23:29, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Laurent Vivier <lvivier@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 79b5484..dd52d3c 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
> -
>  /* Messages sent on the return path from destination to source */
>  enum mig_rp_message_type {
>      MIG_RP_MSG_INVALID = 0,  /* Must be 0 */
> diff --git a/migration/savevm.h b/migration/savevm.h
> index eb44877..45b59c1 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 51a19b6..377d951 100644
> --- a/migration/vmstate.c
> +++ b/migration/vmstate.c
> @@ -14,6 +14,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"
>  
> 

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

* Re: [Qemu-devel] [PATCH 06/11] migration: Commands are only used inside migration.c
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 06/11] migration: Commands are only used inside migration.c Juan Quintela
@ 2017-06-12 11:34   ` Laurent Vivier
  0 siblings, 0 replies; 30+ messages in thread
From: Laurent Vivier @ 2017-06-12 11:34 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: dgilbert, peterx

On 01/06/2017 23:29, Juan Quintela wrote:
> So, move them there.  Notice that we export functions that send
> commands, not the command themselves.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Laurent Vivier <lvivier@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 dd52d3c..108212c 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -22,18 +22,6 @@
>  #include "exec/cpu-common.h"
>  #include "qemu/coroutine_int.h"
>  
> -/* 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
> -};
> -
>  /* State for the incoming migration */
>  struct MigrationIncomingState {
>      QEMUFile *from_src_file;
> @@ -176,9 +164,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 48c94c9..603d39d 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -86,6 +86,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 */
> @@ -292,6 +304,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
> @@ -462,23 +491,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.
> 

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

* Re: [Qemu-devel] [PATCH 07/11] migration: ram_control_* are implemented in qemu_file
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 07/11] migration: ram_control_* are implemented in qemu_file Juan Quintela
@ 2017-06-12 11:39   ` Laurent Vivier
  0 siblings, 0 replies; 30+ messages in thread
From: Laurent Vivier @ 2017-06-12 11:39 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: dgilbert, peterx

On 01/06/2017 23:29, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Laurent Vivier <lvivier@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 108212c..cb894b8 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -171,24 +171,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
> 

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

* Re: [Qemu-devel] [PATCH 08/11] migration: create global_state.c
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 08/11] migration: create global_state.c Juan Quintela
@ 2017-06-12 11:45   ` Laurent Vivier
  0 siblings, 0 replies; 30+ messages in thread
From: Laurent Vivier @ 2017-06-12 11:45 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: dgilbert, peterx

On 01/06/2017 23:29, Juan Quintela wrote:
> It don't belong anywhere else, just the global state where everybody
> can stick other things.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Laurent Vivier <lvivier@redhat.com>

> ---
>  hw/i386/pc_piix.c                |   1 +
>  hw/ppc/spapr.c                   |   1 +
>  hw/xen/xen-common.c              |   1 +
>  include/migration/global_state.h |  25 +++++++
>  include/migration/migration.h    |   4 --
>  migration/Makefile.objs          |   2 +-
>  migration/global_state.c         | 140 +++++++++++++++++++++++++++++++++++++++
>  migration/migration.c            | 121 +--------------------------------
>  migration/savevm.c               |   1 +
>  vl.c                             |   1 +
>  10 files changed, 172 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 2234bd0..dc19d96 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"
>  #include "sysemu/numa.h"
> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
> index a44efbf..ac8a317 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 "mmu-book3s-v3.h"
> diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c
> index a9055e9..e265445 100644
> --- a/hw/xen/xen-common.c
> +++ b/hw/xen/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
>  
> diff --git a/include/migration/global_state.h b/include/migration/global_state.h
> new file mode 100644
> index 0000000..90faea7
> --- /dev/null
> +++ b/include/migration/global_state.h
> @@ -0,0 +1,25 @@
> +/*
> + * Global State configuration
> + *
> + * Copyright (c) 2014-2017 Red Hat Inc
> + *
> + * Authors:
> + *  Juan Quintela <quintela@redhat.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * 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 cb894b8..5050454 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -172,10 +172,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 90f8c1f..1c7770d 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 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
> +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..16ac63f
> --- /dev/null
> +++ b/migration/global_state.c
> @@ -0,0 +1,140 @@
> +/*
> + * Global State configuration
> + *
> + * Copyright (c) 2014-2017 Red Hat Inc
> + *
> + * Authors:
> + *  Juan Quintela <quintela@redhat.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#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 603d39d..6a7620b 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -23,6 +23,7 @@
>  #include "socket.h"
>  #include "rdma.h"
>  #include "ram.h"
> +#include "migration/global_state.h"
>  #include "migration/migration.h"
>  #include "savevm.h"
>  #include "qemu-file-channel.h"
> @@ -164,126 +165,6 @@ void migration_incoming_state_destroy(void)
>      qemu_event_destroy(&mis->main_thread_load_event);
>  }
>  
> -
> -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 543635b..265e908 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -38,6 +38,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 80b86c0..bf9aa6a 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 "hw/audio/soundhw.h"
> 

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

* Re: [Qemu-devel] [PATCH 10/11] migration: Move migration.h to migration/
  2017-06-01 21:29 ` [Qemu-devel] [PATCH 10/11] migration: Move migration.h to migration/ Juan Quintela
  2017-06-12  9:51   ` Peter Xu
@ 2017-06-12 11:51   ` Laurent Vivier
  1 sibling, 0 replies; 30+ messages in thread
From: Laurent Vivier @ 2017-06-12 11:51 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: dgilbert, peterx

On 01/06/2017 23:29, Juan Quintela wrote:
> Nothing uses it outside of migration.h
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Laurent Vivier <lvivier@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 30ab531..21c7fac 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 92f6f99..3b7252f 100644
> --- a/migration/channel.c
> +++ b/migration/channel.c
> @@ -13,7 +13,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 8bfdf68..b61aa19 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/colo.h"
>  #include "migration/vmstate.h"
>  #include "trace.h"
> diff --git a/migration/colo.c b/migration/colo.c
> index 111b715..45e9b46 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 "savevm.h"
>  #include "migration/colo.h"
> diff --git a/migration/exec.c b/migration/exec.c
> index fc78eeb..b1de445 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 b6c0cfd..956e36c 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -25,7 +25,7 @@
>  #include "ram.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 9c41887..c8c4500 100644
> --- a/migration/postcopy-ram.c
> +++ b/migration/postcopy-ram.c
> @@ -20,7 +20,7 @@
>  
>  #include "qemu-common.h"
>  #include "exec/target_page.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 31b4d6a..fe307ce 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 e446c6f..c6bc607 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 265e908..ba709bb 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -34,7 +34,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 50dc8d8..757d382 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 7287c6b..02f05a3 100644
> --- a/migration/vmstate-types.c
> +++ b/migration/vmstate-types.c
> @@ -14,7 +14,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 377d951..3226e8e 100644
> --- a/migration/vmstate.c
> +++ b/migration/vmstate.c
> @@ -12,7 +12,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"
> 

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

end of thread, other threads:[~2017-06-12 11:51 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-01 21:29 [Qemu-devel] [PATCH 00/11] Misc migration cleanups Juan Quintela
2017-06-01 21:29 ` [Qemu-devel] [PATCH 01/11] migration: Remove MigrationState from migration_channel_incomming() Juan Quintela
2017-06-12  9:19   ` Peter Xu
2017-06-12 10:03   ` Laurent Vivier
2017-06-01 21:29 ` [Qemu-devel] [PATCH 02/11] migration: Move self_announce_delay() to misc.h Juan Quintela
2017-06-12  9:22   ` Peter Xu
2017-06-12 10:31   ` Laurent Vivier
2017-06-12 10:35     ` Juan Quintela
2017-06-12 10:43       ` Laurent Vivier
2017-06-01 21:29 ` [Qemu-devel] [PATCH 03/11] migration: Split registration functions from vmstate.h Juan Quintela
2017-06-12  9:29   ` Peter Xu
2017-06-12 10:36     ` Juan Quintela
2017-06-01 21:29 ` [Qemu-devel] [PATCH 04/11] migration: Move dump_vmsate_json_to_file() to misc.h Juan Quintela
2017-06-12  9:33   ` Peter Xu
2017-06-12 10:42   ` Laurent Vivier
2017-06-01 21:29 ` [Qemu-devel] [PATCH 05/11] migration: Move constants to savevm.h Juan Quintela
2017-06-12 10:44   ` Laurent Vivier
2017-06-01 21:29 ` [Qemu-devel] [PATCH 06/11] migration: Commands are only used inside migration.c Juan Quintela
2017-06-12 11:34   ` Laurent Vivier
2017-06-01 21:29 ` [Qemu-devel] [PATCH 07/11] migration: ram_control_* are implemented in qemu_file Juan Quintela
2017-06-12 11:39   ` Laurent Vivier
2017-06-01 21:29 ` [Qemu-devel] [PATCH 08/11] migration: create global_state.c Juan Quintela
2017-06-12 11:45   ` Laurent Vivier
2017-06-01 21:29 ` [Qemu-devel] [PATCH 09/11] migration: Move remaining exported functions to migration/misc.h Juan Quintela
2017-06-12  9:51   ` Peter Xu
2017-06-01 21:29 ` [Qemu-devel] [PATCH 10/11] migration: Move migration.h to migration/ Juan Quintela
2017-06-12  9:51   ` Peter Xu
2017-06-12 11:51   ` Laurent Vivier
2017-06-01 21:29 ` [Qemu-devel] [PATCH 11/11] migration: Remove unneeded includes Juan Quintela
2017-06-02  5:00 ` [Qemu-devel] [PATCH 00/11] Misc migration cleanups Philippe Mathieu-Daudé

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.