All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 00/19] Migration cleanup
@ 2017-04-17 20:00 Juan Quintela
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 01/19] migration: to_dst_file at that point is NULL Juan Quintela
                   ` (18 more replies)
  0 siblings, 19 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

Hi

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

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

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

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

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

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

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

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

Please, comment.

Juan Quintela (19):
  migration: to_dst_file at that point is NULL
  migration: They are called vmstate_foo, move them to vmstate.c
  migration: Split migration/channel.c for channel operations
  migration: Remove MigrationState from migration_channel_incomming()
  migration: Export exec.c functions in its own file
  migration: Export fd.c functions in its own file
  migration: Export socket.c functions in its own file
  migration: Export tls.c functions in its own file
  migration: Create block capabilities for shared and enable
  migration: Remove use of old MigrationParams
  migration: Remove old MigrationParams
  migration: Remove unneeded includes
  migration: Remove qemu-file.h from vmstate.h
  migration: Remove vmstate.h from migration.h
  migration: Export qemu-file-channel.c functions in its own file
  migration: Export ram.c functions in its own file
  migration: Export rdma.c functions in its own file
  monitor: move hmp_savevm() to monitor.c
  monitor: remove monitor parameter from save_vmstate

 include/hw/hw.h                       |   1 +
 include/migration/channel.h           |  24 +++++++
 include/migration/colo.h              |   3 -
 include/migration/exec.h              |  20 ++++++
 include/migration/fd.h                |  20 ++++++
 include/migration/migration.h         |  86 ++-----------------------
 include/migration/qemu-file-channel.h |  22 +++++++
 include/migration/qemu-file.h         |   3 -
 include/migration/ram.h               |  54 ++++++++++++++++
 include/migration/rdma.h              |  22 +++++++
 include/migration/socket.h            |  25 ++++++++
 include/migration/tls.h               |  27 ++++++++
 include/migration/vmstate.h           |   4 --
 include/qemu/typedefs.h               |   1 -
 include/sysemu/sysemu.h               |   6 +-
 migration/Makefile.objs               |   2 +-
 migration/block.c                     |  26 ++------
 migration/channel.c                   |  72 +++++++++++++++++++++
 migration/colo-comm.c                 |   2 +-
 migration/colo-failover.c             |   1 +
 migration/colo.c                      |   8 +--
 migration/exec.c                      |   6 +-
 migration/fd.c                        |   6 +-
 migration/migration.c                 | 116 +++++++++++++++-------------------
 migration/postcopy-ram.c              |   4 +-
 migration/qemu-file-channel.c         |   2 +-
 migration/qemu-file.c                 |   4 +-
 migration/ram.c                       |   5 +-
 migration/rdma.c                      |   5 +-
 migration/savevm.c                    |  63 ++++--------------
 migration/socket.c                    |   6 +-
 migration/tls.c                       |   5 +-
 migration/vmstate.c                   |  16 +++++
 monitor.c                             |   5 ++
 qapi-schema.json                      |   7 +-
 replay/replay-snapshot.c              |   2 +-
 36 files changed, 417 insertions(+), 264 deletions(-)
 create mode 100644 include/migration/channel.h
 create mode 100644 include/migration/exec.h
 create mode 100644 include/migration/fd.h
 create mode 100644 include/migration/qemu-file-channel.h
 create mode 100644 include/migration/ram.h
 create mode 100644 include/migration/rdma.h
 create mode 100644 include/migration/socket.h
 create mode 100644 include/migration/tls.h
 create mode 100644 migration/channel.c

-- 
2.9.3

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

* [Qemu-devel] [PATCH 01/19] migration: to_dst_file at that point is NULL
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 02/19] migration: They are called vmstate_foo, move them to vmstate.c Juan Quintela
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

We have just arrived as:

migration.c: qemu_migrate()
  ....
  s = migrate_init() <- puts it to NULL
  ....
  {tcp,unix}_start_outgoing_migration ->
     socket_outgoing_migration
        migration_channel_connect()
	   sets to_dst_file

if tls is enabled, we do another round through
migrate_channel_tls_connect(), but we only set it up if there is no
error.  So we don't need the assignation.  I am removing it to remove
in the follwing patches the knowledge about MigrationState in that two
files.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration/socket.c | 1 -
 migration/tls.c    | 1 -
 2 files changed, 2 deletions(-)

diff --git a/migration/socket.c b/migration/socket.c
index 13966f1..dc88812 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -79,7 +79,6 @@ static void socket_outgoing_migration(QIOTask *task,
 
     if (qio_task_propagate_error(task, &err)) {
         trace_migration_socket_outgoing_error(error_get_pretty(err));
-        data->s->to_dst_file = NULL;
         migrate_fd_error(data->s, err);
         error_free(err);
     } else {
diff --git a/migration/tls.c b/migration/tls.c
index 45bec44..a33ecb7 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -116,7 +116,6 @@ static void migration_tls_outgoing_handshake(QIOTask *task,
 
     if (qio_task_propagate_error(task, &err)) {
         trace_migration_tls_outgoing_handshake_error(error_get_pretty(err));
-        s->to_dst_file = NULL;
         migrate_fd_error(s, err);
         error_free(err);
     } else {
-- 
2.9.3

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

* [Qemu-devel] [PATCH 02/19] migration: They are called vmstate_foo, move them to vmstate.c
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 01/19] migration: to_dst_file at that point is NULL Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-18 18:40   ` Dr. David Alan Gilbert
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 03/19] migration: Split migration/channel.c for channel operations Juan Quintela
                   ` (16 subsequent siblings)
  18 siblings, 1 reply; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

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

diff --git a/migration/savevm.c b/migration/savevm.c
index cc9c086..c47b209 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -45,7 +45,6 @@
 #include "qemu/sockets.h"
 #include "qemu/queue.h"
 #include "sysemu/cpus.h"
-#include "exec/memory.h"
 #include "qmp-commands.h"
 #include "trace.h"
 #include "qemu/bitops.h"
@@ -2465,19 +2464,3 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
     g_free(global_snapshots);
 
 }
-
-void vmstate_register_ram(MemoryRegion *mr, DeviceState *dev)
-{
-    qemu_ram_set_idstr(mr->ram_block,
-                       memory_region_name(mr), dev);
-}
-
-void vmstate_unregister_ram(MemoryRegion *mr, DeviceState *dev)
-{
-    qemu_ram_unset_idstr(mr->ram_block);
-}
-
-void vmstate_register_ram_global(MemoryRegion *mr)
-{
-    vmstate_register_ram(mr, NULL);
-}
diff --git a/migration/vmstate.c b/migration/vmstate.c
index 8a71349..174c490 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -1,5 +1,6 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
+#include "exec/memory.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
 #include "migration/vmstate.h"
@@ -1127,3 +1128,18 @@ bool vmstate_device_is_migratable(const VMStateDescription *vmsd)
     return true;
 }
 
+void vmstate_register_ram(MemoryRegion *mr, DeviceState *dev)
+{
+    qemu_ram_set_idstr(mr->ram_block,
+                       memory_region_name(mr), dev);
+}
+
+void vmstate_unregister_ram(MemoryRegion *mr, DeviceState *dev)
+{
+    qemu_ram_unset_idstr(mr->ram_block);
+}
+
+void vmstate_register_ram_global(MemoryRegion *mr)
+{
+    vmstate_register_ram(mr, NULL);
+}
-- 
2.9.3

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

* [Qemu-devel] [PATCH 03/19] migration: Split migration/channel.c for channel operations
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 01/19] migration: to_dst_file at that point is NULL Juan Quintela
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 02/19] migration: They are called vmstate_foo, move them to vmstate.c Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 04/19] migration: Remove MigrationState from migration_channel_incomming() Juan Quintela
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/channel.h   | 25 ++++++++++++++++
 include/migration/migration.h |  7 -----
 migration/Makefile.objs       |  2 +-
 migration/channel.c           | 69 +++++++++++++++++++++++++++++++++++++++++++
 migration/exec.c              |  1 +
 migration/fd.c                |  1 +
 migration/migration.c         | 50 -------------------------------
 migration/socket.c            |  1 +
 migration/tls.c               |  1 +
 9 files changed, 99 insertions(+), 58 deletions(-)
 create mode 100644 include/migration/channel.h
 create mode 100644 migration/channel.c

diff --git a/include/migration/channel.h b/include/migration/channel.h
new file mode 100644
index 0000000..618acb7
--- /dev/null
+++ b/include/migration/channel.h
@@ -0,0 +1,25 @@
+/*
+ * QEMU live migration channel functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_CHANNEL_H
+#define QEMU_MIGRATION_CHANNEL_H
+
+#include "io/channel.h"
+
+void migration_channel_process_incoming(MigrationState *s,
+                                        QIOChannel *ioc);
+
+void migration_channel_connect(MigrationState *s,
+                               QIOChannel *ioc,
+                               const char *hostname);
+#endif
diff --git a/include/migration/migration.h b/include/migration/migration.h
index fabfb32..3f54a7c 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -183,17 +183,10 @@ void migrate_set_state(int *state, int old_state, int new_state);
 
 void migration_fd_process_incoming(QEMUFile *f);
 
-void migration_channel_process_incoming(MigrationState *s,
-                                        QIOChannel *ioc);
-
 void migration_tls_channel_process_incoming(MigrationState *s,
                                             QIOChannel *ioc,
                                             Error **errp);
 
-void migration_channel_connect(MigrationState *s,
-                               QIOChannel *ioc,
-                               const char *hostname);
-
 void migration_tls_channel_connect(MigrationState *s,
                                    QIOChannel *ioc,
                                    const char *hostname,
diff --git a/migration/Makefile.objs b/migration/Makefile.objs
index 480dd49..c83ca92 100644
--- a/migration/Makefile.objs
+++ b/migration/Makefile.objs
@@ -1,5 +1,5 @@
 common-obj-y += migration.o socket.o fd.o exec.o
-common-obj-y += tls.o
+common-obj-y += tls.o channel.o
 common-obj-y += colo-comm.o colo.o colo-failover.o
 common-obj-y += vmstate.o
 common-obj-y += qemu-file.o
diff --git a/migration/channel.c b/migration/channel.c
new file mode 100644
index 0000000..c66c6db
--- /dev/null
+++ b/migration/channel.c
@@ -0,0 +1,69 @@
+/*
+ * QEMU live migration
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ * Contributions after 2012-01-13 are licensed under the terms of the
+ * GNU GPL, version 2 or (at your option) any later version.
+ */
+
+#include "qemu/osdep.h"
+#include "migration/channel.h"
+#include "migration/migration.h"
+#include "trace.h"
+#include "qapi/error.h"
+#include "io/channel-tls.h"
+
+void migration_channel_process_incoming(MigrationState *s,
+                                        QIOChannel *ioc)
+{
+    trace_migration_set_incoming_channel(
+        ioc, object_get_typename(OBJECT(ioc)));
+
+    if (s->parameters.tls_creds &&
+        *s->parameters.tls_creds &&
+        !object_dynamic_cast(OBJECT(ioc),
+                             TYPE_QIO_CHANNEL_TLS)) {
+        Error *local_err = NULL;
+        migration_tls_channel_process_incoming(s, ioc, &local_err);
+        if (local_err) {
+            error_report_err(local_err);
+        }
+    } else {
+        QEMUFile *f = qemu_fopen_channel_input(ioc);
+        migration_fd_process_incoming(f);
+    }
+}
+
+
+void migration_channel_connect(MigrationState *s,
+                               QIOChannel *ioc,
+                               const char *hostname)
+{
+    trace_migration_set_outgoing_channel(
+        ioc, object_get_typename(OBJECT(ioc)), hostname);
+
+    if (s->parameters.tls_creds &&
+        *s->parameters.tls_creds &&
+        !object_dynamic_cast(OBJECT(ioc),
+                             TYPE_QIO_CHANNEL_TLS)) {
+        Error *local_err = NULL;
+        migration_tls_channel_connect(s, ioc, hostname, &local_err);
+        if (local_err) {
+            migrate_fd_error(s, local_err);
+            error_free(local_err);
+        }
+    } else {
+        QEMUFile *f = qemu_fopen_channel_output(ioc);
+
+        s->to_dst_file = f;
+
+        migrate_fd_connect(s);
+    }
+}
diff --git a/migration/exec.c b/migration/exec.c
index 9157721..7d13fc3 100644
--- a/migration/exec.c
+++ b/migration/exec.c
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
+#include "migration/channel.h"
 #include "migration/migration.h"
 #include "io/channel-command.h"
 #include "trace.h"
diff --git a/migration/fd.c b/migration/fd.c
index 58cb51a..f9c230e 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -17,6 +17,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
+#include "migration/channel.h"
 #include "migration/migration.h"
 #include "monitor/monitor.h"
 #include "io/channel-util.h"
diff --git a/migration/migration.c b/migration/migration.c
index d3fe93d..17d22eb 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -463,56 +463,6 @@ void migration_fd_process_incoming(QEMUFile *f)
     qemu_coroutine_enter(co);
 }
 
-
-void migration_channel_process_incoming(MigrationState *s,
-                                        QIOChannel *ioc)
-{
-    trace_migration_set_incoming_channel(
-        ioc, object_get_typename(OBJECT(ioc)));
-
-    if (s->parameters.tls_creds &&
-        *s->parameters.tls_creds &&
-        !object_dynamic_cast(OBJECT(ioc),
-                             TYPE_QIO_CHANNEL_TLS)) {
-        Error *local_err = NULL;
-        migration_tls_channel_process_incoming(s, ioc, &local_err);
-        if (local_err) {
-            error_report_err(local_err);
-        }
-    } else {
-        QEMUFile *f = qemu_fopen_channel_input(ioc);
-        migration_fd_process_incoming(f);
-    }
-}
-
-
-void migration_channel_connect(MigrationState *s,
-                               QIOChannel *ioc,
-                               const char *hostname)
-{
-    trace_migration_set_outgoing_channel(
-        ioc, object_get_typename(OBJECT(ioc)), hostname);
-
-    if (s->parameters.tls_creds &&
-        *s->parameters.tls_creds &&
-        !object_dynamic_cast(OBJECT(ioc),
-                             TYPE_QIO_CHANNEL_TLS)) {
-        Error *local_err = NULL;
-        migration_tls_channel_connect(s, ioc, hostname, &local_err);
-        if (local_err) {
-            migrate_fd_error(s, local_err);
-            error_free(local_err);
-        }
-    } else {
-        QEMUFile *f = qemu_fopen_channel_output(ioc);
-
-        s->to_dst_file = f;
-
-        migrate_fd_connect(s);
-    }
-}
-
-
 /*
  * Send a message on the return channel back to the source
  * of the migration.
diff --git a/migration/socket.c b/migration/socket.c
index dc88812..7171635 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -19,6 +19,7 @@
 #include "qemu-common.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
+#include "migration/channel.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
 #include "io/channel-socket.h"
diff --git a/migration/tls.c b/migration/tls.c
index a33ecb7..4ee3349 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -19,6 +19,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "migration/channel.h"
 #include "migration/migration.h"
 #include "io/channel-tls.h"
 #include "crypto/tlscreds.h"
-- 
2.9.3

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

* [Qemu-devel] [PATCH 04/19] migration: Remove MigrationState from migration_channel_incomming()
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
                   ` (2 preceding siblings ...)
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 03/19] migration: Split migration/channel.c for channel operations Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 05/19] migration: Export exec.c functions in its own file Juan Quintela
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/channel.h | 3 +--
 migration/channel.c         | 5 +++--
 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/include/migration/channel.h b/include/migration/channel.h
index 618acb7..fbc4bfb 100644
--- a/include/migration/channel.h
+++ b/include/migration/channel.h
@@ -16,8 +16,7 @@
 
 #include "io/channel.h"
 
-void migration_channel_process_incoming(MigrationState *s,
-                                        QIOChannel *ioc);
+void migration_channel_process_incoming(QIOChannel *ioc);
 
 void migration_channel_connect(MigrationState *s,
                                QIOChannel *ioc,
diff --git a/migration/channel.c b/migration/channel.c
index c66c6db..6f11a1a 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -20,9 +20,10 @@
 #include "qapi/error.h"
 #include "io/channel-tls.h"
 
-void migration_channel_process_incoming(MigrationState *s,
-                                        QIOChannel *ioc)
+void migration_channel_process_incoming(QIOChannel *ioc)
 {
+    MigrationState *s = migrate_get_current();
+
     trace_migration_set_incoming_channel(
         ioc, object_get_typename(OBJECT(ioc)));
 
diff --git a/migration/exec.c b/migration/exec.c
index 7d13fc3..2779c9c 100644
--- a/migration/exec.c
+++ b/migration/exec.c
@@ -48,7 +48,7 @@ static gboolean exec_accept_incoming_migration(QIOChannel *ioc,
                                                GIOCondition condition,
                                                gpointer opaque)
 {
-    migration_channel_process_incoming(migrate_get_current(), ioc);
+    migration_channel_process_incoming(ioc);
     object_unref(OBJECT(ioc));
     return FALSE; /* unregister */
 }
diff --git a/migration/fd.c b/migration/fd.c
index f9c230e..fba3852 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -48,7 +48,7 @@ static gboolean fd_accept_incoming_migration(QIOChannel *ioc,
                                              GIOCondition condition,
                                              gpointer opaque)
 {
-    migration_channel_process_incoming(migrate_get_current(), ioc);
+    migration_channel_process_incoming(ioc);
     object_unref(OBJECT(ioc));
     return FALSE; /* unregister */
 }
diff --git a/migration/socket.c b/migration/socket.c
index 7171635..b06cde3 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -149,8 +149,7 @@ static gboolean socket_accept_incoming_migration(QIOChannel *ioc,
     trace_migration_socket_incoming_accepted();
 
     qio_channel_set_name(QIO_CHANNEL(sioc), "migration-socket-incoming");
-    migration_channel_process_incoming(migrate_get_current(),
-                                       QIO_CHANNEL(sioc));
+    migration_channel_process_incoming(QIO_CHANNEL(sioc));
     object_unref(OBJECT(sioc));
 
 out:
diff --git a/migration/tls.c b/migration/tls.c
index 4ee3349..2b28ebd 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -73,7 +73,7 @@ static void migration_tls_incoming_handshake(QIOTask *task,
         error_report_err(err);
     } else {
         trace_migration_tls_incoming_handshake_complete();
-        migration_channel_process_incoming(migrate_get_current(), ioc);
+        migration_channel_process_incoming(ioc);
     }
     object_unref(OBJECT(ioc));
 }
-- 
2.9.3

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

* [Qemu-devel] [PATCH 05/19] migration: Export exec.c functions in its own file
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
                   ` (3 preceding siblings ...)
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 04/19] migration: Remove MigrationState from migration_channel_incomming() Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-18  9:45   ` Paolo Bonzini
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 06/19] migration: Export fd.c " Juan Quintela
                   ` (13 subsequent siblings)
  18 siblings, 1 reply; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/exec.h      | 20 ++++++++++++++++++++
 include/migration/migration.h |  4 ----
 migration/exec.c              |  2 +-
 migration/migration.c         |  1 +
 4 files changed, 22 insertions(+), 5 deletions(-)
 create mode 100644 include/migration/exec.h

diff --git a/include/migration/exec.h b/include/migration/exec.h
new file mode 100644
index 0000000..c97a7e9
--- /dev/null
+++ b/include/migration/exec.h
@@ -0,0 +1,20 @@
+/*
+ * QEMU live migration exec functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_EXEC_H
+#define QEMU_MIGRATION_EXEC_H
+void exec_start_incoming_migration(const char *host_port, Error **errp);
+
+void exec_start_outgoing_migration(MigrationState *s, const char *host_port,
+                                   Error **errp);
+#endif
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 3f54a7c..eb0150b 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -194,10 +194,6 @@ void migration_tls_channel_connect(MigrationState *s,
 
 uint64_t migrate_max_downtime(void);
 
-void exec_start_incoming_migration(const char *host_port, Error **errp);
-
-void exec_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp);
-
 void tcp_start_incoming_migration(const char *host_port, Error **errp);
 
 void tcp_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp);
diff --git a/migration/exec.c b/migration/exec.c
index 2779c9c..1a2d5c2 100644
--- a/migration/exec.c
+++ b/migration/exec.c
@@ -21,7 +21,7 @@
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "migration/channel.h"
-#include "migration/migration.h"
+#include "migration/exec.h"
 #include "io/channel-command.h"
 #include "trace.h"
 
diff --git a/migration/migration.c b/migration/migration.c
index 17d22eb..076c42a 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -21,6 +21,7 @@
 #include "migration/machine.h"
 #include "migration/state.h"
 #include "migration/init.h"
+#include "migration/exec.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
 #include "sysemu/sysemu.h"
-- 
2.9.3

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

* [Qemu-devel] [PATCH 06/19] migration: Export fd.c functions in its own file
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
                   ` (4 preceding siblings ...)
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 05/19] migration: Export exec.c functions in its own file Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 07/19] migration: Export socket.c " Juan Quintela
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/fd.h        | 20 ++++++++++++++++++++
 include/migration/migration.h |  4 ----
 migration/fd.c                |  2 +-
 migration/migration.c         |  1 +
 4 files changed, 22 insertions(+), 5 deletions(-)
 create mode 100644 include/migration/fd.h

diff --git a/include/migration/fd.h b/include/migration/fd.h
new file mode 100644
index 0000000..4ec3298
--- /dev/null
+++ b/include/migration/fd.h
@@ -0,0 +1,20 @@
+/*
+ * QEMU live migration fd functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_FD_H
+#define QEMU_MIGRATION_FD_H
+void fd_start_incoming_migration(const char *path, Error **errp);
+
+void fd_start_outgoing_migration(MigrationState *s, const char *fdname,
+                                 Error **errp);
+#endif
diff --git a/include/migration/migration.h b/include/migration/migration.h
index eb0150b..077b75b 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -202,10 +202,6 @@ void unix_start_incoming_migration(const char *path, Error **errp);
 
 void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp);
 
-void fd_start_incoming_migration(const char *path, Error **errp);
-
-void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp);
-
 void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp);
 
 void rdma_start_incoming_migration(const char *host_port, Error **errp);
diff --git a/migration/fd.c b/migration/fd.c
index fba3852..78ebd5b 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -18,7 +18,7 @@
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "migration/channel.h"
-#include "migration/migration.h"
+#include "migration/fd.h"
 #include "monitor/monitor.h"
 #include "io/channel-util.h"
 #include "trace.h"
diff --git a/migration/migration.c b/migration/migration.c
index 076c42a..a608faa 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -22,6 +22,7 @@
 #include "migration/state.h"
 #include "migration/init.h"
 #include "migration/exec.h"
+#include "migration/fd.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
 #include "sysemu/sysemu.h"
-- 
2.9.3

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

* [Qemu-devel] [PATCH 07/19] migration: Export socket.c functions in its own file
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
                   ` (5 preceding siblings ...)
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 06/19] migration: Export fd.c " Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-19 15:37   ` Dr. David Alan Gilbert
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 08/19] migration: Export tls.c " Juan Quintela
                   ` (11 subsequent siblings)
  18 siblings, 1 reply; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/migration.h |  8 --------
 include/migration/socket.h    | 25 +++++++++++++++++++++++++
 migration/migration.c         |  1 +
 migration/socket.c            |  1 +
 4 files changed, 27 insertions(+), 8 deletions(-)
 create mode 100644 include/migration/socket.h

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 077b75b..0c6dae5 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -194,14 +194,6 @@ void migration_tls_channel_connect(MigrationState *s,
 
 uint64_t migrate_max_downtime(void);
 
-void tcp_start_incoming_migration(const char *host_port, Error **errp);
-
-void tcp_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp);
-
-void unix_start_incoming_migration(const char *path, Error **errp);
-
-void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp);
-
 void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp);
 
 void rdma_start_incoming_migration(const char *host_port, Error **errp);
diff --git a/include/migration/socket.h b/include/migration/socket.h
new file mode 100644
index 0000000..800fde1
--- /dev/null
+++ b/include/migration/socket.h
@@ -0,0 +1,25 @@
+/*
+ * QEMU live migration socket functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_SOCKET_H
+#define QEMU_MIGRATION_SOCKET_H
+void tcp_start_incoming_migration(const char *host_port, Error **errp);
+
+void tcp_start_outgoing_migration(MigrationState *s, const char *host_port,
+                                  Error **errp);
+
+void unix_start_incoming_migration(const char *path, Error **errp);
+
+void unix_start_outgoing_migration(MigrationState *s, const char *path,
+                                   Error **errp);
+#endif
diff --git a/migration/migration.c b/migration/migration.c
index a608faa..181839b 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -23,6 +23,7 @@
 #include "migration/init.h"
 #include "migration/exec.h"
 #include "migration/fd.h"
+#include "migration/socket.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
 #include "sysemu/sysemu.h"
diff --git a/migration/socket.c b/migration/socket.c
index b06cde3..71a8439 100644
--- a/migration/socket.c
+++ b/migration/socket.c
@@ -20,6 +20,7 @@
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "migration/channel.h"
+#include "migration/socket.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
 #include "io/channel-socket.h"
-- 
2.9.3

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

* [Qemu-devel] [PATCH 08/19] migration: Export tls.c functions in its own file
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
                   ` (6 preceding siblings ...)
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 07/19] migration: Export socket.c " Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 09/19] migration: Create block capabilities for shared and enable Juan Quintela
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

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

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/migration.h |  9 ---------
 include/migration/tls.h       | 27 +++++++++++++++++++++++++++
 migration/channel.c           |  1 +
 migration/migration.c         |  1 -
 migration/tls.c               |  1 +
 5 files changed, 29 insertions(+), 10 deletions(-)
 create mode 100644 include/migration/tls.h

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 0c6dae5..d6f2e94 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -183,15 +183,6 @@ void migrate_set_state(int *state, int old_state, int new_state);
 
 void migration_fd_process_incoming(QEMUFile *f);
 
-void migration_tls_channel_process_incoming(MigrationState *s,
-                                            QIOChannel *ioc,
-                                            Error **errp);
-
-void migration_tls_channel_connect(MigrationState *s,
-                                   QIOChannel *ioc,
-                                   const char *hostname,
-                                   Error **errp);
-
 uint64_t migrate_max_downtime(void);
 
 void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp);
diff --git a/include/migration/tls.h b/include/migration/tls.h
new file mode 100644
index 0000000..1d63263
--- /dev/null
+++ b/include/migration/tls.h
@@ -0,0 +1,27 @@
+/*
+ * QEMU live migration tls functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_TLS_H
+#define QEMU_MIGRATION_TLS_H
+
+#include "io/channel.h"
+
+void migration_tls_channel_process_incoming(MigrationState *s,
+                                            QIOChannel *ioc,
+                                            Error **errp);
+
+void migration_tls_channel_connect(MigrationState *s,
+                                   QIOChannel *ioc,
+                                   const char *hostname,
+                                   Error **errp);
+#endif
diff --git a/migration/channel.c b/migration/channel.c
index 6f11a1a..10416e0 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -15,6 +15,7 @@
 
 #include "qemu/osdep.h"
 #include "migration/channel.h"
+#include "migration/tls.h"
 #include "migration/migration.h"
 #include "trace.h"
 #include "qapi/error.h"
diff --git a/migration/migration.c b/migration/migration.c
index 181839b..ce34be5 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -42,7 +42,6 @@
 #include "exec/memory.h"
 #include "exec/address-spaces.h"
 #include "io/channel-buffer.h"
-#include "io/channel-tls.h"
 #include "migration/colo.h"
 
 #define MAX_THROTTLE  (32 << 20)      /* Migration transfer speed throttling */
diff --git a/migration/tls.c b/migration/tls.c
index 2b28ebd..b9e1791 100644
--- a/migration/tls.c
+++ b/migration/tls.c
@@ -21,6 +21,7 @@
 #include "qemu/osdep.h"
 #include "migration/channel.h"
 #include "migration/migration.h"
+#include "migration/tls.h"
 #include "io/channel-tls.h"
 #include "crypto/tlscreds.h"
 #include "qemu/error-report.h"
-- 
2.9.3

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

* [Qemu-devel] [PATCH 09/19] migration: Create block capabilities for shared and enable
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
                   ` (7 preceding siblings ...)
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 08/19] migration: Export tls.c " Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-17 20:26   ` Eric Blake
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 10/19] migration: Remove use of old MigrationParams Juan Quintela
                   ` (9 subsequent siblings)
  18 siblings, 1 reply; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

This two capabilites were added through the command line.  Notice that
we just created them.  This is just the boilerplate.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/migration.h |  3 +++
 migration/migration.c         | 36 ++++++++++++++++++++++++++++++++++++
 qapi-schema.json              |  7 ++++++-
 3 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/include/migration/migration.h b/include/migration/migration.h
index d6f2e94..5c78ae1 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -242,6 +242,9 @@ bool migrate_colo_enabled(void);
 
 int64_t xbzrle_cache_resize(int64_t new_size);
 
+bool migrate_use_block_enabled(void);
+bool migrate_use_block_shared(void);
+
 bool migrate_use_compression(void);
 int migrate_compress_level(void);
 int migrate_compress_threads(void);
diff --git a/migration/migration.c b/migration/migration.c
index ce34be5..2f10657 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1151,6 +1151,16 @@ bool migration_is_blocked(Error **errp)
     return false;
 }
 
+static void migrate_set_block_shared(MigrationState *s)
+{
+    s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK_SHARED] = true;
+}
+
+static void migrate_set_block_enabled(MigrationState *s)
+{
+    s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK_ENABLED] = true;
+}
+
 void qmp_migrate(const char *uri, bool has_blk, bool blk,
                  bool has_inc, bool inc, bool has_detach, bool detach,
                  Error **errp)
@@ -1180,6 +1190,14 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
 
     s = migrate_init(&params);
 
+    if (has_blk && blk) {
+        migrate_set_block_enabled(s);
+    }
+
+    if (has_inc && inc) {
+        migrate_set_block_shared(s);
+    }
+
     if (strstart(uri, "tcp:", &p)) {
         tcp_start_outgoing_migration(s, p, &local_err);
 #ifdef CONFIG_RDMA
@@ -1375,6 +1393,24 @@ int64_t migrate_xbzrle_cache_size(void)
     return s->xbzrle_cache_size;
 }
 
+bool migrate_use_block_enabled(void)
+{
+    MigrationState *s;
+
+    s = migrate_get_current();
+
+    return s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK_ENABLED];
+}
+
+bool migrate_use_block_shared(void)
+{
+    MigrationState *s;
+
+    s = migrate_get_current();
+
+    return s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK_SHARED];
+}
+
 /* migration thread support */
 /*
  * Something bad happened to the RP stream, mark an error
diff --git a/qapi-schema.json b/qapi-schema.json
index 01b087f..e963bb3 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -894,11 +894,16 @@
 # @release-ram: if enabled, qemu will free the migrated ram pages on the source
 #        during postcopy-ram migration. (since 2.9)
 #
+# @block-enabled: enable block migration (Since 2.10)
+#
+# @block-shared: enable block shared migration (Since 2.10)
+#
 # Since: 1.2
 ##
 { 'enum': 'MigrationCapability',
   'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
-           'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram'] }
+           'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram',
+           'block-enabled', 'block-shared' ] }
 
 ##
 # @MigrationCapabilityStatus:
-- 
2.9.3

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

* [Qemu-devel] [PATCH 10/19] migration: Remove use of old MigrationParams
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
                   ` (8 preceding siblings ...)
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 09/19] migration: Create block capabilities for shared and enable Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-18 19:07   ` Dr. David Alan Gilbert
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 11/19] migration: Remove " Juan Quintela
                   ` (8 subsequent siblings)
  18 siblings, 1 reply; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

We have change in the previous patch to use migration capabilities for
it.  Notice that we continue using the old command line flags from
migrate command from the time being.  Remove the set_params method as
now it is empty.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/migration.h |  2 --
 migration/block.c             | 17 ++---------------
 migration/colo.c              |  3 ---
 migration/migration.c         |  8 +++++---
 migration/savevm.c            |  2 --
 5 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 5c78ae1..09d3188 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -41,8 +41,6 @@
 extern int only_migratable;
 
 struct MigrationParams {
-    bool blk;
-    bool shared;
 };
 
 /* Messages sent on the return path from destination to source */
diff --git a/migration/block.c b/migration/block.c
index 7734ff7..9490343 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -94,9 +94,6 @@ typedef struct BlkMigBlock {
 } BlkMigBlock;
 
 typedef struct BlkMigState {
-    /* Written during setup phase.  Can be read without a lock.  */
-    int blk_enable;
-    int shared_base;
     QSIMPLEQ_HEAD(bmds_list, BlkMigDevState) bmds_list;
     int64_t total_sector_sum;
     bool zero_blocks;
@@ -425,7 +422,7 @@ static int init_blk_migration(QEMUFile *f)
         bmds->bulk_completed = 0;
         bmds->total_sectors = sectors;
         bmds->completed_sectors = 0;
-        bmds->shared_base = block_mig_state.shared_base;
+        bmds->shared_base = migrate_use_block_shared();
 
         assert(i < num_bs);
         bmds_bs[i].bmds = bmds;
@@ -963,22 +960,12 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
     return 0;
 }
 
-static void block_set_params(const MigrationParams *params, void *opaque)
-{
-    block_mig_state.blk_enable = params->blk;
-    block_mig_state.shared_base = params->shared;
-
-    /* shared base means that blk_enable = 1 */
-    block_mig_state.blk_enable |= params->shared;
-}
-
 static bool block_is_active(void *opaque)
 {
-    return block_mig_state.blk_enable == 1;
+    return migrate_use_block_enabled();
 }
 
 static SaveVMHandlers savevm_block_handlers = {
-    .set_params = block_set_params,
     .save_live_setup = block_save_setup,
     .save_live_iterate = block_save_iterate,
     .save_live_complete_precopy = block_save_complete,
diff --git a/migration/colo.c b/migration/colo.c
index eec1959..4c2365e 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -333,9 +333,6 @@ static int colo_do_checkpoint_transaction(MigrationState *s,
         goto out;
     }
 
-    /* Disable block migration */
-    s->params.blk = 0;
-    s->params.shared = 0;
     qemu_savevm_state_header(fb);
     qemu_savevm_state_begin(fb, &s->params);
     qemu_mutex_lock_iothread();
diff --git a/migration/migration.c b/migration/migration.c
index 2f10657..39b4a41 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -743,6 +743,10 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
         s->enabled_capabilities[cap->value->capability] = cap->value->state;
     }
 
+    if (s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK_SHARED]) {
+        s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK_ENABLED] = true;
+    }
+
     if (migrate_postcopy_ram()) {
         if (migrate_use_compression()) {
             /* The decompression threads asynchronously write into RAM
@@ -1170,9 +1174,6 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
     MigrationParams params;
     const char *p;
 
-    params.blk = has_blk && blk;
-    params.shared = has_inc && inc;
-
     if (migration_is_setup_or_active(s->state) ||
         s->state == MIGRATION_STATUS_CANCELLING ||
         s->state == MIGRATION_STATUS_COLO) {
@@ -1195,6 +1196,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
     }
 
     if (has_inc && inc) {
+        migrate_set_block_enabled(s);
         migrate_set_block_shared(s);
     }
 
diff --git a/migration/savevm.c b/migration/savevm.c
index c47b209..c4435e1 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1237,8 +1237,6 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
 {
     int ret;
     MigrationParams params = {
-        .blk = 0,
-        .shared = 0
     };
     MigrationState *ms = migrate_init(&params);
     MigrationStatus status;
-- 
2.9.3

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

* [Qemu-devel] [PATCH 11/19] migration: Remove old MigrationParams
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
                   ` (9 preceding siblings ...)
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 10/19] migration: Remove use of old MigrationParams Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 12/19] migration: Remove unneeded includes Juan Quintela
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

Not used anymore after moving block migration to use capabilities.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/migration.h | 10 +++-------
 include/migration/vmstate.h   |  1 -
 include/qemu/typedefs.h       |  1 -
 include/sysemu/sysemu.h       |  3 +--
 migration/colo.c              |  2 +-
 migration/migration.c         |  8 +++-----
 migration/savevm.c            | 16 +++-------------
 7 files changed, 11 insertions(+), 30 deletions(-)

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 09d3188..3353de1 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -40,9 +40,6 @@
 /* for vl.c */
 extern int only_migratable;
 
-struct MigrationParams {
-};
-
 /* Messages sent on the return path from destination to source */
 enum mig_rp_message_type {
     MIG_RP_MSG_INVALID = 0,  /* Must be 0 */
@@ -132,12 +129,10 @@ struct MigrationState
     QEMUBH *cleanup_bh;
     QEMUFile *to_dst_file;
 
-    /* New style params from 'migrate-set-parameters' */
+    /* params from 'migrate-set-parameters' */
     MigrationParameters parameters;
 
     int state;
-    /* Old style params from 'migrate' command */
-    MigrationParams params;
 
     /* State related to return path */
     struct {
@@ -191,7 +186,8 @@ void migrate_fd_error(MigrationState *s, const Error *error);
 
 void migrate_fd_connect(MigrationState *s);
 
-MigrationState *migrate_init(const MigrationParams *params);
+MigrationState *migrate_init(void);
+
 bool migration_is_blocked(Error **errp);
 /* True if outgoing migration has entered postcopy phase */
 bool migration_in_postcopy(void);
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 624aa0d..f4c5bed 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -37,7 +37,6 @@ typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
 
 typedef struct SaveVMHandlers {
     /* This runs inside the iothread lock.  */
-    void (*set_params)(const MigrationParams *params, void * opaque);
     SaveStateHandler *save_state;
 
     void (*cleanup)(void *opaque);
diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index e95f28c..7e6021c 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -48,7 +48,6 @@ typedef struct MemoryRegion MemoryRegion;
 typedef struct MemoryRegionCache MemoryRegionCache;
 typedef struct MemoryRegionSection MemoryRegionSection;
 typedef struct MigrationIncomingState MigrationIncomingState;
-typedef struct MigrationParams MigrationParams;
 typedef struct MigrationState MigrationState;
 typedef struct Monitor Monitor;
 typedef struct MonitorDef MonitorDef;
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 16175f7..5f2f21d 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -105,8 +105,7 @@ enum qemu_vm_cmd {
 #define MAX_VM_CMD_PACKAGED_SIZE (1ul << 24)
 
 bool qemu_savevm_state_blocked(Error **errp);
-void qemu_savevm_state_begin(QEMUFile *f,
-                             const MigrationParams *params);
+void qemu_savevm_state_begin(QEMUFile *f);
 void qemu_savevm_state_header(QEMUFile *f);
 int qemu_savevm_state_iterate(QEMUFile *f, bool postcopy);
 void qemu_savevm_state_cleanup(void);
diff --git a/migration/colo.c b/migration/colo.c
index 4c2365e..2924602 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -334,7 +334,7 @@ static int colo_do_checkpoint_transaction(MigrationState *s,
     }
 
     qemu_savevm_state_header(fb);
-    qemu_savevm_state_begin(fb, &s->params);
+    qemu_savevm_state_begin(fb);
     qemu_mutex_lock_iothread();
     qemu_savevm_state_complete_precopy(fb, false);
     qemu_mutex_unlock_iothread();
diff --git a/migration/migration.c b/migration/migration.c
index 39b4a41..9ab66b6 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1058,7 +1058,7 @@ bool migration_is_idle(void)
     return false;
 }
 
-MigrationState *migrate_init(const MigrationParams *params)
+MigrationState *migrate_init(void)
 {
     MigrationState *s = migrate_get_current();
 
@@ -1072,7 +1072,6 @@ MigrationState *migrate_init(const MigrationParams *params)
     s->cleanup_bh = 0;
     s->to_dst_file = NULL;
     s->state = MIGRATION_STATUS_NONE;
-    s->params = *params;
     s->rp_state.from_dst_file = NULL;
     s->rp_state.error = false;
     s->mbps = 0.0;
@@ -1171,7 +1170,6 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
 {
     Error *local_err = NULL;
     MigrationState *s = migrate_get_current();
-    MigrationParams params;
     const char *p;
 
     if (migration_is_setup_or_active(s->state) ||
@@ -1189,7 +1187,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
         return;
     }
 
-    s = migrate_init(&params);
+    s = migrate_init();
 
     if (has_blk && blk) {
         migrate_set_block_enabled(s);
@@ -1917,7 +1915,7 @@ static void *migration_thread(void *opaque)
         qemu_savevm_send_postcopy_advise(s->to_dst_file);
     }
 
-    qemu_savevm_state_begin(s->to_dst_file, &s->params);
+    qemu_savevm_state_begin(s->to_dst_file);
 
     s->setup_time = qemu_clock_get_ms(QEMU_CLOCK_HOST) - setup_start;
     current_active_state = MIGRATION_STATUS_ACTIVE;
diff --git a/migration/savevm.c b/migration/savevm.c
index c4435e1..96cf6db 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -970,21 +970,13 @@ void qemu_savevm_state_header(QEMUFile *f)
 
 }
 
-void qemu_savevm_state_begin(QEMUFile *f,
-                             const MigrationParams *params)
+void qemu_savevm_state_begin(QEMUFile *f)
 {
     SaveStateEntry *se;
     int ret;
 
     trace_savevm_state_begin();
     QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
-        if (!se->ops || !se->ops->set_params) {
-            continue;
-        }
-        se->ops->set_params(params, se->opaque);
-    }
-
-    QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {
         if (!se->ops || !se->ops->save_live_setup) {
             continue;
         }
@@ -1236,9 +1228,7 @@ void qemu_savevm_state_cleanup(void)
 static int qemu_savevm_state(QEMUFile *f, Error **errp)
 {
     int ret;
-    MigrationParams params = {
-    };
-    MigrationState *ms = migrate_init(&params);
+    MigrationState *ms = migrate_init();
     MigrationStatus status;
     ms->to_dst_file = f;
 
@@ -1249,7 +1239,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
 
     qemu_mutex_unlock_iothread();
     qemu_savevm_state_header(f);
-    qemu_savevm_state_begin(f, &params);
+    qemu_savevm_state_begin(f);
     qemu_mutex_lock_iothread();
 
     while (qemu_file_get_error(f) == 0) {
-- 
2.9.3

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

* [Qemu-devel] [PATCH 12/19] migration: Remove unneeded includes
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
                   ` (10 preceding siblings ...)
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 11/19] migration: Remove " Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 13/19] migration: Remove qemu-file.h from vmstate.h Juan Quintela
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

I just removed includes that allow me to still compile everything.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/colo.h  | 3 ---
 migration/block.c         | 7 -------
 migration/colo-comm.c     | 1 -
 migration/colo-failover.c | 1 +
 migration/colo.c          | 2 --
 migration/exec.c          | 1 -
 migration/fd.c            | 1 -
 migration/migration.c     | 5 -----
 migration/postcopy-ram.c  | 2 --
 migration/qemu-file.c     | 4 +---
 migration/ram.c           | 2 --
 migration/rdma.c          | 1 -
 migration/savevm.c        | 5 -----
 13 files changed, 2 insertions(+), 33 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/migration/block.c b/migration/block.c
index 9490343..0722837 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -15,17 +15,10 @@
 
 #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 "migration/block.h"
 #include "migration/migration.h"
-#include "sysemu/blockdev.h"
 #include "sysemu/block-backend.h"
 
 #define BLOCK_SIZE                       (1 << 20)
diff --git a/migration/colo-comm.c b/migration/colo-comm.c
index 3d91798..4161242 100644
--- a/migration/colo-comm.c
+++ b/migration/colo-comm.c
@@ -14,7 +14,6 @@
 #include "qemu/osdep.h"
 #include "migration/migration.h"
 #include "migration/colo.h"
-#include "trace.h"
 
 typedef struct {
      bool colo_requested;
diff --git a/migration/colo-failover.c b/migration/colo-failover.c
index cc229f5..1c0025b 100644
--- a/migration/colo-failover.c
+++ b/migration/colo-failover.c
@@ -11,6 +11,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/main-loop.h"
 #include "migration/colo.h"
 #include "migration/failover.h"
 #include "qmp-commands.h"
diff --git a/migration/colo.c b/migration/colo.c
index 2924602..d455884 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -11,14 +11,12 @@
  */
 
 #include "qemu/osdep.h"
-#include "qemu/timer.h"
 #include "sysemu/sysemu.h"
 #include "migration/migration.h"
 #include "migration/colo.h"
 #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 1a2d5c2..7939c95 100644
--- a/migration/exec.c
+++ b/migration/exec.c
@@ -19,7 +19,6 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
 #include "migration/channel.h"
 #include "migration/exec.h"
 #include "io/channel-command.h"
diff --git a/migration/fd.c b/migration/fd.c
index 78ebd5b..ae41b06 100644
--- a/migration/fd.c
+++ b/migration/fd.c
@@ -16,7 +16,6 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qemu-common.h"
 #include "migration/channel.h"
 #include "migration/fd.h"
 #include "monitor/monitor.h"
diff --git a/migration/migration.c b/migration/migration.c
index 9ab66b6..9990c46 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 "migration/machine.h"
 #include "migration/state.h"
@@ -30,7 +29,6 @@
 #include "block/block.h"
 #include "qapi/qmp/qerror.h"
 #include "qapi/util.h"
-#include "qemu/sockets.h"
 #include "qemu/rcu.h"
 #include "migration/block.h"
 #include "migration/postcopy-ram.h"
@@ -38,9 +36,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 "io/channel-buffer.h"
 #include "migration/colo.h"
 
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 85fd8d7..11b24c6 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -17,8 +17,6 @@
  */
 
 #include "qemu/osdep.h"
-
-#include "qemu-common.h"
 #include "migration/migration.h"
 #include "migration/postcopy-ram.h"
 #include "sysemu/sysemu.h"
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index 195fa94..460e536 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -26,10 +26,8 @@
 #include "qemu-common.h"
 #include "qemu/error-report.h"
 #include "qemu/iov.h"
-#include "qemu/sockets.h"
-#include "qemu/coroutine.h"
-#include "migration/migration.h"
 #include "migration/qemu-file.h"
+#include "migration/migration.h"
 #include "trace.h"
 
 #define IO_BUF_SIZE 32768
diff --git a/migration/ram.c b/migration/ram.c
index 1bd8599..4f49622 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -33,13 +33,11 @@
 #include "qemu/cutils.h"
 #include "qemu/bitops.h"
 #include "qemu/bitmap.h"
-#include "qemu/timer.h"
 #include "qemu/main-loop.h"
 #include "migration/xbzrle.h"
 #include "migration/init.h"
 #include "migration/migration.h"
 #include "migration/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/rdma.c b/migration/rdma.c
index 674ccab..94d4840 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -19,7 +19,6 @@
 #include "qemu/cutils.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
-#include "exec/cpu-common.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
 #include "qemu/sockets.h"
diff --git a/migration/savevm.c b/migration/savevm.c
index 96cf6db..b03973a 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -29,13 +29,10 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "hw/boards.h"
-#include "hw/hw.h"
-#include "hw/qdev.h"
 #include "hw/xen/xen.h"
 #include "net/net.h"
 #include "monitor/monitor.h"
 #include "sysemu/sysemu.h"
-#include "qemu/timer.h"
 #include "audio/audio.h"
 #include "migration/machine.h"
 #include "migration/migration.h"
@@ -43,11 +40,9 @@
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
-#include "qemu/queue.h"
 #include "sysemu/cpus.h"
 #include "qmp-commands.h"
 #include "trace.h"
-#include "qemu/bitops.h"
 #include "qemu/iov.h"
 #include "block/snapshot.h"
 #include "block/qapi.h"
-- 
2.9.3

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

* [Qemu-devel] [PATCH 13/19] migration: Remove qemu-file.h from vmstate.h
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
                   ` (11 preceding siblings ...)
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 12/19] migration: Remove unneeded includes Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-19 15:44   ` Dr. David Alan Gilbert
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 14/19] migration: Remove vmstate.h from migration.h Juan Quintela
                   ` (5 subsequent siblings)
  18 siblings, 1 reply; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/hw/hw.h             | 1 +
 include/migration/vmstate.h | 3 ---
 migration/block.c           | 1 +
 migration/channel.c         | 1 +
 migration/colo.c            | 1 +
 migration/postcopy-ram.c    | 1 +
 migration/ram.c             | 1 +
 7 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/include/hw/hw.h b/include/hw/hw.h
index e22d4ce..af9eae1 100644
--- a/include/hw/hw.h
+++ b/include/hw/hw.h
@@ -11,6 +11,7 @@
 #include "exec/memory.h"
 #include "hw/irq.h"
 #include "migration/vmstate.h"
+#include "migration/qemu-file.h"
 #include "qemu/module.h"
 #include "sysemu/reset.h"
 
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index f4c5bed..1e6fcb5 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -27,9 +27,6 @@
 #ifndef QEMU_VMSTATE_H
 #define QEMU_VMSTATE_H
 
-#ifndef CONFIG_USER_ONLY
-#include "migration/qemu-file.h"
-#endif
 #include "migration/qjson.h"
 
 typedef void SaveStateHandler(QEMUFile *f, void *opaque);
diff --git a/migration/block.c b/migration/block.c
index 0722837..e45a42d 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -19,6 +19,7 @@
 #include "qemu/cutils.h"
 #include "migration/block.h"
 #include "migration/migration.h"
+#include "migration/qemu-file.h"
 #include "sysemu/block-backend.h"
 
 #define BLOCK_SIZE                       (1 << 20)
diff --git a/migration/channel.c b/migration/channel.c
index 10416e0..04a26c5 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -17,6 +17,7 @@
 #include "migration/channel.h"
 #include "migration/tls.h"
 #include "migration/migration.h"
+#include "migration/qemu-file.h"
 #include "trace.h"
 #include "qapi/error.h"
 #include "io/channel-tls.h"
diff --git a/migration/colo.c b/migration/colo.c
index d455884..e2eaccd 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -13,6 +13,7 @@
 #include "qemu/osdep.h"
 #include "sysemu/sysemu.h"
 #include "migration/migration.h"
+#include "migration/qemu-file.h"
 #include "migration/colo.h"
 #include "io/channel-buffer.h"
 #include "trace.h"
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 11b24c6..5aea2ff 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -18,6 +18,7 @@
 
 #include "qemu/osdep.h"
 #include "migration/migration.h"
+#include "migration/qemu-file.h"
 #include "migration/postcopy-ram.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/balloon.h"
diff --git a/migration/ram.c b/migration/ram.c
index 4f49622..b0759ac 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -37,6 +37,7 @@
 #include "migration/xbzrle.h"
 #include "migration/init.h"
 #include "migration/migration.h"
+#include "migration/qemu-file.h"
 #include "migration/postcopy-ram.h"
 #include "migration/page_cache.h"
 #include "qemu/error-report.h"
-- 
2.9.3

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

* [Qemu-devel] [PATCH 14/19] migration: Remove vmstate.h from migration.h
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
                   ` (12 preceding siblings ...)
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 13/19] migration: Remove qemu-file.h from vmstate.h Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-19 17:16   ` Dr. David Alan Gilbert
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 15/19] migration: Export qemu-file-channel.c functions in its own file Juan Quintela
                   ` (4 subsequent siblings)
  18 siblings, 1 reply; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/migration.h | 1 -
 migration/block.c             | 1 +
 migration/colo-comm.c         | 1 +
 migration/migration.c         | 1 +
 migration/ram.c               | 1 +
 5 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 3353de1..1451067 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -17,7 +17,6 @@
 #include "qapi/qmp/qdict.h"
 #include "qemu-common.h"
 #include "qemu/thread.h"
-#include "migration/vmstate.h"
 #include "qapi-types.h"
 #include "exec/cpu-common.h"
 #include "qemu/coroutine_int.h"
diff --git a/migration/block.c b/migration/block.c
index e45a42d..3048088 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -20,6 +20,7 @@
 #include "migration/block.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
+#include "migration/vmstate.h"
 #include "sysemu/block-backend.h"
 
 #define BLOCK_SIZE                       (1 << 20)
diff --git a/migration/colo-comm.c b/migration/colo-comm.c
index 4161242..f11fa81 100644
--- a/migration/colo-comm.c
+++ b/migration/colo-comm.c
@@ -13,6 +13,7 @@
 
 #include "qemu/osdep.h"
 #include "migration/migration.h"
+#include "migration/vmstate.h"
 #include "migration/colo.h"
 
 typedef struct {
diff --git a/migration/migration.c b/migration/migration.c
index 9990c46..c2c25fe 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -25,6 +25,7 @@
 #include "migration/socket.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
+#include "migration/vmstate.h"
 #include "sysemu/sysemu.h"
 #include "block/block.h"
 #include "qapi/qmp/qerror.h"
diff --git a/migration/ram.c b/migration/ram.c
index b0759ac..49e518f 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -38,6 +38,7 @@
 #include "migration/init.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
+#include "migration/vmstate.h"
 #include "migration/postcopy-ram.h"
 #include "migration/page_cache.h"
 #include "qemu/error-report.h"
-- 
2.9.3

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

* [Qemu-devel] [PATCH 15/19] migration: Export qemu-file-channel.c functions in its own file
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
                   ` (13 preceding siblings ...)
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 14/19] migration: Remove vmstate.h from migration.h Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 16/19] migration: Export ram.c " Juan Quintela
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/qemu-file-channel.h | 22 ++++++++++++++++++++++
 include/migration/qemu-file.h         |  3 ---
 migration/channel.c                   |  2 +-
 migration/colo.c                      |  2 +-
 migration/migration.c                 |  2 +-
 migration/qemu-file-channel.c         |  2 +-
 migration/rdma.c                      |  2 +-
 migration/savevm.c                    |  1 +
 8 files changed, 28 insertions(+), 8 deletions(-)
 create mode 100644 include/migration/qemu-file-channel.h

diff --git a/include/migration/qemu-file-channel.h b/include/migration/qemu-file-channel.h
new file mode 100644
index 0000000..bbbf36d
--- /dev/null
+++ b/include/migration/qemu-file-channel.h
@@ -0,0 +1,22 @@
+/*
+ * QEMU migration blockers
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_FILE_CHANNEL_H
+#define QEMU_FILE_CHANNEL_H
+
+#include "migration/qemu-file.h"
+#include "io/channel.h"
+
+QEMUFile *qemu_fopen_channel_input(QIOChannel *ioc);
+QEMUFile *qemu_fopen_channel_output(QIOChannel *ioc);
+#endif
diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h
index 0cd648a..ec73647 100644
--- a/include/migration/qemu-file.h
+++ b/include/migration/qemu-file.h
@@ -27,7 +27,6 @@
 
 #include "qemu-common.h"
 #include "exec/cpu-common.h"
-#include "io/channel.h"
 
 
 /* Read a chunk of data from a file at the given position.  The pos argument
@@ -119,8 +118,6 @@ typedef struct QEMUFileHooks {
 } QEMUFileHooks;
 
 QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops);
-QEMUFile *qemu_fopen_channel_input(QIOChannel *ioc);
-QEMUFile *qemu_fopen_channel_output(QIOChannel *ioc);
 void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks);
 int qemu_get_fd(QEMUFile *f);
 int qemu_fclose(QEMUFile *f);
diff --git a/migration/channel.c b/migration/channel.c
index 04a26c5..e4a0443 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -17,7 +17,7 @@
 #include "migration/channel.h"
 #include "migration/tls.h"
 #include "migration/migration.h"
-#include "migration/qemu-file.h"
+#include "migration/qemu-file-channel.h"
 #include "trace.h"
 #include "qapi/error.h"
 #include "io/channel-tls.h"
diff --git a/migration/colo.c b/migration/colo.c
index e2eaccd..150ac6a 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -13,7 +13,7 @@
 #include "qemu/osdep.h"
 #include "sysemu/sysemu.h"
 #include "migration/migration.h"
-#include "migration/qemu-file.h"
+#include "migration/qemu-file-channel.h"
 #include "migration/colo.h"
 #include "io/channel-buffer.h"
 #include "trace.h"
diff --git a/migration/migration.c b/migration/migration.c
index c2c25fe..6e32be0 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -24,7 +24,7 @@
 #include "migration/fd.h"
 #include "migration/socket.h"
 #include "migration/migration.h"
-#include "migration/qemu-file.h"
+#include "migration/qemu-file-channel.h"
 #include "migration/vmstate.h"
 #include "sysemu/sysemu.h"
 #include "block/block.h"
diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c
index 45c13f1..87e44ec 100644
--- a/migration/qemu-file-channel.c
+++ b/migration/qemu-file-channel.c
@@ -23,7 +23,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "migration/qemu-file.h"
+#include "migration/qemu-file-channel.h"
 #include "io/channel-socket.h"
 #include "qemu/iov.h"
 
diff --git a/migration/rdma.c b/migration/rdma.c
index 94d4840..d9a2d64 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -18,7 +18,7 @@
 #include "qemu-common.h"
 #include "qemu/cutils.h"
 #include "migration/migration.h"
-#include "migration/qemu-file.h"
+#include "migration/qemu-file-channel.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
 #include "qemu/sockets.h"
diff --git a/migration/savevm.c b/migration/savevm.c
index b03973a..1e6cf79 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -36,6 +36,7 @@
 #include "audio/audio.h"
 #include "migration/machine.h"
 #include "migration/migration.h"
+#include "migration/qemu-file-channel.h"
 #include "migration/postcopy-ram.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
-- 
2.9.3

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

* [Qemu-devel] [PATCH 16/19] migration: Export ram.c functions in its own file
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
                   ` (14 preceding siblings ...)
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 15/19] migration: Export qemu-file-channel.c functions in its own file Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-19 18:46   ` Dr. David Alan Gilbert
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 17/19] migration: Export rdma.c " Juan Quintela
                   ` (2 subsequent siblings)
  18 siblings, 1 reply; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/migration.h | 36 -----------------------------
 include/migration/ram.h       | 54 +++++++++++++++++++++++++++++++++++++++++++
 migration/migration.c         |  1 +
 migration/postcopy-ram.c      |  1 +
 migration/ram.c               |  1 +
 migration/rdma.c              |  1 +
 migration/savevm.c            |  1 +
 7 files changed, 59 insertions(+), 36 deletions(-)
 create mode 100644 include/migration/ram.h

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 1451067..3e5d106 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -192,36 +192,6 @@ bool migration_is_blocked(Error **errp);
 bool migration_in_postcopy(void);
 MigrationState *migrate_get_current(void);
 
-void migrate_compress_threads_create(void);
-void migrate_compress_threads_join(void);
-void migrate_decompress_threads_create(void);
-void migrate_decompress_threads_join(void);
-uint64_t ram_bytes_remaining(void);
-uint64_t ram_bytes_transferred(void);
-uint64_t ram_bytes_total(void);
-uint64_t ram_dirty_sync_count(void);
-uint64_t ram_dirty_pages_rate(void);
-uint64_t ram_postcopy_requests(void);
-void free_xbzrle_decoded_buf(void);
-
-void acct_update_position(QEMUFile *f, size_t size, bool zero);
-
-uint64_t dup_mig_pages_transferred(void);
-uint64_t norm_mig_pages_transferred(void);
-uint64_t xbzrle_mig_bytes_transferred(void);
-uint64_t xbzrle_mig_pages_transferred(void);
-uint64_t xbzrle_mig_pages_overflow(void);
-uint64_t xbzrle_mig_pages_cache_miss(void);
-double xbzrle_mig_cache_miss_rate(void);
-
-void ram_handle_compressed(void *host, uint8_t ch, uint64_t size);
-void ram_debug_dump_bitmap(unsigned long *todump, bool expected);
-/* For outgoing discard bitmap */
-int ram_postcopy_send_discard_bitmap(MigrationState *ms);
-/* For incoming postcopy discard */
-int ram_discard_range(const char *block_name, uint64_t start, size_t length);
-int ram_postcopy_incoming_init(MigrationIncomingState *mis);
-void ram_postcopy_migrated_memory_release(MigrationState *ms);
 
 bool migrate_release_ram(void);
 bool migrate_postcopy_ram(void);
@@ -233,8 +203,6 @@ int migrate_use_xbzrle(void);
 int64_t migrate_xbzrle_cache_size(void);
 bool migrate_colo_enabled(void);
 
-int64_t xbzrle_cache_resize(int64_t new_size);
-
 bool migrate_use_block_enabled(void);
 bool migrate_use_block_shared(void);
 
@@ -273,10 +241,6 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
                              ram_addr_t offset, size_t size,
                              uint64_t *bytes_sent);
 
-void migration_page_queue_free(void);
-int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len);
-uint64_t ram_pagesize_summary(void);
-
 PostcopyState postcopy_state_get(void);
 /* Set the state and return the old state */
 PostcopyState postcopy_state_set(PostcopyState new_state);
diff --git a/include/migration/ram.h b/include/migration/ram.h
new file mode 100644
index 0000000..c3653b3
--- /dev/null
+++ b/include/migration/ram.h
@@ -0,0 +1,54 @@
+/*
+ * QEMU migration ram
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_RAM_H
+#define QEMU_MIGRATION_RAM_H
+
+#include "qemu-common.h"
+#include "exec/cpu-common.h"
+
+int64_t xbzrle_cache_resize(int64_t new_size);
+uint64_t dup_mig_pages_transferred(void);
+uint64_t norm_mig_pages_transferred(void);
+uint64_t xbzrle_mig_bytes_transferred(void);
+uint64_t xbzrle_mig_pages_transferred(void);
+uint64_t xbzrle_mig_pages_cache_miss(void);
+double xbzrle_mig_cache_miss_rate(void);
+uint64_t xbzrle_mig_pages_overflow(void);
+uint64_t ram_bytes_transferred(void);
+uint64_t ram_bytes_remaining(void);
+uint64_t ram_dirty_sync_count(void);
+uint64_t ram_dirty_pages_rate(void);
+uint64_t ram_postcopy_requests(void);
+uint64_t ram_bytes_total(void);
+
+void migrate_compress_threads_create(void);
+void migrate_compress_threads_join(void);
+void migrate_decompress_threads_create(void);
+void migrate_decompress_threads_join(void);
+
+uint64_t ram_pagesize_summary(void);
+void migration_page_queue_free(void);
+int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len);
+void acct_update_position(QEMUFile *f, size_t size, bool zero);
+void free_xbzrle_decoded_buf(void);
+void ram_debug_dump_bitmap(unsigned long *todump, bool expected);
+void ram_postcopy_migrated_memory_release(MigrationState *ms);
+/* For outgoing discard bitmap */
+int ram_postcopy_send_discard_bitmap(MigrationState *ms);
+/* For incoming postcopy discard */
+int ram_discard_range(const char *block_name, uint64_t start, size_t length);
+int ram_postcopy_incoming_init(MigrationIncomingState *mis);
+
+void ram_handle_compressed(void *host, uint8_t ch, uint64_t size);
+#endif
diff --git a/migration/migration.c b/migration/migration.c
index 6e32be0..ba01ea2 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -23,6 +23,7 @@
 #include "migration/exec.h"
 #include "migration/fd.h"
 #include "migration/socket.h"
+#include "migration/ram.h"
 #include "migration/migration.h"
 #include "migration/qemu-file-channel.h"
 #include "migration/vmstate.h"
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 5aea2ff..aec40c3 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -19,6 +19,7 @@
 #include "qemu/osdep.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
+#include "migration/ram.h"
 #include "migration/postcopy-ram.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/balloon.h"
diff --git a/migration/ram.c b/migration/ram.c
index 49e518f..eb1ec1b 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -36,6 +36,7 @@
 #include "qemu/main-loop.h"
 #include "migration/xbzrle.h"
 #include "migration/init.h"
+#include "migration/ram.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
 #include "migration/vmstate.h"
diff --git a/migration/rdma.c b/migration/rdma.c
index d9a2d64..3b06fe6 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -18,6 +18,7 @@
 #include "qemu-common.h"
 #include "qemu/cutils.h"
 #include "migration/migration.h"
+#include "migration/ram.h"
 #include "migration/qemu-file-channel.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
diff --git a/migration/savevm.c b/migration/savevm.c
index 1e6cf79..f628d01 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -36,6 +36,7 @@
 #include "audio/audio.h"
 #include "migration/machine.h"
 #include "migration/migration.h"
+#include "migration/ram.h"
 #include "migration/qemu-file-channel.h"
 #include "migration/postcopy-ram.h"
 #include "qapi/qmp/qerror.h"
-- 
2.9.3

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

* [Qemu-devel] [PATCH 17/19] migration: Export rdma.c functions in its own file
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
                   ` (15 preceding siblings ...)
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 16/19] migration: Export ram.c " Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 18/19] monitor: move hmp_savevm() to monitor.c Juan Quintela
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate Juan Quintela
  18 siblings, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/migration/migration.h |  4 ----
 include/migration/rdma.h      | 22 ++++++++++++++++++++++
 migration/migration.c         |  1 +
 migration/rdma.c              |  1 +
 4 files changed, 24 insertions(+), 4 deletions(-)
 create mode 100644 include/migration/rdma.h

diff --git a/include/migration/migration.h b/include/migration/migration.h
index 3e5d106..64c1ff3 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -177,10 +177,6 @@ void migration_fd_process_incoming(QEMUFile *f);
 
 uint64_t migrate_max_downtime(void);
 
-void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp);
-
-void rdma_start_incoming_migration(const char *host_port, Error **errp);
-
 void migrate_fd_error(MigrationState *s, const Error *error);
 
 void migrate_fd_connect(MigrationState *s);
diff --git a/include/migration/rdma.h b/include/migration/rdma.h
new file mode 100644
index 0000000..d2cf481
--- /dev/null
+++ b/include/migration/rdma.h
@@ -0,0 +1,22 @@
+/*
+ * QEMU migration rdma functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_RDMA_H
+#define QEMU_MIGRATION_RDMA_H
+
+void rdma_start_outgoing_migration(void *opaque, const char *host_port,
+                                   Error **errp);
+
+void rdma_start_incoming_migration(const char *host_port, Error **errp);
+
+#endif
diff --git a/migration/migration.c b/migration/migration.c
index ba01ea2..04aa9ad 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -23,6 +23,7 @@
 #include "migration/exec.h"
 #include "migration/fd.h"
 #include "migration/socket.h"
+#include "migration/rdma.h"
 #include "migration/ram.h"
 #include "migration/migration.h"
 #include "migration/qemu-file-channel.h"
diff --git a/migration/rdma.c b/migration/rdma.c
index 3b06fe6..2b4276b 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -17,6 +17,7 @@
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "qemu/cutils.h"
+#include "migration/rdma.h"
 #include "migration/migration.h"
 #include "migration/ram.h"
 #include "migration/qemu-file-channel.h"
-- 
2.9.3

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

* [Qemu-devel] [PATCH 18/19] monitor: move hmp_savevm() to monitor.c
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
                   ` (16 preceding siblings ...)
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 17/19] migration: Export rdma.c " Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-18  9:44   ` Paolo Bonzini
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate Juan Quintela
  18 siblings, 1 reply; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

hmp_loadvm is already there, so be consistent.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/sysemu/sysemu.h | 1 -
 migration/savevm.c      | 5 -----
 monitor.c               | 5 +++++
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 5f2f21d..146a0dc 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -75,7 +75,6 @@ void qemu_remove_exit_notifier(Notifier *notify);
 void qemu_add_machine_init_done_notifier(Notifier *notify);
 void qemu_remove_machine_init_done_notifier(Notifier *notify);
 
-void hmp_savevm(Monitor *mon, const QDict *qdict);
 int save_vmstate(Monitor *mon, const char *name);
 int load_vmstate(const char *name);
 void hmp_delvm(Monitor *mon, const QDict *qdict);
diff --git a/migration/savevm.c b/migration/savevm.c
index f628d01..cbd7e0d 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2156,11 +2156,6 @@ int save_vmstate(Monitor *mon, const char *name)
     return ret;
 }
 
-void hmp_savevm(Monitor *mon, const QDict *qdict)
-{
-    save_vmstate(mon, qdict_get_try_str(qdict, "name"));
-}
-
 void qmp_xen_save_devices_state(const char *filename, Error **errp)
 {
     QEMUFile *f;
diff --git a/monitor.c b/monitor.c
index ceb0489..2fca4fb 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1854,6 +1854,11 @@ static void hmp_loadvm(Monitor *mon, const QDict *qdict)
     }
 }
 
+static void hmp_savevm(Monitor *mon, const QDict *qdict)
+{
+    save_vmstate(mon, qdict_get_try_str(qdict, "name"));
+}
+
 int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)
 {
     mon_fd_t *monfd;
-- 
2.9.3

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

* [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate
  2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
                   ` (17 preceding siblings ...)
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 18/19] monitor: move hmp_savevm() to monitor.c Juan Quintela
@ 2017-04-17 20:00 ` Juan Quintela
  2017-04-18  9:44   ` Paolo Bonzini
  2017-04-18 18:02   ` Dr. David Alan Gilbert
  18 siblings, 2 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-17 20:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: dgilbert

load_vmstate() already use error_report, so be consistent.

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 include/sysemu/sysemu.h  |  2 +-
 migration/savevm.c       | 16 ++++++++--------
 monitor.c                |  2 +-
 replay/replay-snapshot.c |  2 +-
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 146a0dc..d2582fa 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -75,7 +75,7 @@ void qemu_remove_exit_notifier(Notifier *notify);
 void qemu_add_machine_init_done_notifier(Notifier *notify);
 void qemu_remove_machine_init_done_notifier(Notifier *notify);
 
-int save_vmstate(Monitor *mon, const char *name);
+int save_vmstate(const char *name);
 int load_vmstate(const char *name);
 void hmp_delvm(Monitor *mon, const QDict *qdict);
 void hmp_info_snapshots(Monitor *mon, const QDict *qdict);
diff --git a/migration/savevm.c b/migration/savevm.c
index cbd7e0d..36a6002 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -2055,7 +2055,7 @@ int qemu_loadvm_state(QEMUFile *f)
     return ret;
 }
 
-int save_vmstate(Monitor *mon, const char *name)
+int save_vmstate(const char *name)
 {
     BlockDriverState *bs, *bs1;
     QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1;
@@ -2069,8 +2069,8 @@ int save_vmstate(Monitor *mon, const char *name)
     AioContext *aio_context;
 
     if (!bdrv_all_can_snapshot(&bs)) {
-        monitor_printf(mon, "Device '%s' is writable but does not "
-                       "support snapshots.\n", bdrv_get_device_name(bs));
+        error_report("Device '%s' is writable but does not support snapshots.",
+                     bdrv_get_device_name(bs));
         return ret;
     }
 
@@ -2087,7 +2087,7 @@ int save_vmstate(Monitor *mon, const char *name)
 
     bs = bdrv_all_find_vmstate_bs();
     if (bs == NULL) {
-        monitor_printf(mon, "No block device can accept snapshots\n");
+        error_report("No block device can accept snapshots");
         return ret;
     }
     aio_context = bdrv_get_aio_context(bs);
@@ -2096,7 +2096,7 @@ int save_vmstate(Monitor *mon, const char *name)
 
     ret = global_state_store();
     if (ret) {
-        monitor_printf(mon, "Error saving global state\n");
+        error_report("Error saving global state");
         return ret;
     }
     vm_stop(RUN_STATE_SAVE_VM);
@@ -2128,7 +2128,7 @@ int save_vmstate(Monitor *mon, const char *name)
     /* save the VM state */
     f = qemu_fopen_bdrv(bs, 1);
     if (!f) {
-        monitor_printf(mon, "Could not open VM state file\n");
+        error_report("Could not open VM state file");
         goto the_end;
     }
     ret = qemu_savevm_state(f, &local_err);
@@ -2141,8 +2141,8 @@ int save_vmstate(Monitor *mon, const char *name)
 
     ret = bdrv_all_create_snapshot(sn, bs, vm_state_size, &bs);
     if (ret < 0) {
-        monitor_printf(mon, "Error while creating snapshot on '%s'\n",
-                       bdrv_get_device_name(bs));
+        error_report("Error while creating snapshot on '%s'",
+                     bdrv_get_device_name(bs));
         goto the_end;
     }
 
diff --git a/monitor.c b/monitor.c
index 2fca4fb..9e79a97 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1856,7 +1856,7 @@ static void hmp_loadvm(Monitor *mon, const QDict *qdict)
 
 static void hmp_savevm(Monitor *mon, const QDict *qdict)
 {
-    save_vmstate(mon, qdict_get_try_str(qdict, "name"));
+    save_vmstate(qdict_get_try_str(qdict, "name"));
 }
 
 int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)
diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c
index 65e2d37..8cced46 100644
--- a/replay/replay-snapshot.c
+++ b/replay/replay-snapshot.c
@@ -64,7 +64,7 @@ void replay_vmstate_init(void)
 {
     if (replay_snapshot) {
         if (replay_mode == REPLAY_MODE_RECORD) {
-            if (save_vmstate(cur_mon, replay_snapshot) != 0) {
+            if (save_vmstate(replay_snapshot) != 0) {
                 error_report("Could not create snapshot for icount record");
                 exit(1);
             }
-- 
2.9.3

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

* Re: [Qemu-devel] [PATCH 09/19] migration: Create block capabilities for shared and enable
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 09/19] migration: Create block capabilities for shared and enable Juan Quintela
@ 2017-04-17 20:26   ` Eric Blake
  2017-04-18  6:35     ` Juan Quintela
  0 siblings, 1 reply; 43+ messages in thread
From: Eric Blake @ 2017-04-17 20:26 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: dgilbert

[-- Attachment #1: Type: text/plain, Size: 979 bytes --]

On 04/17/2017 03:00 PM, Juan Quintela wrote:
> This two capabilites were added through the command line.  Notice that

s/This/These/
s/capabilites/capabilities/

> we just created them.  This is just the boilerplate.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  include/migration/migration.h |  3 +++
>  migration/migration.c         | 36 ++++++++++++++++++++++++++++++++++++
>  qapi-schema.json              |  7 ++++++-
>  3 files changed, 45 insertions(+), 1 deletion(-)

I think this is a nice cleanup, even if it is exposing the internal
block migration (the 'migrate -b' stuff) that we really don't like (it
is one of the things causing grief at the 2.9-rc4 stage), because users
should be favoring NBD migration over internal block migration these days.

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

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

* Re: [Qemu-devel] [PATCH 09/19] migration: Create block capabilities for shared and enable
  2017-04-17 20:26   ` Eric Blake
@ 2017-04-18  6:35     ` Juan Quintela
  0 siblings, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-18  6:35 UTC (permalink / raw)
  To: Eric Blake; +Cc: qemu-devel, dgilbert

Eric Blake <eblake@redhat.com> wrote:
> On 04/17/2017 03:00 PM, Juan Quintela wrote:
>> This two capabilites were added through the command line.  Notice that
>
> s/This/These/
> s/capabilites/capabilities/
>
>> we just created them.  This is just the boilerplate.
>> 
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  include/migration/migration.h |  3 +++
>>  migration/migration.c         | 36 ++++++++++++++++++++++++++++++++++++
>>  qapi-schema.json              |  7 ++++++-
>>  3 files changed, 45 insertions(+), 1 deletion(-)
>
> I think this is a nice cleanup, even if it is exposing the internal
> block migration (the 'migrate -b' stuff) that we really don't like (it
> is one of the things causing grief at the 2.9-rc4 stage), because users
> should be favoring NBD migration over internal block migration these days.

I am 1st in the queue to remove it, but each time that we talk about
removing it, somebody appears to came to fix it :-p

So, if it has to stay, just update it with the times.

> Reviewed-by: Eric Blake <eblake@redhat.com>

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

* Re: [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate Juan Quintela
@ 2017-04-18  9:44   ` Paolo Bonzini
  2017-04-18  9:46     ` Paolo Bonzini
  2017-04-18 18:02   ` Dr. David Alan Gilbert
  1 sibling, 1 reply; 43+ messages in thread
From: Paolo Bonzini @ 2017-04-18  9:44 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: dgilbert



On 17/04/2017 22:00, Juan Quintela wrote:
> load_vmstate() already use error_report, so be consistent.

Better: make both return Error* via an Error** parameter, and add

    hmp_handle_error(mon, &err);

to hmp_savevm and error_report_err(err) on the loading side.

Paolo

> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  include/sysemu/sysemu.h  |  2 +-
>  migration/savevm.c       | 16 ++++++++--------
>  monitor.c                |  2 +-
>  replay/replay-snapshot.c |  2 +-
>  4 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index 146a0dc..d2582fa 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -75,7 +75,7 @@ void qemu_remove_exit_notifier(Notifier *notify);
>  void qemu_add_machine_init_done_notifier(Notifier *notify);
>  void qemu_remove_machine_init_done_notifier(Notifier *notify);
>  
> -int save_vmstate(Monitor *mon, const char *name);
> +int save_vmstate(const char *name);
>  int load_vmstate(const char *name);
>  void hmp_delvm(Monitor *mon, const QDict *qdict);
>  void hmp_info_snapshots(Monitor *mon, const QDict *qdict);
> diff --git a/migration/savevm.c b/migration/savevm.c
> index cbd7e0d..36a6002 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -2055,7 +2055,7 @@ int qemu_loadvm_state(QEMUFile *f)
>      return ret;
>  }
>  
> -int save_vmstate(Monitor *mon, const char *name)
> +int save_vmstate(const char *name)
>  {
>      BlockDriverState *bs, *bs1;
>      QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1;
> @@ -2069,8 +2069,8 @@ int save_vmstate(Monitor *mon, const char *name)
>      AioContext *aio_context;
>  
>      if (!bdrv_all_can_snapshot(&bs)) {
> -        monitor_printf(mon, "Device '%s' is writable but does not "
> -                       "support snapshots.\n", bdrv_get_device_name(bs));
> +        error_report("Device '%s' is writable but does not support snapshots.",
> +                     bdrv_get_device_name(bs));
>          return ret;
>      }
>  
> @@ -2087,7 +2087,7 @@ int save_vmstate(Monitor *mon, const char *name)
>  
>      bs = bdrv_all_find_vmstate_bs();
>      if (bs == NULL) {
> -        monitor_printf(mon, "No block device can accept snapshots\n");
> +        error_report("No block device can accept snapshots");
>          return ret;
>      }
>      aio_context = bdrv_get_aio_context(bs);
> @@ -2096,7 +2096,7 @@ int save_vmstate(Monitor *mon, const char *name)
>  
>      ret = global_state_store();
>      if (ret) {
> -        monitor_printf(mon, "Error saving global state\n");
> +        error_report("Error saving global state");
>          return ret;
>      }
>      vm_stop(RUN_STATE_SAVE_VM);
> @@ -2128,7 +2128,7 @@ int save_vmstate(Monitor *mon, const char *name)
>      /* save the VM state */
>      f = qemu_fopen_bdrv(bs, 1);
>      if (!f) {
> -        monitor_printf(mon, "Could not open VM state file\n");
> +        error_report("Could not open VM state file");
>          goto the_end;
>      }
>      ret = qemu_savevm_state(f, &local_err);
> @@ -2141,8 +2141,8 @@ int save_vmstate(Monitor *mon, const char *name)
>  
>      ret = bdrv_all_create_snapshot(sn, bs, vm_state_size, &bs);
>      if (ret < 0) {
> -        monitor_printf(mon, "Error while creating snapshot on '%s'\n",
> -                       bdrv_get_device_name(bs));
> +        error_report("Error while creating snapshot on '%s'",
> +                     bdrv_get_device_name(bs));
>          goto the_end;
>      }
>  
> diff --git a/monitor.c b/monitor.c
> index 2fca4fb..9e79a97 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -1856,7 +1856,7 @@ static void hmp_loadvm(Monitor *mon, const QDict *qdict)
>  
>  static void hmp_savevm(Monitor *mon, const QDict *qdict)
>  {
> -    save_vmstate(mon, qdict_get_try_str(qdict, "name"));
> +    save_vmstate(qdict_get_try_str(qdict, "name"));
>  }
>  
>  int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)
> diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c
> index 65e2d37..8cced46 100644
> --- a/replay/replay-snapshot.c
> +++ b/replay/replay-snapshot.c
> @@ -64,7 +64,7 @@ void replay_vmstate_init(void)
>  {
>      if (replay_snapshot) {
>          if (replay_mode == REPLAY_MODE_RECORD) {
> -            if (save_vmstate(cur_mon, replay_snapshot) != 0) {
> +            if (save_vmstate(replay_snapshot) != 0) {
>                  error_report("Could not create snapshot for icount record");
>                  exit(1);
>              }
> 

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

* Re: [Qemu-devel] [PATCH 18/19] monitor: move hmp_savevm() to monitor.c
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 18/19] monitor: move hmp_savevm() to monitor.c Juan Quintela
@ 2017-04-18  9:44   ` Paolo Bonzini
  2017-04-18 10:11     ` Juan Quintela
  0 siblings, 1 reply; 43+ messages in thread
From: Paolo Bonzini @ 2017-04-18  9:44 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: dgilbert



On 17/04/2017 22:00, Juan Quintela wrote:
> hmp_loadvm is already there, so be consistent.

Can you move both to hmp.c instead?

Paolo

> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  include/sysemu/sysemu.h | 1 -
>  migration/savevm.c      | 5 -----
>  monitor.c               | 5 +++++
>  3 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index 5f2f21d..146a0dc 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -75,7 +75,6 @@ void qemu_remove_exit_notifier(Notifier *notify);
>  void qemu_add_machine_init_done_notifier(Notifier *notify);
>  void qemu_remove_machine_init_done_notifier(Notifier *notify);
>  
> -void hmp_savevm(Monitor *mon, const QDict *qdict);
>  int save_vmstate(Monitor *mon, const char *name);
>  int load_vmstate(const char *name);
>  void hmp_delvm(Monitor *mon, const QDict *qdict);
> diff --git a/migration/savevm.c b/migration/savevm.c
> index f628d01..cbd7e0d 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -2156,11 +2156,6 @@ int save_vmstate(Monitor *mon, const char *name)
>      return ret;
>  }
>  
> -void hmp_savevm(Monitor *mon, const QDict *qdict)
> -{
> -    save_vmstate(mon, qdict_get_try_str(qdict, "name"));
> -}
> -
>  void qmp_xen_save_devices_state(const char *filename, Error **errp)
>  {
>      QEMUFile *f;
> diff --git a/monitor.c b/monitor.c
> index ceb0489..2fca4fb 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -1854,6 +1854,11 @@ static void hmp_loadvm(Monitor *mon, const QDict *qdict)
>      }
>  }
>  
> +static void hmp_savevm(Monitor *mon, const QDict *qdict)
> +{
> +    save_vmstate(mon, qdict_get_try_str(qdict, "name"));
> +}
> +
>  int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)
>  {
>      mon_fd_t *monfd;
> 

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

* Re: [Qemu-devel] [PATCH 05/19] migration: Export exec.c functions in its own file
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 05/19] migration: Export exec.c functions in its own file Juan Quintela
@ 2017-04-18  9:45   ` Paolo Bonzini
  2017-04-18 10:13     ` Juan Quintela
  0 siblings, 1 reply; 43+ messages in thread
From: Paolo Bonzini @ 2017-04-18  9:45 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: dgilbert



On 17/04/2017 22:00, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  include/migration/exec.h      | 20 ++++++++++++++++++++

Good cleanup, but please move it to migration/exec.h and include it with
"exec.h".  This is the standard for files that are not needed outside
that particular directory.

Paolo

>  include/migration/migration.h |  4 ----
>  migration/exec.c              |  2 +-
>  migration/migration.c         |  1 +
>  4 files changed, 22 insertions(+), 5 deletions(-)
>  create mode 100644 include/migration/exec.h
> 
> diff --git a/include/migration/exec.h b/include/migration/exec.h
> new file mode 100644
> index 0000000..c97a7e9
> --- /dev/null
> +++ b/include/migration/exec.h
> @@ -0,0 +1,20 @@
> +/*
> + * QEMU live migration exec functions
> + *
> + * Copyright IBM, Corp. 2008
> + *
> + * Authors:
> + *  Anthony Liguori   <aliguori@us.ibm.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2.  See
> + * the COPYING file in the top-level directory.
> + *
> + */
> +
> +#ifndef QEMU_MIGRATION_EXEC_H
> +#define QEMU_MIGRATION_EXEC_H
> +void exec_start_incoming_migration(const char *host_port, Error **errp);
> +
> +void exec_start_outgoing_migration(MigrationState *s, const char *host_port,
> +                                   Error **errp);
> +#endif
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index 3f54a7c..eb0150b 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -194,10 +194,6 @@ void migration_tls_channel_connect(MigrationState *s,
>  
>  uint64_t migrate_max_downtime(void);
>  
> -void exec_start_incoming_migration(const char *host_port, Error **errp);
> -
> -void exec_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp);
> -
>  void tcp_start_incoming_migration(const char *host_port, Error **errp);
>  
>  void tcp_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp);
> diff --git a/migration/exec.c b/migration/exec.c
> index 2779c9c..1a2d5c2 100644
> --- a/migration/exec.c
> +++ b/migration/exec.c
> @@ -21,7 +21,7 @@
>  #include "qapi/error.h"
>  #include "qemu-common.h"
>  #include "migration/channel.h"
> -#include "migration/migration.h"
> +#include "migration/exec.h"
>  #include "io/channel-command.h"
>  #include "trace.h"
>  
> diff --git a/migration/migration.c b/migration/migration.c
> index 17d22eb..076c42a 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -21,6 +21,7 @@
>  #include "migration/machine.h"
>  #include "migration/state.h"
>  #include "migration/init.h"
> +#include "migration/exec.h"
>  #include "migration/migration.h"
>  #include "migration/qemu-file.h"
>  #include "sysemu/sysemu.h"
> 

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

* Re: [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate
  2017-04-18  9:44   ` Paolo Bonzini
@ 2017-04-18  9:46     ` Paolo Bonzini
  2017-04-18 10:12       ` Juan Quintela
  2017-04-19  7:19       ` Juan Quintela
  0 siblings, 2 replies; 43+ messages in thread
From: Paolo Bonzini @ 2017-04-18  9:46 UTC (permalink / raw)
  To: Juan Quintela, qemu-devel; +Cc: dgilbert



On 18/04/2017 11:44, Paolo Bonzini wrote:
> 
> 
> On 17/04/2017 22:00, Juan Quintela wrote:
>> load_vmstate() already use error_report, so be consistent.
> 
> Better: make both return Error* via an Error** parameter, and add
> 
>     hmp_handle_error(mon, &err);
> 
> to hmp_savevm and error_report_err(err) on the loading side.

Not really, loadvm is also a monitor command (I was confusing it with
-incoming).  So it can use hmp_handle_error too.

Paolo

> Paolo
> 
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  include/sysemu/sysemu.h  |  2 +-
>>  migration/savevm.c       | 16 ++++++++--------
>>  monitor.c                |  2 +-
>>  replay/replay-snapshot.c |  2 +-
>>  4 files changed, 11 insertions(+), 11 deletions(-)
>>
>> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
>> index 146a0dc..d2582fa 100644
>> --- a/include/sysemu/sysemu.h
>> +++ b/include/sysemu/sysemu.h
>> @@ -75,7 +75,7 @@ void qemu_remove_exit_notifier(Notifier *notify);
>>  void qemu_add_machine_init_done_notifier(Notifier *notify);
>>  void qemu_remove_machine_init_done_notifier(Notifier *notify);
>>  
>> -int save_vmstate(Monitor *mon, const char *name);
>> +int save_vmstate(const char *name);
>>  int load_vmstate(const char *name);
>>  void hmp_delvm(Monitor *mon, const QDict *qdict);
>>  void hmp_info_snapshots(Monitor *mon, const QDict *qdict);
>> diff --git a/migration/savevm.c b/migration/savevm.c
>> index cbd7e0d..36a6002 100644
>> --- a/migration/savevm.c
>> +++ b/migration/savevm.c
>> @@ -2055,7 +2055,7 @@ int qemu_loadvm_state(QEMUFile *f)
>>      return ret;
>>  }
>>  
>> -int save_vmstate(Monitor *mon, const char *name)
>> +int save_vmstate(const char *name)
>>  {
>>      BlockDriverState *bs, *bs1;
>>      QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1;
>> @@ -2069,8 +2069,8 @@ int save_vmstate(Monitor *mon, const char *name)
>>      AioContext *aio_context;
>>  
>>      if (!bdrv_all_can_snapshot(&bs)) {
>> -        monitor_printf(mon, "Device '%s' is writable but does not "
>> -                       "support snapshots.\n", bdrv_get_device_name(bs));
>> +        error_report("Device '%s' is writable but does not support snapshots.",
>> +                     bdrv_get_device_name(bs));
>>          return ret;
>>      }
>>  
>> @@ -2087,7 +2087,7 @@ int save_vmstate(Monitor *mon, const char *name)
>>  
>>      bs = bdrv_all_find_vmstate_bs();
>>      if (bs == NULL) {
>> -        monitor_printf(mon, "No block device can accept snapshots\n");
>> +        error_report("No block device can accept snapshots");
>>          return ret;
>>      }
>>      aio_context = bdrv_get_aio_context(bs);
>> @@ -2096,7 +2096,7 @@ int save_vmstate(Monitor *mon, const char *name)
>>  
>>      ret = global_state_store();
>>      if (ret) {
>> -        monitor_printf(mon, "Error saving global state\n");
>> +        error_report("Error saving global state");
>>          return ret;
>>      }
>>      vm_stop(RUN_STATE_SAVE_VM);
>> @@ -2128,7 +2128,7 @@ int save_vmstate(Monitor *mon, const char *name)
>>      /* save the VM state */
>>      f = qemu_fopen_bdrv(bs, 1);
>>      if (!f) {
>> -        monitor_printf(mon, "Could not open VM state file\n");
>> +        error_report("Could not open VM state file");
>>          goto the_end;
>>      }
>>      ret = qemu_savevm_state(f, &local_err);
>> @@ -2141,8 +2141,8 @@ int save_vmstate(Monitor *mon, const char *name)
>>  
>>      ret = bdrv_all_create_snapshot(sn, bs, vm_state_size, &bs);
>>      if (ret < 0) {
>> -        monitor_printf(mon, "Error while creating snapshot on '%s'\n",
>> -                       bdrv_get_device_name(bs));
>> +        error_report("Error while creating snapshot on '%s'",
>> +                     bdrv_get_device_name(bs));
>>          goto the_end;
>>      }
>>  
>> diff --git a/monitor.c b/monitor.c
>> index 2fca4fb..9e79a97 100644
>> --- a/monitor.c
>> +++ b/monitor.c
>> @@ -1856,7 +1856,7 @@ static void hmp_loadvm(Monitor *mon, const QDict *qdict)
>>  
>>  static void hmp_savevm(Monitor *mon, const QDict *qdict)
>>  {
>> -    save_vmstate(mon, qdict_get_try_str(qdict, "name"));
>> +    save_vmstate(qdict_get_try_str(qdict, "name"));
>>  }
>>  
>>  int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)
>> diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c
>> index 65e2d37..8cced46 100644
>> --- a/replay/replay-snapshot.c
>> +++ b/replay/replay-snapshot.c
>> @@ -64,7 +64,7 @@ void replay_vmstate_init(void)
>>  {
>>      if (replay_snapshot) {
>>          if (replay_mode == REPLAY_MODE_RECORD) {
>> -            if (save_vmstate(cur_mon, replay_snapshot) != 0) {
>> +            if (save_vmstate(replay_snapshot) != 0) {
>>                  error_report("Could not create snapshot for icount record");
>>                  exit(1);
>>              }
>>
> 

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

* Re: [Qemu-devel] [PATCH 18/19] monitor: move hmp_savevm() to monitor.c
  2017-04-18  9:44   ` Paolo Bonzini
@ 2017-04-18 10:11     ` Juan Quintela
  0 siblings, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-18 10:11 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, dgilbert

Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 17/04/2017 22:00, Juan Quintela wrote:
>> hmp_loadvm is already there, so be consistent.
>
> Can you move both to hmp.c instead?

Discussed on irc with David.  On my tree is already on hmp.c.

Thanks, Juan.

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

* Re: [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate
  2017-04-18  9:46     ` Paolo Bonzini
@ 2017-04-18 10:12       ` Juan Quintela
  2017-04-19  7:19       ` Juan Quintela
  1 sibling, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-18 10:12 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, dgilbert

Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 18/04/2017 11:44, Paolo Bonzini wrote:
>> 
>> 
>> On 17/04/2017 22:00, Juan Quintela wrote:
>>> load_vmstate() already use error_report, so be consistent.
>> 
>> Better: make both return Error* via an Error** parameter, and add
>> 
>>     hmp_handle_error(mon, &err);
>> 
>> to hmp_savevm and error_report_err(err) on the loading side.
>
> Not really, loadvm is also a monitor command (I was confusing it with
> -incoming).  So it can use hmp_handle_error too.

ok.  I did't kenw about that one.

Thanks.

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

* Re: [Qemu-devel] [PATCH 05/19] migration: Export exec.c functions in its own file
  2017-04-18  9:45   ` Paolo Bonzini
@ 2017-04-18 10:13     ` Juan Quintela
  0 siblings, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-18 10:13 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, dgilbert

Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 17/04/2017 22:00, Juan Quintela wrote:
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  include/migration/exec.h      | 20 ++++++++++++++++++++
>
> Good cleanup, but please move it to migration/exec.h and include it with
> "exec.h".  This is the standard for files that are not needed outside
> that particular directory.

Aha, thanks.  I was thinking about creating something "internal", but
that makes sense.

Later, Juan.

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

* Re: [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate Juan Quintela
  2017-04-18  9:44   ` Paolo Bonzini
@ 2017-04-18 18:02   ` Dr. David Alan Gilbert
  2017-04-18 20:06     ` Juan Quintela
  1 sibling, 1 reply; 43+ messages in thread
From: Dr. David Alan Gilbert @ 2017-04-18 18:02 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel

* Juan Quintela (quintela@redhat.com) wrote:
> load_vmstate() already use error_report, so be consistent.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>

See https://lists.nongnu.org/archive/html/qemu-devel/2017-03/msg03927.html

Dave

> ---
>  include/sysemu/sysemu.h  |  2 +-
>  migration/savevm.c       | 16 ++++++++--------
>  monitor.c                |  2 +-
>  replay/replay-snapshot.c |  2 +-
>  4 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index 146a0dc..d2582fa 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -75,7 +75,7 @@ void qemu_remove_exit_notifier(Notifier *notify);
>  void qemu_add_machine_init_done_notifier(Notifier *notify);
>  void qemu_remove_machine_init_done_notifier(Notifier *notify);
>  
> -int save_vmstate(Monitor *mon, const char *name);
> +int save_vmstate(const char *name);
>  int load_vmstate(const char *name);
>  void hmp_delvm(Monitor *mon, const QDict *qdict);
>  void hmp_info_snapshots(Monitor *mon, const QDict *qdict);
> diff --git a/migration/savevm.c b/migration/savevm.c
> index cbd7e0d..36a6002 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -2055,7 +2055,7 @@ int qemu_loadvm_state(QEMUFile *f)
>      return ret;
>  }
>  
> -int save_vmstate(Monitor *mon, const char *name)
> +int save_vmstate(const char *name)
>  {
>      BlockDriverState *bs, *bs1;
>      QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1;
> @@ -2069,8 +2069,8 @@ int save_vmstate(Monitor *mon, const char *name)
>      AioContext *aio_context;
>  
>      if (!bdrv_all_can_snapshot(&bs)) {
> -        monitor_printf(mon, "Device '%s' is writable but does not "
> -                       "support snapshots.\n", bdrv_get_device_name(bs));
> +        error_report("Device '%s' is writable but does not support snapshots.",
> +                     bdrv_get_device_name(bs));
>          return ret;
>      }
>  
> @@ -2087,7 +2087,7 @@ int save_vmstate(Monitor *mon, const char *name)
>  
>      bs = bdrv_all_find_vmstate_bs();
>      if (bs == NULL) {
> -        monitor_printf(mon, "No block device can accept snapshots\n");
> +        error_report("No block device can accept snapshots");
>          return ret;
>      }
>      aio_context = bdrv_get_aio_context(bs);
> @@ -2096,7 +2096,7 @@ int save_vmstate(Monitor *mon, const char *name)
>  
>      ret = global_state_store();
>      if (ret) {
> -        monitor_printf(mon, "Error saving global state\n");
> +        error_report("Error saving global state");
>          return ret;
>      }
>      vm_stop(RUN_STATE_SAVE_VM);
> @@ -2128,7 +2128,7 @@ int save_vmstate(Monitor *mon, const char *name)
>      /* save the VM state */
>      f = qemu_fopen_bdrv(bs, 1);
>      if (!f) {
> -        monitor_printf(mon, "Could not open VM state file\n");
> +        error_report("Could not open VM state file");
>          goto the_end;
>      }
>      ret = qemu_savevm_state(f, &local_err);
> @@ -2141,8 +2141,8 @@ int save_vmstate(Monitor *mon, const char *name)
>  
>      ret = bdrv_all_create_snapshot(sn, bs, vm_state_size, &bs);
>      if (ret < 0) {
> -        monitor_printf(mon, "Error while creating snapshot on '%s'\n",
> -                       bdrv_get_device_name(bs));
> +        error_report("Error while creating snapshot on '%s'",
> +                     bdrv_get_device_name(bs));
>          goto the_end;
>      }
>  
> diff --git a/monitor.c b/monitor.c
> index 2fca4fb..9e79a97 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -1856,7 +1856,7 @@ static void hmp_loadvm(Monitor *mon, const QDict *qdict)
>  
>  static void hmp_savevm(Monitor *mon, const QDict *qdict)
>  {
> -    save_vmstate(mon, qdict_get_try_str(qdict, "name"));
> +    save_vmstate(qdict_get_try_str(qdict, "name"));
>  }
>  
>  int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp)
> diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c
> index 65e2d37..8cced46 100644
> --- a/replay/replay-snapshot.c
> +++ b/replay/replay-snapshot.c
> @@ -64,7 +64,7 @@ void replay_vmstate_init(void)
>  {
>      if (replay_snapshot) {
>          if (replay_mode == REPLAY_MODE_RECORD) {
> -            if (save_vmstate(cur_mon, replay_snapshot) != 0) {
> +            if (save_vmstate(replay_snapshot) != 0) {
>                  error_report("Could not create snapshot for icount record");
>                  exit(1);
>              }
> -- 
> 2.9.3
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

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

* Re: [Qemu-devel] [PATCH 02/19] migration: They are called vmstate_foo, move them to vmstate.c
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 02/19] migration: They are called vmstate_foo, move them to vmstate.c Juan Quintela
@ 2017-04-18 18:40   ` Dr. David Alan Gilbert
  2017-04-19  7:02     ` Juan Quintela
  2017-04-25  9:00     ` Juan Quintela
  0 siblings, 2 replies; 43+ messages in thread
From: Dr. David Alan Gilbert @ 2017-04-18 18:40 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel

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

OK, but it's a little odd, savevm.c still has the vmstate_register_with_alias_id
and vmstate-unregister,  so this is just the simple ram cases.

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

> diff --git a/migration/savevm.c b/migration/savevm.c
> index cc9c086..c47b209 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -45,7 +45,6 @@
>  #include "qemu/sockets.h"
>  #include "qemu/queue.h"
>  #include "sysemu/cpus.h"
> -#include "exec/memory.h"
>  #include "qmp-commands.h"
>  #include "trace.h"
>  #include "qemu/bitops.h"
> @@ -2465,19 +2464,3 @@ void hmp_info_snapshots(Monitor *mon, const QDict *qdict)
>      g_free(global_snapshots);
>  
>  }
> -
> -void vmstate_register_ram(MemoryRegion *mr, DeviceState *dev)
> -{
> -    qemu_ram_set_idstr(mr->ram_block,
> -                       memory_region_name(mr), dev);
> -}
> -
> -void vmstate_unregister_ram(MemoryRegion *mr, DeviceState *dev)
> -{
> -    qemu_ram_unset_idstr(mr->ram_block);
> -}
> -
> -void vmstate_register_ram_global(MemoryRegion *mr)
> -{
> -    vmstate_register_ram(mr, NULL);
> -}
> diff --git a/migration/vmstate.c b/migration/vmstate.c
> index 8a71349..174c490 100644
> --- a/migration/vmstate.c
> +++ b/migration/vmstate.c
> @@ -1,5 +1,6 @@
>  #include "qemu/osdep.h"
>  #include "qemu-common.h"
> +#include "exec/memory.h"
>  #include "migration/migration.h"
>  #include "migration/qemu-file.h"
>  #include "migration/vmstate.h"
> @@ -1127,3 +1128,18 @@ bool vmstate_device_is_migratable(const VMStateDescription *vmsd)
>      return true;
>  }
>  
> +void vmstate_register_ram(MemoryRegion *mr, DeviceState *dev)
> +{
> +    qemu_ram_set_idstr(mr->ram_block,
> +                       memory_region_name(mr), dev);
> +}
> +
> +void vmstate_unregister_ram(MemoryRegion *mr, DeviceState *dev)
> +{
> +    qemu_ram_unset_idstr(mr->ram_block);
> +}
> +
> +void vmstate_register_ram_global(MemoryRegion *mr)
> +{
> +    vmstate_register_ram(mr, NULL);
> +}
> -- 
> 2.9.3
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

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

* Re: [Qemu-devel] [PATCH 10/19] migration: Remove use of old MigrationParams
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 10/19] migration: Remove use of old MigrationParams Juan Quintela
@ 2017-04-18 19:07   ` Dr. David Alan Gilbert
  2017-04-19  7:17     ` Juan Quintela
  0 siblings, 1 reply; 43+ messages in thread
From: Dr. David Alan Gilbert @ 2017-04-18 19:07 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel

* Juan Quintela (quintela@redhat.com) wrote:
> We have change in the previous patch to use migration capabilities for
> it.  Notice that we continue using the old command line flags from
> migrate command from the time being.  Remove the set_params method as
> now it is empty.
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  include/migration/migration.h |  2 --
>  migration/block.c             | 17 ++---------------
>  migration/colo.c              |  3 ---
>  migration/migration.c         |  8 +++++---
>  migration/savevm.c            |  2 --
>  5 files changed, 7 insertions(+), 25 deletions(-)
> 
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index 5c78ae1..09d3188 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -41,8 +41,6 @@
>  extern int only_migratable;
>  
>  struct MigrationParams {
> -    bool blk;
> -    bool shared;
>  };

I'm not sure that's portable C - some suggests that empty struct's
are a GNU addition.
I suggest either leaving them here, or merging this with the next
patch.

Dave

>  /* Messages sent on the return path from destination to source */
> diff --git a/migration/block.c b/migration/block.c
> index 7734ff7..9490343 100644
> --- a/migration/block.c
> +++ b/migration/block.c
> @@ -94,9 +94,6 @@ typedef struct BlkMigBlock {
>  } BlkMigBlock;
>  
>  typedef struct BlkMigState {
> -    /* Written during setup phase.  Can be read without a lock.  */
> -    int blk_enable;
> -    int shared_base;
>      QSIMPLEQ_HEAD(bmds_list, BlkMigDevState) bmds_list;
>      int64_t total_sector_sum;
>      bool zero_blocks;
> @@ -425,7 +422,7 @@ static int init_blk_migration(QEMUFile *f)
>          bmds->bulk_completed = 0;
>          bmds->total_sectors = sectors;
>          bmds->completed_sectors = 0;
> -        bmds->shared_base = block_mig_state.shared_base;
> +        bmds->shared_base = migrate_use_block_shared();
>  
>          assert(i < num_bs);
>          bmds_bs[i].bmds = bmds;
> @@ -963,22 +960,12 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
>      return 0;
>  }
>  
> -static void block_set_params(const MigrationParams *params, void *opaque)
> -{
> -    block_mig_state.blk_enable = params->blk;
> -    block_mig_state.shared_base = params->shared;
> -
> -    /* shared base means that blk_enable = 1 */
> -    block_mig_state.blk_enable |= params->shared;
> -}
> -
>  static bool block_is_active(void *opaque)
>  {
> -    return block_mig_state.blk_enable == 1;
> +    return migrate_use_block_enabled();
>  }
>  
>  static SaveVMHandlers savevm_block_handlers = {
> -    .set_params = block_set_params,
>      .save_live_setup = block_save_setup,
>      .save_live_iterate = block_save_iterate,
>      .save_live_complete_precopy = block_save_complete,
> diff --git a/migration/colo.c b/migration/colo.c
> index eec1959..4c2365e 100644
> --- a/migration/colo.c
> +++ b/migration/colo.c
> @@ -333,9 +333,6 @@ static int colo_do_checkpoint_transaction(MigrationState *s,
>          goto out;
>      }
>  
> -    /* Disable block migration */
> -    s->params.blk = 0;
> -    s->params.shared = 0;
>      qemu_savevm_state_header(fb);
>      qemu_savevm_state_begin(fb, &s->params);
>      qemu_mutex_lock_iothread();
> diff --git a/migration/migration.c b/migration/migration.c
> index 2f10657..39b4a41 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -743,6 +743,10 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
>          s->enabled_capabilities[cap->value->capability] = cap->value->state;
>      }
>  
> +    if (s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK_SHARED]) {
> +        s->enabled_capabilities[MIGRATION_CAPABILITY_BLOCK_ENABLED] = true;
> +    }
> +
>      if (migrate_postcopy_ram()) {
>          if (migrate_use_compression()) {
>              /* The decompression threads asynchronously write into RAM
> @@ -1170,9 +1174,6 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
>      MigrationParams params;
>      const char *p;
>  
> -    params.blk = has_blk && blk;
> -    params.shared = has_inc && inc;
> -
>      if (migration_is_setup_or_active(s->state) ||
>          s->state == MIGRATION_STATUS_CANCELLING ||
>          s->state == MIGRATION_STATUS_COLO) {
> @@ -1195,6 +1196,7 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
>      }
>  
>      if (has_inc && inc) {
> +        migrate_set_block_enabled(s);
>          migrate_set_block_shared(s);
>      }
>  
> diff --git a/migration/savevm.c b/migration/savevm.c
> index c47b209..c4435e1 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -1237,8 +1237,6 @@ static int qemu_savevm_state(QEMUFile *f, Error **errp)
>  {
>      int ret;
>      MigrationParams params = {
> -        .blk = 0,
> -        .shared = 0
>      };
>      MigrationState *ms = migrate_init(&params);
>      MigrationStatus status;
> -- 
> 2.9.3
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

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

* Re: [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate
  2017-04-18 18:02   ` Dr. David Alan Gilbert
@ 2017-04-18 20:06     ` Juan Quintela
  0 siblings, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-18 20:06 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: qemu-devel

"Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> https://lists.nongnu.org/archive/html/qemu-devel/2017-03/msg03927.html

Damn thing.  And I did it by hand (not that it was very difficult).

Added bonus is that I have already changed load_vmstate on the same
patch.

Will post them on next respin.

Later, Juan.

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

* Re: [Qemu-devel] [PATCH 02/19] migration: They are called vmstate_foo, move them to vmstate.c
  2017-04-18 18:40   ` Dr. David Alan Gilbert
@ 2017-04-19  7:02     ` Juan Quintela
  2017-04-25  9:00     ` Juan Quintela
  1 sibling, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-19  7:02 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: qemu-devel

"Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> * Juan Quintela (quintela@redhat.com) wrote:
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  migration/savevm.c  | 17 -----------------
>>  migration/vmstate.c | 16 ++++++++++++++++
>>  2 files changed, 16 insertions(+), 17 deletions(-)
>
> OK, but it's a little odd, savevm.c still has the vmstate_register_with_alias_id
> and vmstate-unregister,  so this is just the simple ram cases.

This are the easy bits, for others I need to rearrange headers elsewhere.

Thanks, Juan.

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

* Re: [Qemu-devel] [PATCH 10/19] migration: Remove use of old MigrationParams
  2017-04-18 19:07   ` Dr. David Alan Gilbert
@ 2017-04-19  7:17     ` Juan Quintela
  0 siblings, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-19  7:17 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: qemu-devel

"Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> * Juan Quintela (quintela@redhat.com) wrote:
>> We have change in the previous patch to use migration capabilities for
>> it.  Notice that we continue using the old command line flags from
>> migrate command from the time being.  Remove the set_params method as
>> now it is empty.
>> 
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  include/migration/migration.h |  2 --
>>  migration/block.c             | 17 ++---------------
>>  migration/colo.c              |  3 ---
>>  migration/migration.c         |  8 +++++---
>>  migration/savevm.c            |  2 --
>>  5 files changed, 7 insertions(+), 25 deletions(-)
>> 
>> diff --git a/include/migration/migration.h b/include/migration/migration.h
>> index 5c78ae1..09d3188 100644
>> --- a/include/migration/migration.h
>> +++ b/include/migration/migration.h
>> @@ -41,8 +41,6 @@
>>  extern int only_migratable;
>>  
>>  struct MigrationParams {
>> -    bool blk;
>> -    bool shared;
>>  };
>
> I'm not sure that's portable C - some suggests that empty struct's
> are a GNU addition.
> I suggest either leaving them here, or merging this with the next
> patch.

Added an unused bool.  I think it is clearer in two patches.

Thanks, Juan.

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

* Re: [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate
  2017-04-18  9:46     ` Paolo Bonzini
  2017-04-18 10:12       ` Juan Quintela
@ 2017-04-19  7:19       ` Juan Quintela
  1 sibling, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-19  7:19 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, dgilbert

Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 18/04/2017 11:44, Paolo Bonzini wrote:
>> 
>> 
>> On 17/04/2017 22:00, Juan Quintela wrote:
>>> load_vmstate() already use error_report, so be consistent.
>> 
>> Better: make both return Error* via an Error** parameter, and add
>> 
>>     hmp_handle_error(mon, &err);
>> 
>> to hmp_savevm and error_report_err(err) on the loading side.
>
> Not really, loadvm is also a monitor command (I was confusing it with
> -incoming).  So it can use hmp_handle_error too.

I think that I *understood* (famous last words) how the error should be
done on hmp commands.  We will see on next respin.

Later, Juan.

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

* Re: [Qemu-devel] [PATCH 07/19] migration: Export socket.c functions in its own file
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 07/19] migration: Export socket.c " Juan Quintela
@ 2017-04-19 15:37   ` Dr. David Alan Gilbert
  2017-04-25  9:01     ` Juan Quintela
  0 siblings, 1 reply; 43+ messages in thread
From: Dr. David Alan Gilbert @ 2017-04-19 15:37 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel

* Juan Quintela (quintela@redhat.com) wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  include/migration/migration.h |  8 --------
>  include/migration/socket.h    | 25 +++++++++++++++++++++++++
>  migration/migration.c         |  1 +
>  migration/socket.c            |  1 +
>  4 files changed, 27 insertions(+), 8 deletions(-)
>  create mode 100644 include/migration/socket.h
> 
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index 077b75b..0c6dae5 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -194,14 +194,6 @@ void migration_tls_channel_connect(MigrationState *s,
>  
>  uint64_t migrate_max_downtime(void);
>  
> -void tcp_start_incoming_migration(const char *host_port, Error **errp);
> -
> -void tcp_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp);
> -
> -void unix_start_incoming_migration(const char *path, Error **errp);
> -
> -void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp);
> -
>  void rdma_start_outgoing_migration(void *opaque, const char *host_port, Error **errp);
>  
>  void rdma_start_incoming_migration(const char *host_port, Error **errp);

Have you considered a header with just the transports in it?

There doesn't seem to be that much point with one with just the
rdma's in, and one iwth just the tcp's in etc.

Dave

> diff --git a/include/migration/socket.h b/include/migration/socket.h
> new file mode 100644
> index 0000000..800fde1
> --- /dev/null
> +++ b/include/migration/socket.h
> @@ -0,0 +1,25 @@
> +/*
> + * QEMU live migration socket functions
> + *
> + * Copyright IBM, Corp. 2008
> + *
> + * Authors:
> + *  Anthony Liguori   <aliguori@us.ibm.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2.  See
> + * the COPYING file in the top-level directory.
> + *
> + */
> +
> +#ifndef QEMU_MIGRATION_SOCKET_H
> +#define QEMU_MIGRATION_SOCKET_H
> +void tcp_start_incoming_migration(const char *host_port, Error **errp);
> +
> +void tcp_start_outgoing_migration(MigrationState *s, const char *host_port,
> +                                  Error **errp);
> +
> +void unix_start_incoming_migration(const char *path, Error **errp);
> +
> +void unix_start_outgoing_migration(MigrationState *s, const char *path,
> +                                   Error **errp);
> +#endif
> diff --git a/migration/migration.c b/migration/migration.c
> index a608faa..181839b 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -23,6 +23,7 @@
>  #include "migration/init.h"
>  #include "migration/exec.h"
>  #include "migration/fd.h"
> +#include "migration/socket.h"
>  #include "migration/migration.h"
>  #include "migration/qemu-file.h"
>  #include "sysemu/sysemu.h"
> diff --git a/migration/socket.c b/migration/socket.c
> index b06cde3..71a8439 100644
> --- a/migration/socket.c
> +++ b/migration/socket.c
> @@ -20,6 +20,7 @@
>  #include "qemu/error-report.h"
>  #include "qapi/error.h"
>  #include "migration/channel.h"
> +#include "migration/socket.h"
>  #include "migration/migration.h"
>  #include "migration/qemu-file.h"
>  #include "io/channel-socket.h"
> -- 
> 2.9.3
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

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

* Re: [Qemu-devel] [PATCH 13/19] migration: Remove qemu-file.h from vmstate.h
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 13/19] migration: Remove qemu-file.h from vmstate.h Juan Quintela
@ 2017-04-19 15:44   ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 43+ messages in thread
From: Dr. David Alan Gilbert @ 2017-04-19 15:44 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel

* Juan Quintela (quintela@redhat.com) wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>

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

> ---
>  include/hw/hw.h             | 1 +
>  include/migration/vmstate.h | 3 ---
>  migration/block.c           | 1 +
>  migration/channel.c         | 1 +
>  migration/colo.c            | 1 +
>  migration/postcopy-ram.c    | 1 +
>  migration/ram.c             | 1 +
>  7 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/include/hw/hw.h b/include/hw/hw.h
> index e22d4ce..af9eae1 100644
> --- a/include/hw/hw.h
> +++ b/include/hw/hw.h
> @@ -11,6 +11,7 @@
>  #include "exec/memory.h"
>  #include "hw/irq.h"
>  #include "migration/vmstate.h"
> +#include "migration/qemu-file.h"
>  #include "qemu/module.h"
>  #include "sysemu/reset.h"
>  
> diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
> index f4c5bed..1e6fcb5 100644
> --- a/include/migration/vmstate.h
> +++ b/include/migration/vmstate.h
> @@ -27,9 +27,6 @@
>  #ifndef QEMU_VMSTATE_H
>  #define QEMU_VMSTATE_H
>  
> -#ifndef CONFIG_USER_ONLY
> -#include "migration/qemu-file.h"
> -#endif
>  #include "migration/qjson.h"
>  
>  typedef void SaveStateHandler(QEMUFile *f, void *opaque);
> diff --git a/migration/block.c b/migration/block.c
> index 0722837..e45a42d 100644
> --- a/migration/block.c
> +++ b/migration/block.c
> @@ -19,6 +19,7 @@
>  #include "qemu/cutils.h"
>  #include "migration/block.h"
>  #include "migration/migration.h"
> +#include "migration/qemu-file.h"
>  #include "sysemu/block-backend.h"
>  
>  #define BLOCK_SIZE                       (1 << 20)
> diff --git a/migration/channel.c b/migration/channel.c
> index 10416e0..04a26c5 100644
> --- a/migration/channel.c
> +++ b/migration/channel.c
> @@ -17,6 +17,7 @@
>  #include "migration/channel.h"
>  #include "migration/tls.h"
>  #include "migration/migration.h"
> +#include "migration/qemu-file.h"
>  #include "trace.h"
>  #include "qapi/error.h"
>  #include "io/channel-tls.h"
> diff --git a/migration/colo.c b/migration/colo.c
> index d455884..e2eaccd 100644
> --- a/migration/colo.c
> +++ b/migration/colo.c
> @@ -13,6 +13,7 @@
>  #include "qemu/osdep.h"
>  #include "sysemu/sysemu.h"
>  #include "migration/migration.h"
> +#include "migration/qemu-file.h"
>  #include "migration/colo.h"
>  #include "io/channel-buffer.h"
>  #include "trace.h"
> diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
> index 11b24c6..5aea2ff 100644
> --- a/migration/postcopy-ram.c
> +++ b/migration/postcopy-ram.c
> @@ -18,6 +18,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "migration/migration.h"
> +#include "migration/qemu-file.h"
>  #include "migration/postcopy-ram.h"
>  #include "sysemu/sysemu.h"
>  #include "sysemu/balloon.h"
> diff --git a/migration/ram.c b/migration/ram.c
> index 4f49622..b0759ac 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -37,6 +37,7 @@
>  #include "migration/xbzrle.h"
>  #include "migration/init.h"
>  #include "migration/migration.h"
> +#include "migration/qemu-file.h"
>  #include "migration/postcopy-ram.h"
>  #include "migration/page_cache.h"
>  #include "qemu/error-report.h"
> -- 
> 2.9.3
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

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

* Re: [Qemu-devel] [PATCH 14/19] migration: Remove vmstate.h from migration.h
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 14/19] migration: Remove vmstate.h from migration.h Juan Quintela
@ 2017-04-19 17:16   ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 43+ messages in thread
From: Dr. David Alan Gilbert @ 2017-04-19 17:16 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel

* Juan Quintela (quintela@redhat.com) wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>

You probably need to do a build of all combos to make sure nothing
is depending on the migration.h when it uses VMSTATE_ macros.

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

Dave

> ---
>  include/migration/migration.h | 1 -
>  migration/block.c             | 1 +
>  migration/colo-comm.c         | 1 +
>  migration/migration.c         | 1 +
>  migration/ram.c               | 1 +
>  5 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index 3353de1..1451067 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -17,7 +17,6 @@
>  #include "qapi/qmp/qdict.h"
>  #include "qemu-common.h"
>  #include "qemu/thread.h"
> -#include "migration/vmstate.h"
>  #include "qapi-types.h"
>  #include "exec/cpu-common.h"
>  #include "qemu/coroutine_int.h"
> diff --git a/migration/block.c b/migration/block.c
> index e45a42d..3048088 100644
> --- a/migration/block.c
> +++ b/migration/block.c
> @@ -20,6 +20,7 @@
>  #include "migration/block.h"
>  #include "migration/migration.h"
>  #include "migration/qemu-file.h"
> +#include "migration/vmstate.h"
>  #include "sysemu/block-backend.h"
>  
>  #define BLOCK_SIZE                       (1 << 20)
> diff --git a/migration/colo-comm.c b/migration/colo-comm.c
> index 4161242..f11fa81 100644
> --- a/migration/colo-comm.c
> +++ b/migration/colo-comm.c
> @@ -13,6 +13,7 @@
>  
>  #include "qemu/osdep.h"
>  #include "migration/migration.h"
> +#include "migration/vmstate.h"
>  #include "migration/colo.h"
>  
>  typedef struct {
> diff --git a/migration/migration.c b/migration/migration.c
> index 9990c46..c2c25fe 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -25,6 +25,7 @@
>  #include "migration/socket.h"
>  #include "migration/migration.h"
>  #include "migration/qemu-file.h"
> +#include "migration/vmstate.h"
>  #include "sysemu/sysemu.h"
>  #include "block/block.h"
>  #include "qapi/qmp/qerror.h"
> diff --git a/migration/ram.c b/migration/ram.c
> index b0759ac..49e518f 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -38,6 +38,7 @@
>  #include "migration/init.h"
>  #include "migration/migration.h"
>  #include "migration/qemu-file.h"
> +#include "migration/vmstate.h"
>  #include "migration/postcopy-ram.h"
>  #include "migration/page_cache.h"
>  #include "qemu/error-report.h"
> -- 
> 2.9.3
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

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

* Re: [Qemu-devel] [PATCH 16/19] migration: Export ram.c functions in its own file
  2017-04-17 20:00 ` [Qemu-devel] [PATCH 16/19] migration: Export ram.c " Juan Quintela
@ 2017-04-19 18:46   ` Dr. David Alan Gilbert
  2017-04-25  9:39     ` Juan Quintela
  0 siblings, 1 reply; 43+ messages in thread
From: Dr. David Alan Gilbert @ 2017-04-19 18:46 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel

* Juan Quintela (quintela@redhat.com) wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  include/migration/migration.h | 36 -----------------------------
>  include/migration/ram.h       | 54 +++++++++++++++++++++++++++++++++++++++++++
>  migration/migration.c         |  1 +
>  migration/postcopy-ram.c      |  1 +
>  migration/ram.c               |  1 +
>  migration/rdma.c              |  1 +
>  migration/savevm.c            |  1 +
>  7 files changed, 59 insertions(+), 36 deletions(-)
>  create mode 100644 include/migration/ram.h
> 
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index 1451067..3e5d106 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -192,36 +192,6 @@ bool migration_is_blocked(Error **errp);
>  bool migration_in_postcopy(void);
>  MigrationState *migrate_get_current(void);
>  
> -void migrate_compress_threads_create(void);
> -void migrate_compress_threads_join(void);
> -void migrate_decompress_threads_create(void);
> -void migrate_decompress_threads_join(void);
> -uint64_t ram_bytes_remaining(void);
> -uint64_t ram_bytes_transferred(void);
> -uint64_t ram_bytes_total(void);
> -uint64_t ram_dirty_sync_count(void);
> -uint64_t ram_dirty_pages_rate(void);
> -uint64_t ram_postcopy_requests(void);
> -void free_xbzrle_decoded_buf(void);
> -
> -void acct_update_position(QEMUFile *f, size_t size, bool zero);
> -
> -uint64_t dup_mig_pages_transferred(void);
> -uint64_t norm_mig_pages_transferred(void);
> -uint64_t xbzrle_mig_bytes_transferred(void);
> -uint64_t xbzrle_mig_pages_transferred(void);
> -uint64_t xbzrle_mig_pages_overflow(void);
> -uint64_t xbzrle_mig_pages_cache_miss(void);
> -double xbzrle_mig_cache_miss_rate(void);
> -
> -void ram_handle_compressed(void *host, uint8_t ch, uint64_t size);
> -void ram_debug_dump_bitmap(unsigned long *todump, bool expected);
> -/* For outgoing discard bitmap */
> -int ram_postcopy_send_discard_bitmap(MigrationState *ms);
> -/* For incoming postcopy discard */
> -int ram_discard_range(const char *block_name, uint64_t start, size_t length);
> -int ram_postcopy_incoming_init(MigrationIncomingState *mis);
> -void ram_postcopy_migrated_memory_release(MigrationState *ms);
>  
>  bool migrate_release_ram(void);
>  bool migrate_postcopy_ram(void);
> @@ -233,8 +203,6 @@ int migrate_use_xbzrle(void);
>  int64_t migrate_xbzrle_cache_size(void);
>  bool migrate_colo_enabled(void);
>  
> -int64_t xbzrle_cache_resize(int64_t new_size);
> -
>  bool migrate_use_block_enabled(void);
>  bool migrate_use_block_shared(void);
>  
> @@ -273,10 +241,6 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
>                               ram_addr_t offset, size_t size,
>                               uint64_t *bytes_sent);
>  
> -void migration_page_queue_free(void);
> -int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len);
> -uint64_t ram_pagesize_summary(void);
> -
>  PostcopyState postcopy_state_get(void);
>  /* Set the state and return the old state */
>  PostcopyState postcopy_state_set(PostcopyState new_state);
> diff --git a/include/migration/ram.h b/include/migration/ram.h
> new file mode 100644
> index 0000000..c3653b3
> --- /dev/null
> +++ b/include/migration/ram.h
> @@ -0,0 +1,54 @@
> +/*
> + * QEMU migration ram
> + *
> + * Copyright IBM, Corp. 2008
> + *
> + * Authors:
> + *  Anthony Liguori   <aliguori@us.ibm.com>

Shouldn't that be updated a bit?

Other than that,

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

> + * This work is licensed under the terms of the GNU GPL, version 2.  See
> + * the COPYING file in the top-level directory.
> + *
> + */
> +
> +#ifndef QEMU_MIGRATION_RAM_H
> +#define QEMU_MIGRATION_RAM_H
> +
> +#include "qemu-common.h"
> +#include "exec/cpu-common.h"
> +
> +int64_t xbzrle_cache_resize(int64_t new_size);
> +uint64_t dup_mig_pages_transferred(void);
> +uint64_t norm_mig_pages_transferred(void);
> +uint64_t xbzrle_mig_bytes_transferred(void);
> +uint64_t xbzrle_mig_pages_transferred(void);
> +uint64_t xbzrle_mig_pages_cache_miss(void);
> +double xbzrle_mig_cache_miss_rate(void);
> +uint64_t xbzrle_mig_pages_overflow(void);

Most of hese only exist to fill in MigrationInfo's xbzrle_cache states; see
get_xbzrle_cache_stats - perhaps it should be moved into ram.c and then just
that exposed?

Dave

> +uint64_t ram_bytes_transferred(void);
> +uint64_t ram_bytes_remaining(void);
> +uint64_t ram_dirty_sync_count(void);
> +uint64_t ram_dirty_pages_rate(void);
> +uint64_t ram_postcopy_requests(void);
> +uint64_t ram_bytes_total(void);
> +
> +void migrate_compress_threads_create(void);
> +void migrate_compress_threads_join(void);
> +void migrate_decompress_threads_create(void);
> +void migrate_decompress_threads_join(void);
> +
> +uint64_t ram_pagesize_summary(void);
> +void migration_page_queue_free(void);
> +int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len);
> +void acct_update_position(QEMUFile *f, size_t size, bool zero);
> +void free_xbzrle_decoded_buf(void);
> +void ram_debug_dump_bitmap(unsigned long *todump, bool expected);
> +void ram_postcopy_migrated_memory_release(MigrationState *ms);
> +/* For outgoing discard bitmap */
> +int ram_postcopy_send_discard_bitmap(MigrationState *ms);
> +/* For incoming postcopy discard */
> +int ram_discard_range(const char *block_name, uint64_t start, size_t length);
> +int ram_postcopy_incoming_init(MigrationIncomingState *mis);
> +
> +void ram_handle_compressed(void *host, uint8_t ch, uint64_t size);
> +#endif
> diff --git a/migration/migration.c b/migration/migration.c
> index 6e32be0..ba01ea2 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -23,6 +23,7 @@
>  #include "migration/exec.h"
>  #include "migration/fd.h"
>  #include "migration/socket.h"
> +#include "migration/ram.h"
>  #include "migration/migration.h"
>  #include "migration/qemu-file-channel.h"
>  #include "migration/vmstate.h"
> diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
> index 5aea2ff..aec40c3 100644
> --- a/migration/postcopy-ram.c
> +++ b/migration/postcopy-ram.c
> @@ -19,6 +19,7 @@
>  #include "qemu/osdep.h"
>  #include "migration/migration.h"
>  #include "migration/qemu-file.h"
> +#include "migration/ram.h"
>  #include "migration/postcopy-ram.h"
>  #include "sysemu/sysemu.h"
>  #include "sysemu/balloon.h"
> diff --git a/migration/ram.c b/migration/ram.c
> index 49e518f..eb1ec1b 100644
> --- a/migration/ram.c
> +++ b/migration/ram.c
> @@ -36,6 +36,7 @@
>  #include "qemu/main-loop.h"
>  #include "migration/xbzrle.h"
>  #include "migration/init.h"
> +#include "migration/ram.h"
>  #include "migration/migration.h"
>  #include "migration/qemu-file.h"
>  #include "migration/vmstate.h"
> diff --git a/migration/rdma.c b/migration/rdma.c
> index d9a2d64..3b06fe6 100644
> --- a/migration/rdma.c
> +++ b/migration/rdma.c
> @@ -18,6 +18,7 @@
>  #include "qemu-common.h"
>  #include "qemu/cutils.h"
>  #include "migration/migration.h"
> +#include "migration/ram.h"
>  #include "migration/qemu-file-channel.h"
>  #include "qemu/error-report.h"
>  #include "qemu/main-loop.h"
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 1e6cf79..f628d01 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -36,6 +36,7 @@
>  #include "audio/audio.h"
>  #include "migration/machine.h"
>  #include "migration/migration.h"
> +#include "migration/ram.h"
>  #include "migration/qemu-file-channel.h"
>  #include "migration/postcopy-ram.h"
>  #include "qapi/qmp/qerror.h"
> -- 
> 2.9.3
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

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

* Re: [Qemu-devel] [PATCH 02/19] migration: They are called vmstate_foo, move them to vmstate.c
  2017-04-18 18:40   ` Dr. David Alan Gilbert
  2017-04-19  7:02     ` Juan Quintela
@ 2017-04-25  9:00     ` Juan Quintela
  1 sibling, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-25  9:00 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: qemu-devel

"Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> * Juan Quintela (quintela@redhat.com) wrote:
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  migration/savevm.c  | 17 -----------------
>>  migration/vmstate.c | 16 ++++++++++++++++
>>  2 files changed, 16 insertions(+), 17 deletions(-)
>
> OK, but it's a little odd, savevm.c still has the vmstate_register_with_alias_id
> and vmstate-unregister,  so this is just the simple ram cases.

Dropped the patch.

vmstate.c ends only having the interpreter on it.

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

* Re: [Qemu-devel] [PATCH 07/19] migration: Export socket.c functions in its own file
  2017-04-19 15:37   ` Dr. David Alan Gilbert
@ 2017-04-25  9:01     ` Juan Quintela
  0 siblings, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-25  9:01 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: qemu-devel

"Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> * Juan Quintela (quintela@redhat.com) wrote:
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  include/migration/migration.h |  8 --------
>>  include/migration/socket.h    | 25 +++++++++++++++++++++++++
>>  migration/migration.c         |  1 +
>>  migration/socket.c            |  1 +
>>  4 files changed, 27 insertions(+), 8 deletions(-)
>>  create mode 100644 include/migration/socket.h
>> 
>> diff --git a/include/migration/migration.h b/include/migration/migration.h
>> index 077b75b..0c6dae5 100644
>> --- a/include/migration/migration.h
>> +++ b/include/migration/migration.h
>> @@ -194,14 +194,6 @@ void migration_tls_channel_connect(MigrationState *s,
>>  
>>  uint64_t migrate_max_downtime(void);
>>  
>> -void tcp_start_incoming_migration(const char *host_port, Error **errp);
>> -
>> -void tcp_start_outgoing_migration(MigrationState *s, const char
>> *host_port, Error **errp);
>> -
>> -void unix_start_incoming_migration(const char *path, Error **errp);
>> -
>> -void unix_start_outgoing_migration(MigrationState *s, const char
>> *path, Error **errp);
>> -
>>  void rdma_start_outgoing_migration(void *opaque, const char
>> *host_port, Error **errp);
>>  
>>  void rdma_start_incoming_migration(const char *host_port, Error **errp);
>
> Have you considered a header with just the transports in it?
>
> There doesn't seem to be that much point with one with just the
> rdma's in, and one iwth just the tcp's in etc.

In the future, the transports should be using module_type() and no need
of this stuff at all.  It should make easier to compile transports out
(famous last words).

Later, Juan.

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

* Re: [Qemu-devel] [PATCH 16/19] migration: Export ram.c functions in its own file
  2017-04-19 18:46   ` Dr. David Alan Gilbert
@ 2017-04-25  9:39     ` Juan Quintela
  0 siblings, 0 replies; 43+ messages in thread
From: Juan Quintela @ 2017-04-25  9:39 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: qemu-devel

"Dr. David Alan Gilbert" <dgilbert@redhat.com> wrote:
> * Juan Quintela (quintela@redhat.com) wrote:
>> Signed-off-by: Juan Quintela <quintela@redhat.com>
>> ---
>>  include/migration/migration.h | 36 -----------------------------
>>  include/migration/ram.h       | 54 +++++++++++++++++++++++++++++++++++++++++++
>>  migration/migration.c         |  1 +
>>  migration/postcopy-ram.c      |  1 +
>>  migration/ram.c               |  1 +
>>  migration/rdma.c              |  1 +
>>  migration/savevm.c            |  1 +
>>  7 files changed, 59 insertions(+), 36 deletions(-)
>>  create mode 100644 include/migration/ram.h
>> 
>> diff --git a/include/migration/migration.h b/include/migration/migration.h
>> index 1451067..3e5d106 100644
>> --- a/include/migration/migration.h
>> +++ b/include/migration/migration.h
>> @@ -192,36 +192,6 @@ bool migration_is_blocked(Error **errp);
>>  bool migration_in_postcopy(void);
>>  MigrationState *migrate_get_current(void);
>>  
>> -void migrate_compress_threads_create(void);
>> -void migrate_compress_threads_join(void);
>> -void migrate_decompress_threads_create(void);
>> -void migrate_decompress_threads_join(void);
>> -uint64_t ram_bytes_remaining(void);
>> -uint64_t ram_bytes_transferred(void);
>> -uint64_t ram_bytes_total(void);
>> -uint64_t ram_dirty_sync_count(void);
>> -uint64_t ram_dirty_pages_rate(void);
>> -uint64_t ram_postcopy_requests(void);
>> -void free_xbzrle_decoded_buf(void);
>> -
>> -void acct_update_position(QEMUFile *f, size_t size, bool zero);
>> -
>> -uint64_t dup_mig_pages_transferred(void);
>> -uint64_t norm_mig_pages_transferred(void);
>> -uint64_t xbzrle_mig_bytes_transferred(void);
>> -uint64_t xbzrle_mig_pages_transferred(void);
>> -uint64_t xbzrle_mig_pages_overflow(void);
>> -uint64_t xbzrle_mig_pages_cache_miss(void);
>> -double xbzrle_mig_cache_miss_rate(void);
>> -
>> -void ram_handle_compressed(void *host, uint8_t ch, uint64_t size);
>> -void ram_debug_dump_bitmap(unsigned long *todump, bool expected);
>> -/* For outgoing discard bitmap */
>> -int ram_postcopy_send_discard_bitmap(MigrationState *ms);
>> -/* For incoming postcopy discard */
>> -int ram_discard_range(const char *block_name, uint64_t start, size_t length);
>> -int ram_postcopy_incoming_init(MigrationIncomingState *mis);
>> -void ram_postcopy_migrated_memory_release(MigrationState *ms);
>>  
>>  bool migrate_release_ram(void);
>>  bool migrate_postcopy_ram(void);
>> @@ -233,8 +203,6 @@ int migrate_use_xbzrle(void);
>>  int64_t migrate_xbzrle_cache_size(void);
>>  bool migrate_colo_enabled(void);
>>  
>> -int64_t xbzrle_cache_resize(int64_t new_size);
>> -
>>  bool migrate_use_block_enabled(void);
>>  bool migrate_use_block_shared(void);
>>  
>> @@ -273,10 +241,6 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
>>                               ram_addr_t offset, size_t size,
>>                               uint64_t *bytes_sent);
>>  
>> -void migration_page_queue_free(void);
>> -int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len);
>> -uint64_t ram_pagesize_summary(void);
>> -
>>  PostcopyState postcopy_state_get(void);
>>  /* Set the state and return the old state */
>>  PostcopyState postcopy_state_set(PostcopyState new_state);
>> diff --git a/include/migration/ram.h b/include/migration/ram.h
>> new file mode 100644
>> index 0000000..c3653b3
>> --- /dev/null
>> +++ b/include/migration/ram.h
>> @@ -0,0 +1,54 @@
>> +/*
>> + * QEMU migration ram
>> + *
>> + * Copyright IBM, Corp. 2008
>> + *
>> + * Authors:
>> + *  Anthony Liguori   <aliguori@us.ibm.com>
>
> Shouldn't that be updated a bit?
>
> Other than that,

With what?

I can put myself there, but it is just copying a lot of function
prototypes, i.e. not as if I had done lot of work there right now.

But I am open to suggestions.

>
> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>
>> + * This work is licensed under the terms of the GNU GPL, version 2.  See
>> + * the COPYING file in the top-level directory.
>> + *
>> + */
>> +
>> +#ifndef QEMU_MIGRATION_RAM_H
>> +#define QEMU_MIGRATION_RAM_H
>> +
>> +#include "qemu-common.h"
>> +#include "exec/cpu-common.h"
>> +
>> +int64_t xbzrle_cache_resize(int64_t new_size);
>> +uint64_t dup_mig_pages_transferred(void);
>> +uint64_t norm_mig_pages_transferred(void);
>> +uint64_t xbzrle_mig_bytes_transferred(void);
>> +uint64_t xbzrle_mig_pages_transferred(void);
>> +uint64_t xbzrle_mig_pages_cache_miss(void);
>> +double xbzrle_mig_cache_miss_rate(void);
>> +uint64_t xbzrle_mig_pages_overflow(void);

Will try to take a look at that, but on the other hand, I am trying to
get the qmp code out of migration.c in its own file.  One can't have
everything.

Thanks, Juan.

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

end of thread, other threads:[~2017-04-25  9:39 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-17 20:00 [Qemu-devel] [PATCH 00/19] Migration cleanup Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 01/19] migration: to_dst_file at that point is NULL Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 02/19] migration: They are called vmstate_foo, move them to vmstate.c Juan Quintela
2017-04-18 18:40   ` Dr. David Alan Gilbert
2017-04-19  7:02     ` Juan Quintela
2017-04-25  9:00     ` Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 03/19] migration: Split migration/channel.c for channel operations Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 04/19] migration: Remove MigrationState from migration_channel_incomming() Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 05/19] migration: Export exec.c functions in its own file Juan Quintela
2017-04-18  9:45   ` Paolo Bonzini
2017-04-18 10:13     ` Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 06/19] migration: Export fd.c " Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 07/19] migration: Export socket.c " Juan Quintela
2017-04-19 15:37   ` Dr. David Alan Gilbert
2017-04-25  9:01     ` Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 08/19] migration: Export tls.c " Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 09/19] migration: Create block capabilities for shared and enable Juan Quintela
2017-04-17 20:26   ` Eric Blake
2017-04-18  6:35     ` Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 10/19] migration: Remove use of old MigrationParams Juan Quintela
2017-04-18 19:07   ` Dr. David Alan Gilbert
2017-04-19  7:17     ` Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 11/19] migration: Remove " Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 12/19] migration: Remove unneeded includes Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 13/19] migration: Remove qemu-file.h from vmstate.h Juan Quintela
2017-04-19 15:44   ` Dr. David Alan Gilbert
2017-04-17 20:00 ` [Qemu-devel] [PATCH 14/19] migration: Remove vmstate.h from migration.h Juan Quintela
2017-04-19 17:16   ` Dr. David Alan Gilbert
2017-04-17 20:00 ` [Qemu-devel] [PATCH 15/19] migration: Export qemu-file-channel.c functions in its own file Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 16/19] migration: Export ram.c " Juan Quintela
2017-04-19 18:46   ` Dr. David Alan Gilbert
2017-04-25  9:39     ` Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 17/19] migration: Export rdma.c " Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 18/19] monitor: move hmp_savevm() to monitor.c Juan Quintela
2017-04-18  9:44   ` Paolo Bonzini
2017-04-18 10:11     ` Juan Quintela
2017-04-17 20:00 ` [Qemu-devel] [PATCH 19/19] monitor: remove monitor parameter from save_vmstate Juan Quintela
2017-04-18  9:44   ` Paolo Bonzini
2017-04-18  9:46     ` Paolo Bonzini
2017-04-18 10:12       ` Juan Quintela
2017-04-19  7:19       ` Juan Quintela
2017-04-18 18:02   ` Dr. David Alan Gilbert
2017-04-18 20:06     ` Juan Quintela

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