Skip to contentSkip to conversation

Migration mini-cleanup

PATCH Superseded Juan Quintela 4 participants 25 messages May 17, 2017 – May 23, 2017 Block layer

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover Migration mini-cleanup

Hi

Changes from v3

- dropped movement of colo*h headers
they are used in other palaces in patches outside the tree
- Change the license of vmstate*c files to GPL v2+
Dave noted that I was using the wrong text
- page_cache.c movement was already reviewd and it has no conflicts, moved to pull request.

Please, review

Thanks, Juan.

[v3]
Due to popular demand, and to make reviews easier, I just split the big cleanup series (41 patches) in small chunks. This chunk just include the easy patches:

- create several include files foo.h for functcions exported from foo.c
- split channel operations in channel.c
- move colo headers to migration/
- split vmstate-types.c from vmstate.c (now it only contains the interpreter)
- untangle qemu-file.h, vmstate.h and migration.h. Now none include the other fix all callers.
- Remove uses of migration.h that are not needed

Juan Quintela (9):
migration: Create migration/xbzrle.h
migration: Split migration/channel.c for channel operations
migration: Export qemu-file-channel.c functions in its own file
migration: Remove migration.h from colo.h
migration: Move qjson.h to migration/
migration: Split vmstate-types.c from vmstate.c
migration: Remove qemu-file.h from vmstate.h
migration: Remove vmstate.h from migration.h
migration: migration.h was not needed

 block/qed.c                              |   1 -
 hw/i386/pc_q35.c                         |   1 -
 hw/virtio/vhost-user.c                   |   1 -
 hw/virtio/vhost-vsock.c                  |   1 -
 hw/virtio/virtio.c                       |   1 -
 include/hw/hw.h                          |   1 +
 include/migration/colo.h                 |   1 -
 include/migration/migration.h            |  13 +-
 include/migration/qemu-file.h            |   4 -
 include/migration/vmstate.h              |   3 -
 migration/Makefile.objs                  |   4 +-
 migration/block.c                        |   2 +
 migration/channel.c                      |  70 ++++
 migration/channel.h                      |  25 ++
 migration/colo-comm.c                    |   4 +-
 migration/colo.c                         |   3 +
 migration/exec.c                         |   1 +
 migration/fd.c                           |   1 +
 migration/migration.c                    |  52 +--
 migration/postcopy-ram.c                 |   1 +
 migration/qemu-file-channel.c            |   1 +
 migration/qemu-file-channel.h            |  21 +
 migration/qjson.c                        |   2 +-
 {include/migration => migration}/qjson.h |   0
 migration/ram.c                          |   3 +
 migration/rdma.c                         |   1 +
 migration/savevm.c                       |   1 +
 migration/socket.c                       |   1 +
 migration/tls.c                          |   1 +
 migration/vmstate-types.c                | 661 +++++++++++++++++++++++++++++++
 migration/vmstate.c                      | 656 +-----------------------------
 migration/xbzrle.c                       |   2 +-
 migration/xbzrle.h                       |  21 +
 monitor.c                                |   1 -
 tests/Makefile.include                   |   2 +-
 tests/test-vmstate.c                     |   2 +
 tests/test-xbzrle.c                      |   2 +-
 37 files changed, 842 insertions(+), 726 deletions(-)
 create mode 100644 migration/channel.c
 create mode 100644 migration/channel.h
 create mode 100644 migration/qemu-file-channel.h
 rename {include/migration => migration}/qjson.h (100%)
 create mode 100644 migration/vmstate-types.c
 create mode 100644 migration/xbzrle.h
Signature · 1 line
2.9.3
#1 lore raw

PATCH v4 1/9 migration: Create migration/xbzrle.h

---
 include/migration/migration.h |  4 ----
 migration/ram.c               |  1 +
 migration/xbzrle.c            |  2 +-
 migration/xbzrle.h            | 21 +++++++++++++++++++++
 tests/test-xbzrle.c           |  2 +-
 5 files changed, 24 insertions(+), 6 deletions(-)
 create mode 100644 migration/xbzrle.h
include/migration/migration.h +0 -4
index b80a6ed..7d1eef7 100644
@@ -251,10 +251,6 @@ bool migrate_zero_blocks(void);
 
 bool migrate_auto_converge(void);
 
-int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen,
-                         uint8_t *dst, int dlen);
-int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen);
-
 int migrate_use_xbzrle(void);
 int64_t migrate_xbzrle_cache_size(void);
 bool migrate_colo_enabled(void);
migration/ram.c +1 -0
index 76c118c..2564c00 100644
@@ -35,6 +35,7 @@
 #include "qemu/bitmap.h"
 #include "qemu/timer.h"
 #include "qemu/main-loop.h"
+#include "xbzrle.h"
 #include "migration/migration.h"
 #include "postcopy-ram.h"
 #include "exec/address-spaces.h"
migration/xbzrle.c +1 -1
index c858339..1ba482d 100644
@@ -12,7 +12,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu/cutils.h"
-#include "include/migration/migration.h"
+#include "xbzrle.h"
 
 /*
   page = zrun nzrun
migration/xbzrle.h new file +21 -0
new file mode 100644
index 0000000..a0db507
@@ -0,0 +1,21 @@
+/*
+ * QEMU live migration
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_XBZRLE_H
+#define QEMU_MIGRATION_XBZRLE_H
+
+int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen,
+                         uint8_t *dst, int dlen);
+
+int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen);
+#endif
tests/test-xbzrle.c +1 -1
index 49f6419..f5e08de 100644
@@ -13,7 +13,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qemu/cutils.h"
-#include "include/migration/migration.h"
+#include "../migration/xbzrle.h"
 
 #define PAGE_SIZE 4096
 
Signature · 1 line
2.9.3
#3 lore raw

PATCH v4 2/9 migration: Split migration/channel.c for channel operations

In reply to Juan Quintela

Create an include for its exported functions.

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

69 lines not on this page · raw message

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

56 lines not on this page · raw message

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

PATCH v4 3/9 migration: Export qemu-file-channel.c functions in its own file

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

PATCH v4 4/9 migration: Remove migration.h from colo.h

In reply to Juan Quintela

migration.h is not included in any includes now.

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

PATCH v4 5/9 migration: Move qjson.h to migration/

In reply to Juan Quintela

It is only used for migration code.

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

PATCH v4 7/9 migration: Remove qemu-file.h from vmstate.h

In reply to Juan Quintela

--

minor rearangements due to the rebase

---
 include/hw/hw.h             | 1 +
 include/migration/vmstate.h | 3 ---
 migration/block.c           | 1 +
 migration/colo.c            | 1 +
 migration/postcopy-ram.c    | 1 +
 migration/ram.c             | 1 +
 tests/test-vmstate.c        | 1 +
 7 files changed, 6 insertions(+), 3 deletions(-)
include/hw/hw.h +1 -0
index e22d4ce..af9eae1 100644
@@ -11,6 +11,7 @@
 #include "exec/memory.h"
 #include "hw/irq.h"
 #include "migration/vmstate.h"
+#include "migration/qemu-file.h"
 #include "qemu/module.h"
 #include "sysemu/reset.h"
 
include/migration/vmstate.h +0 -3
index dacb052..f97411d 100644
@@ -27,9 +27,6 @@
 #ifndef QEMU_VMSTATE_H
 #define QEMU_VMSTATE_H
 
-#ifndef CONFIG_USER_ONLY
-#include "migration/qemu-file.h"
-#endif
 #include "migration/qjson.h"
 
 typedef void SaveStateHandler(QEMUFile *f, void *opaque);
migration/block.c +1 -0
index 5d22926..5baf46d 100644
@@ -26,6 +26,7 @@
 #include "migration/block.h"
 #include "migration/migration.h"
 #include "sysemu/blockdev.h"
+#include "migration/qemu-file.h"
 #include "sysemu/block-backend.h"
 
 #define BLOCK_SIZE                       (1 << 20)
migration/colo.c +1 -0
index 73ebd64..929b31c 100644
@@ -15,6 +15,7 @@
 #include "sysemu/sysemu.h"
 #include "qemu-file-channel.h"
 #include "migration/migration.h"
+#include "migration/qemu-file.h"
 #include "migration/colo.h"
 #include "migration/block.h"
 #include "io/channel-buffer.h"
migration/postcopy-ram.c +1 -0
index a0489f6..64f09e1 100644
@@ -20,6 +20,7 @@
 
 #include "qemu-common.h"
 #include "migration/migration.h"
+#include "migration/qemu-file.h"
 #include "postcopy-ram.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/balloon.h"
migration/ram.c +1 -0
index 2564c00..04667de 100644
@@ -37,6 +37,7 @@
 #include "qemu/main-loop.h"
 #include "xbzrle.h"
 #include "migration/migration.h"
+#include "migration/qemu-file.h"
 #include "postcopy-ram.h"
 #include "exec/address-spaces.h"
 #include "migration/page_cache.h"
tests/test-vmstate.c +1 -0
index 1c13570..25389bc 100644
@@ -27,6 +27,7 @@
 #include "qemu-common.h"
 #include "migration/migration.h"
 #include "migration/vmstate.h"
+#include "migration/qemu-file.h"
 #include "../migration/qemu-file-channel.h"
 #include "qemu/coroutine.h"
 #include "io/channel-file.h"
Signature · 1 line
2.9.3
#17 lore raw

PATCH v4 6/9 migration: Split vmstate-types.c from vmstate.c

In reply to Juan Quintela

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

--

Use GPL v2 or later. Detected by David.

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

661 lines not on this page · raw message

migration/vmstate.c +12 -642

666 lines not on this page · raw message

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

PATCH v4 8/9 migration: Remove vmstate.h from migration.h

In reply to Juan Quintela

---

Minor rearrangements due to rebase

---
 include/migration/migration.h | 1 -
 migration/block.c             | 1 +
 migration/colo-comm.c         | 1 +
 migration/migration.c         | 1 +
 migration/ram.c               | 1 +
 5 files changed, 4 insertions(+), 1 deletion(-)
include/migration/migration.h +0 -1
index 8280df1..0e807b6 100644
@@ -18,7 +18,6 @@
 #include "qemu-common.h"
 #include "qemu/thread.h"
 #include "qemu/notify.h"
-#include "migration/vmstate.h"
 #include "io/channel.h"
 #include "qapi-types.h"
 #include "exec/cpu-common.h"
migration/block.c +1 -0
index 5baf46d..13f90d3 100644
@@ -27,6 +27,7 @@
 #include "migration/migration.h"
 #include "sysemu/blockdev.h"
 #include "migration/qemu-file.h"
+#include "migration/vmstate.h"
 #include "sysemu/block-backend.h"
 
 #define BLOCK_SIZE                       (1 << 20)
migration/colo-comm.c +1 -0
index 3d91798..8bfdf68 100644
@@ -14,6 +14,7 @@
 #include "qemu/osdep.h"
 #include "migration/migration.h"
 #include "migration/colo.h"
+#include "migration/vmstate.h"
 #include "trace.h"
 
 typedef struct {
migration/migration.c +1 -0
index ff3f7aa..75a728a 100644
@@ -21,6 +21,7 @@
 #include "migration/migration.h"
 #include "qemu-file-channel.h"
 #include "migration/qemu-file.h"
+#include "migration/vmstate.h"
 #include "sysemu/sysemu.h"
 #include "block/block.h"
 #include "qapi/qmp/qerror.h"
migration/ram.c +1 -0
index 04667de..a68a9db 100644
@@ -38,6 +38,7 @@
 #include "xbzrle.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
+#include "migration/vmstate.h"
 #include "postcopy-ram.h"
 #include "exec/address-spaces.h"
 #include "migration/page_cache.h"
Signature · 1 line
2.9.3
#21 lore raw

PATCH v4 9/9 migration: migration.h was not needed

In reply to Juan Quintela

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

---
 block/qed.c             | 1 -
 hw/i386/pc_q35.c        | 1 -
 hw/virtio/vhost-user.c  | 1 -
 hw/virtio/vhost-vsock.c | 1 -
 hw/virtio/virtio.c      | 1 -
 monitor.c               | 1 -
 6 files changed, 6 deletions(-)
block/qed.c +0 -1
index fd76817..8d899fd 100644
@@ -19,7 +19,6 @@
 #include "trace.h"
 #include "qed.h"
 #include "qapi/qmp/qerror.h"
-#include "migration/migration.h"
 #include "sysemu/block-backend.h"
 
 static const AIOCBInfo qed_aiocb_info = {
hw/i386/pc_q35.c +0 -1
index 66303a7..a58785b 100644
@@ -46,7 +46,6 @@
 #include "hw/ide/ahci.h"
 #include "hw/usb.h"
 #include "qemu/error-report.h"
-#include "migration/migration.h"
 #include "sysemu/numa.h"
 
 /* ICH9 AHCI has 6 ports */
hw/virtio/vhost-user.c +0 -1
index 9334a8a..ebc8ccf 100644
@@ -17,7 +17,6 @@
 #include "sysemu/kvm.h"
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
-#include "migration/migration.h"
 
 #include <sys/ioctl.h>
 #include <sys/socket.h>
hw/virtio/vhost-vsock.c +0 -1
index b481562..49e0022 100644
@@ -17,7 +17,6 @@
 #include "qapi/error.h"
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
-#include "migration/migration.h"
 #include "qemu/error-report.h"
 #include "hw/virtio/vhost-vsock.h"
 #include "qemu/iov.h"
hw/virtio/virtio.c +0 -1
index 03592c5..2d2b6bf 100644
@@ -21,7 +21,6 @@
 #include "hw/virtio/virtio.h"
 #include "qemu/atomic.h"
 #include "hw/virtio/virtio-bus.h"
-#include "migration/migration.h"
 #include "hw/virtio/virtio-access.h"
 #include "sysemu/dma.h"
 
monitor.c +0 -1
index 078cba5..fa295c4 100644
@@ -49,7 +49,6 @@
 #include "disas/disas.h"
 #include "sysemu/balloon.h"
 #include "qemu/timer.h"
-#include "migration/migration.h"
 #include "sysemu/hw_accel.h"
 #include "qemu/acl.h"
 #include "sysemu/tpm.h"
Signature · 1 line
2.9.3
Acked-by on v4 9/9
#22 lore raw

Re: [Qemu-devel] [PATCH 9/9] migration: migration.h was not needed

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

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

Quoted 84 lines
---
 block/qed.c             | 1 -
 hw/i386/pc_q35.c        | 1 -
 hw/virtio/vhost-user.c  | 1 -
 hw/virtio/vhost-vsock.c | 1 -
 hw/virtio/virtio.c      | 1 -
 monitor.c               | 1 -
 6 files changed, 6 deletions(-)
block/qed.c +0 -1
index fd76817..8d899fd 100644
@@ -19,7 +19,6 @@
 #include "trace.h"
 #include "qed.h"
 #include "qapi/qmp/qerror.h"
-#include "migration/migration.h"
 #include "sysemu/block-backend.h"
 
 static const AIOCBInfo qed_aiocb_info = {
hw/i386/pc_q35.c +0 -1
index 66303a7..a58785b 100644
@@ -46,7 +46,6 @@
 #include "hw/ide/ahci.h"
 #include "hw/usb.h"
 #include "qemu/error-report.h"
-#include "migration/migration.h"
 #include "sysemu/numa.h"
 
 /* ICH9 AHCI has 6 ports */
hw/virtio/vhost-user.c +0 -1
index 9334a8a..ebc8ccf 100644
@@ -17,7 +17,6 @@
 #include "sysemu/kvm.h"
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
-#include "migration/migration.h"
 
 #include <sys/ioctl.h>
 #include <sys/socket.h>
hw/virtio/vhost-vsock.c +0 -1
index b481562..49e0022 100644
@@ -17,7 +17,6 @@
 #include "qapi/error.h"
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
-#include "migration/migration.h"
 #include "qemu/error-report.h"
 #include "hw/virtio/vhost-vsock.h"
 #include "qemu/iov.h"
hw/virtio/virtio.c +0 -1
index 03592c5..2d2b6bf 100644
@@ -21,7 +21,6 @@
 #include "hw/virtio/virtio.h"
 #include "qemu/atomic.h"
 #include "hw/virtio/virtio-bus.h"
-#include "migration/migration.h"
 #include "hw/virtio/virtio-access.h"
 #include "sysemu/dma.h"
 
monitor.c +0 -1
index 078cba5..fa295c4 100644
@@ -49,7 +49,6 @@
 #include "disas/disas.h"
 #include "sysemu/balloon.h"
 #include "qemu/timer.h"
-#include "migration/migration.h"
 #include "sysemu/hw_accel.h"
 #include "qemu/acl.h"
 #include "sysemu/tpm.h"
Signature · 1 line
2.9.3

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

Reviewed-by on v4 5/9
#16 lore raw

Re: [Qemu-devel] [PATCH 5/9] migration: Move qjson.h to migration/

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

It is only used for migration code.

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

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

#23 lore raw

Re: [Qemu-devel] [PATCH 9/9] migration: migration.h was not needed

In reply to Dr. David Alan Gilbert
Quoted 6 lines · * Dr. David Alan Gilbert ([email protected]) wrote:
Quoted 3 lines · * Juan Quintela ([email protected]) wrote:

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

Oops, I meant:

Quoted 78 lines
Quoted 78 lines
---
 block/qed.c             | 1 -
 hw/i386/pc_q35.c        | 1 -
 hw/virtio/vhost-user.c  | 1 -
 hw/virtio/vhost-vsock.c | 1 -
 hw/virtio/virtio.c      | 1 -
 monitor.c               | 1 -
 6 files changed, 6 deletions(-)
block/qed.c +0 -1
index fd76817..8d899fd 100644
@@ -19,7 +19,6 @@
 #include "trace.h"
 #include "qed.h"
 #include "qapi/qmp/qerror.h"
-#include "migration/migration.h"
 #include "sysemu/block-backend.h"
 
 static const AIOCBInfo qed_aiocb_info = {
hw/i386/pc_q35.c +0 -1
index 66303a7..a58785b 100644
@@ -46,7 +46,6 @@
 #include "hw/ide/ahci.h"
 #include "hw/usb.h"
 #include "qemu/error-report.h"
-#include "migration/migration.h"
 #include "sysemu/numa.h"
 
 /* ICH9 AHCI has 6 ports */
hw/virtio/vhost-user.c +0 -1
index 9334a8a..ebc8ccf 100644
@@ -17,7 +17,6 @@
 #include "sysemu/kvm.h"
 #include "qemu/error-report.h"
 #include "qemu/sockets.h"
-#include "migration/migration.h"
 
 #include <sys/ioctl.h>
 #include <sys/socket.h>
hw/virtio/vhost-vsock.c +0 -1
index b481562..49e0022 100644
@@ -17,7 +17,6 @@
 #include "qapi/error.h"
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
-#include "migration/migration.h"
 #include "qemu/error-report.h"
 #include "hw/virtio/vhost-vsock.h"
 #include "qemu/iov.h"
hw/virtio/virtio.c +0 -1
index 03592c5..2d2b6bf 100644
@@ -21,7 +21,6 @@
 #include "hw/virtio/virtio.h"
 #include "qemu/atomic.h"
 #include "hw/virtio/virtio-bus.h"
-#include "migration/migration.h"
 #include "hw/virtio/virtio-access.h"
 #include "sysemu/dma.h"
 
monitor.c +0 -1
index 078cba5..fa295c4 100644
@@ -49,7 +49,6 @@
 #include "disas/disas.h"
 #include "sysemu/balloon.h"
 #include "qemu/timer.h"
-#include "migration/migration.h"
Quoted 8 lines
Quoted 6 lines
monitor.c +0 -0
 #include "sysemu/hw_accel.h"
 #include "qemu/acl.h"
 #include "sysemu/tpm.h"
Signature · 1 line
2.9.3

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

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

Reviewed-by on v4 1/9
#2 lore raw

Re: [Qemu-devel] [PATCH 1/9] migration: Create migration/xbzrle.h

In reply to Juan Quintela
Quoted 1 line · Juan Quintela
Quoted 92 lines
---
 include/migration/migration.h |  4 ----
 migration/ram.c               |  1 +
 migration/xbzrle.c            |  2 +-
 migration/xbzrle.h            | 21 +++++++++++++++++++++
 tests/test-xbzrle.c           |  2 +-
 5 files changed, 24 insertions(+), 6 deletions(-)
 create mode 100644 migration/xbzrle.h
include/migration/migration.h +0 -4
index b80a6ed..7d1eef7 100644
@@ -251,10 +251,6 @@ bool migrate_zero_blocks(void);
 
 bool migrate_auto_converge(void);
 
-int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen,
-                         uint8_t *dst, int dlen);
-int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen);
-
 int migrate_use_xbzrle(void);
 int64_t migrate_xbzrle_cache_size(void);
 bool migrate_colo_enabled(void);
migration/ram.c +1 -0
index 76c118c..2564c00 100644
@@ -35,6 +35,7 @@
 #include "qemu/bitmap.h"
 #include "qemu/timer.h"
 #include "qemu/main-loop.h"
+#include "xbzrle.h"
 #include "migration/migration.h"
 #include "postcopy-ram.h"
 #include "exec/address-spaces.h"
migration/xbzrle.c +1 -1
index c858339..1ba482d 100644
@@ -12,7 +12,7 @@
  */
 #include "qemu/osdep.h"
 #include "qemu/cutils.h"
-#include "include/migration/migration.h"
+#include "xbzrle.h"
 
 /*
   page = zrun nzrun
migration/xbzrle.h new file +21 -0
new file mode 100644
index 0000000..a0db507
@@ -0,0 +1,21 @@
+/*
+ * QEMU live migration
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_XBZRLE_H
+#define QEMU_MIGRATION_XBZRLE_H
+
+int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen,
+                         uint8_t *dst, int dlen);
+
+int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen);
+#endif
tests/test-xbzrle.c +1 -1
index 49f6419..f5e08de 100644
@@ -13,7 +13,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qemu/cutils.h"
-#include "include/migration/migration.h"
+#include "../migration/xbzrle.h"
 
 #define PAGE_SIZE 4096
 
Signature · 1 line
2.9.3
Signature · 1 line
Peter Xu
Reviewed-by on v4 2/9
#4 lore raw

Re: [Qemu-devel] [PATCH 2/9] migration: Split migration/channel.c for channel operations

In reply to Juan Quintela
Quoted 3 lines · Juan Quintela

Create an include for its exported functions.

Quoted 265 lines
---
 include/migration/migration.h |  7 -----
 migration/Makefile.objs       |  2 +-
 migration/channel.c           | 69 +++++++++++++++++++++++++++++++++++++++++++
 migration/channel.h           | 25 ++++++++++++++++
 migration/exec.c              |  1 +
 migration/fd.c                |  1 +
 migration/migration.c         | 50 -------------------------------
 migration/socket.c            |  1 +
 migration/tls.c               |  1 +
 9 files changed, 99 insertions(+), 58 deletions(-)
 create mode 100644 migration/channel.c
 create mode 100644 migration/channel.h
include/migration/migration.h +0 -7
index 7d1eef7..e831259 100644
@@ -157,17 +157,10 @@ void migration_fd_process_incoming(QEMUFile *f);
 
 void qemu_start_incoming_migration(const char *uri, Error **errp);
 
-void migration_channel_process_incoming(MigrationState *s,
-                                        QIOChannel *ioc);
-
 void migration_tls_channel_process_incoming(MigrationState *s,
                                             QIOChannel *ioc,
                                             Error **errp);
 
-void migration_channel_connect(MigrationState *s,
-                               QIOChannel *ioc,
-                               const char *hostname);
-
 void migration_tls_channel_connect(MigrationState *s,
                                    QIOChannel *ioc,
                                    const char *hostname,
migration/Makefile.objs +1 -1
index 00a3f4a..4e8ab0a 100644
@@ -1,5 +1,5 @@
 common-obj-y += migration.o socket.o fd.o exec.o
-common-obj-y += tls.o
+common-obj-y += tls.o channel.o
 common-obj-y += colo-comm.o colo.o colo-failover.o
 common-obj-y += vmstate.o page_cache.o
 common-obj-y += qemu-file.o
migration/channel.c new file +69 -0
new file mode 100644
index 0000000..6104de5
@@ -0,0 +1,69 @@
+/*
+ * QEMU live migration
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ * Contributions after 2012-01-13 are licensed under the terms of the
+ * GNU GPL, version 2 or (at your option) any later version.
+ */
+
+#include "qemu/osdep.h"
+#include "channel.h"
+#include "migration/migration.h"
+#include "trace.h"
+#include "qapi/error.h"
+#include "io/channel-tls.h"
+
+void migration_channel_process_incoming(MigrationState *s,
+                                        QIOChannel *ioc)
+{
+    trace_migration_set_incoming_channel(
+        ioc, object_get_typename(OBJECT(ioc)));
+
+    if (s->parameters.tls_creds &&
+        *s->parameters.tls_creds &&
+        !object_dynamic_cast(OBJECT(ioc),
+                             TYPE_QIO_CHANNEL_TLS)) {
+        Error *local_err = NULL;
+        migration_tls_channel_process_incoming(s, ioc, &local_err);
+        if (local_err) {
+            error_report_err(local_err);
+        }
+    } else {
+        QEMUFile *f = qemu_fopen_channel_input(ioc);
+        migration_fd_process_incoming(f);
+    }
+}
+
+
+void migration_channel_connect(MigrationState *s,
+                               QIOChannel *ioc,
+                               const char *hostname)
+{
+    trace_migration_set_outgoing_channel(
+        ioc, object_get_typename(OBJECT(ioc)), hostname);
+
+    if (s->parameters.tls_creds &&
+        *s->parameters.tls_creds &&
+        !object_dynamic_cast(OBJECT(ioc),
+                             TYPE_QIO_CHANNEL_TLS)) {
+        Error *local_err = NULL;
+        migration_tls_channel_connect(s, ioc, hostname, &local_err);
+        if (local_err) {
+            migrate_fd_error(s, local_err);
+            error_free(local_err);
+        }
+    } else {
+        QEMUFile *f = qemu_fopen_channel_output(ioc);
+
+        s->to_dst_file = f;
+
+        migrate_fd_connect(s);
+    }
+}
migration/channel.h new file +25 -0
new file mode 100644
index 0000000..618acb7
@@ -0,0 +1,25 @@
+/*
+ * QEMU live migration channel functions
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MIGRATION_CHANNEL_H
+#define QEMU_MIGRATION_CHANNEL_H
+
+#include "io/channel.h"
+
+void migration_channel_process_incoming(MigrationState *s,
+                                        QIOChannel *ioc);
+
+void migration_channel_connect(MigrationState *s,
+                               QIOChannel *ioc,
+                               const char *hostname);
+#endif
migration/exec.c +1 -0
index aba9089..57a9335 100644
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
+#include "channel.h"
 #include "migration/migration.h"
 #include "io/channel-command.h"
 #include "trace.h"
migration/fd.c +1 -0
index 58cb51a..05e0a5c 100644
@@ -17,6 +17,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
+#include "channel.h"
 #include "migration/migration.h"
 #include "monitor/monitor.h"
 #include "io/channel-util.h"
migration/migration.c +0 -50
index d5ebcd2..3ba32eb 100644
@@ -444,56 +444,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.
migration/socket.c +1 -0
index 1cfbe81..53f9d61 100644
@@ -19,6 +19,7 @@
 #include "qemu-common.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
+#include "channel.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
 #include "io/channel-socket.h"
migration/tls.c +1 -0
index a33ecb7..34ad121 100644
@@ -19,6 +19,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "channel.h"
 #include "migration/migration.h"
 #include "io/channel-tls.h"
 #include "crypto/tlscreds.h"
Signature · 1 line
2.9.3
Signature · 1 line
Peter Xu
#6 lore raw

Re: [Qemu-devel] [PATCH 3/9] migration: Export qemu-file-channel.c functions in its own file

In reply to Juan Quintela
Quoted 20 lines · Juan Quintela
---
 include/migration/migration.h |  1 +
 include/migration/qemu-file.h |  4 ----
 migration/channel.c           |  1 +
 migration/colo.c              |  1 +
 migration/migration.c         |  1 +
 migration/qemu-file-channel.c |  1 +
 migration/qemu-file-channel.h | 21 +++++++++++++++++++++
 migration/rdma.c              |  1 +
 migration/savevm.c            |  1 +
 tests/test-vmstate.c          |  1 +
 10 files changed, 29 insertions(+), 4 deletions(-)
 create mode 100644 migration/qemu-file-channel.h
include/migration/migration.h +0 -0
index e831259..8280df1 100644

include/migration/migration.h line 22

Quoted 4 lines
include/migration/migration.h +1 -0
@@ -19,6 +19,7 @@
 #include "qemu/thread.h"
 #include "qemu/notify.h"
 #include "migration/vmstate.h"
+#include "io/channel.h"

Could I ask why we add this line here? I thought one of the main goals of this series is removing things from migration.h...

include/migration/migration.h line 25

Quoted 3 lines
include/migration/migration.h +0 -0
 #include "qapi-types.h"
 #include "exec/cpu-common.h"
 #include "qemu/coroutine_int.h"

Thanks,

Signature · 1 line
Peter Xu
Reviewed-by on v4 6/9
#18 lore raw

Re: [Qemu-devel] [PATCH 6/9] migration: Split vmstate-types.c from vmstate.c

In reply to Juan Quintela
Quoted 4 lines · Juan Quintela

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

(Actually I would still avoid moving too many things around without
functional reason since it'll be at least harder to trace commit information... but since we're here already after lots of rebases to track these series...)

Signature · 1 line
Peter Xu
#7 lore raw

Re: [Qemu-devel] [PATCH 3/9] migration: Export qemu-file-channel.c functions in its own file

In reply to Peter Xu
Quoted 16 lines · Peter Xu
Quoted 15 lines · Juan Quintela
---
 include/migration/migration.h |  1 +
 include/migration/qemu-file.h |  4 ----
 migration/channel.c           |  1 +
 migration/colo.c              |  1 +
 migration/migration.c         |  1 +
 migration/qemu-file-channel.c |  1 +
 migration/qemu-file-channel.h | 21 +++++++++++++++++++++
 migration/rdma.c              |  1 +
 migration/savevm.c            |  1 +
 tests/test-vmstate.c          |  1 +
 10 files changed, 29 insertions(+), 4 deletions(-)
 create mode 100644 migration/qemu-file-channel.h
Quoted 12 lines

include/migration/migration.h line 22

Quoted 9 lines
include/migration/migration.h +1 -0
index e831259..8280df1 100644
@@ -19,6 +19,7 @@
 #include "qemu/thread.h"
 #include "qemu/notify.h"
 #include "migration/vmstate.h"
+#include "io/channel.h"

Could I ask why we add this line here? I thought one of the main goals of this series is removing things from migration.h...

I remove from include/migration/qemu-file.h

-#include "io/channel.h"

Because all the QIOChannel functions in qemu-file.h are moved to qemu-file-channel.h.

Great!

But migration/vmstate.h includes qemu-file.h

And migration.h includes vmstate.h

And migration.h has this functions:

void qemu_start_incoming_migration(const char *uri, Error **errp);
                                            QIOChannel *ioc,
                                            Error **errp);

void migration_tls_channel_connect(MigrationState *s,
QIOChannel *ioc, const char *hostname, Error **errp);

And nothing else declares the QIOChannel.

So, the easy solution so far is to include this by now to maintain compilation.

BTW, good catch.

So, I think that there is no other good solution to untangle the mess.

Later, Juan.

#10 lore raw

Re: [Qemu-devel] [PATCH 3/9] migration: Export qemu-file-channel.c functions in its own file

In reply to Juan Quintela
Quoted 114 lines · * Juan Quintela ([email protected]) wrote:
---
 include/migration/migration.h |  1 +
 include/migration/qemu-file.h |  4 ----
 migration/channel.c           |  1 +
 migration/colo.c              |  1 +
 migration/migration.c         |  1 +
 migration/qemu-file-channel.c |  1 +
 migration/qemu-file-channel.h | 21 +++++++++++++++++++++
 migration/rdma.c              |  1 +
 migration/savevm.c            |  1 +
 tests/test-vmstate.c          |  1 +
 10 files changed, 29 insertions(+), 4 deletions(-)
 create mode 100644 migration/qemu-file-channel.h
include/migration/migration.h +1 -0
index e831259..8280df1 100644
@@ -19,6 +19,7 @@
 #include "qemu/thread.h"
 #include "qemu/notify.h"
 #include "migration/vmstate.h"
+#include "io/channel.h"
 #include "qapi-types.h"
 #include "exec/cpu-common.h"
 #include "qemu/coroutine_int.h"
include/migration/qemu-file.h +0 -4
index 0cd648a..b5ac800 100644
@@ -27,8 +27,6 @@
 
 #include "qemu-common.h"
 #include "exec/cpu-common.h"
-#include "io/channel.h"
-
 
 /* Read a chunk of data from a file at the given position.  The pos argument
  * can be ignored if the file is only be used for streaming.  The number of
@@ -119,8 +117,6 @@ typedef struct QEMUFileHooks {
 } QEMUFileHooks;
 
 QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops);
-QEMUFile *qemu_fopen_channel_input(QIOChannel *ioc);
-QEMUFile *qemu_fopen_channel_output(QIOChannel *ioc);
 void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks);
 int qemu_get_fd(QEMUFile *f);
 int qemu_fclose(QEMUFile *f);
migration/channel.c +1 -0
index 6104de5..fed8563 100644
@@ -16,6 +16,7 @@
 #include "qemu/osdep.h"
 #include "channel.h"
 #include "migration/migration.h"
+#include "qemu-file-channel.h"
 #include "trace.h"
 #include "qapi/error.h"
 #include "io/channel-tls.h"
migration/colo.c +1 -0
index dd38fed..9cd0250 100644
@@ -13,6 +13,7 @@
 #include "qemu/osdep.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
+#include "qemu-file-channel.h"
 #include "migration/colo.h"
 #include "migration/block.h"
 #include "io/channel-buffer.h"
migration/migration.c +1 -0
index 3ba32eb..ff3f7aa 100644
@@ -19,6 +19,7 @@
 #include "qemu/main-loop.h"
 #include "migration/blocker.h"
 #include "migration/migration.h"
+#include "qemu-file-channel.h"
 #include "migration/qemu-file.h"
 #include "sysemu/sysemu.h"
 #include "block/block.h"
migration/qemu-file-channel.c +1 -0
index 45c13f1..dc991c9 100644
@@ -23,6 +23,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-file-channel.h"
 #include "migration/qemu-file.h"
 #include "io/channel-socket.h"
 #include "qemu/iov.h"
migration/qemu-file-channel.h new file +11 -0
new file mode 100644
index 0000000..d1bd5ff
@@ -0,0 +1,21 @@
+/*
+ * QEMU migration file channel operations
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *

migration/qemu-file-channel.h line 21

Quoted 10 lines
migration/qemu-file-channel.h new file +10 -0
+ */
+
+#ifndef QEMU_FILE_CHANNEL_H
+#define QEMU_FILE_CHANNEL_H
+
+#include "io/channel.h"
+
+QEMUFile *qemu_fopen_channel_input(QIOChannel *ioc);
+QEMUFile *qemu_fopen_channel_output(QIOChannel *ioc);
+#endif

OK, similar copyright - but slightly different problem. These two lines come from include/migration/qemu-file.h; they were both added by Daniel in a9cfeb33bb23a81. The qemu-file.h header however has the old Fabrice copyright with a 3 paragraph copyright rather than the GPLv2.

So, Authors, and copyright need changing - not sure what the right way to do the copyright is. Personally I'd ask Dan really nicely to let it be GPL v2 or newer, but the quicker answer I think is to take the header from qemu-file.h

Quoted 29 lines
migration/rdma.c +1 -0
index 7eaaf96..166cd60 100644
@@ -20,6 +20,7 @@
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
 #include "exec/cpu-common.h"
+#include "qemu-file-channel.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
 #include "qemu/sockets.h"
migration/savevm.c +1 -0
index a728414..8565103 100644
@@ -36,6 +36,7 @@
 #include "sysemu/sysemu.h"
 #include "qemu/timer.h"
 #include "migration/migration.h"
+#include "qemu-file-channel.h"
 #include "postcopy-ram.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
tests/test-vmstate.c +0 -0
index f694a89..1c13570 100644

tests/test-vmstate.c line 32

Quoted 6 lines
tests/test-vmstate.c +1 -0
@@ -27,6 +27,7 @@
 #include "qemu-common.h"
 #include "migration/migration.h"
 #include "migration/vmstate.h"
+#include "../migration/qemu-file-channel.h"
 #include "qemu/coroutine.h"
 #include "io/channel-file.h"

Other than that, I'm OK, I hate the '../migration' but if it's the only way.

Dave

Quoted 4 lines
Signature · 1 line
2.9.3

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

#11 lore raw

Re: [Qemu-devel] [PATCH 3/9] migration: Export qemu-file-channel.c functions in its own file

Quoted 132 lines · Dr. David Alan Gilbert
Quoted 114 lines · * Juan Quintela ([email protected]) wrote:
---
 include/migration/migration.h |  1 +
 include/migration/qemu-file.h |  4 ----
 migration/channel.c           |  1 +
 migration/colo.c              |  1 +
 migration/migration.c         |  1 +
 migration/qemu-file-channel.c |  1 +
 migration/qemu-file-channel.h | 21 +++++++++++++++++++++
 migration/rdma.c              |  1 +
 migration/savevm.c            |  1 +
 tests/test-vmstate.c          |  1 +
 10 files changed, 29 insertions(+), 4 deletions(-)
 create mode 100644 migration/qemu-file-channel.h
include/migration/migration.h +1 -0
index e831259..8280df1 100644
@@ -19,6 +19,7 @@
 #include "qemu/thread.h"
 #include "qemu/notify.h"
 #include "migration/vmstate.h"
+#include "io/channel.h"
 #include "qapi-types.h"
 #include "exec/cpu-common.h"
 #include "qemu/coroutine_int.h"
include/migration/qemu-file.h +0 -4
index 0cd648a..b5ac800 100644
@@ -27,8 +27,6 @@
 
 #include "qemu-common.h"
 #include "exec/cpu-common.h"
-#include "io/channel.h"
-
 
 /* Read a chunk of data from a file at the given position.  The pos argument
  * can be ignored if the file is only be used for streaming.  The number of
@@ -119,8 +117,6 @@ typedef struct QEMUFileHooks {
 } QEMUFileHooks;
 
 QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops);
-QEMUFile *qemu_fopen_channel_input(QIOChannel *ioc);
-QEMUFile *qemu_fopen_channel_output(QIOChannel *ioc);
 void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks);
 int qemu_get_fd(QEMUFile *f);
 int qemu_fclose(QEMUFile *f);
migration/channel.c +1 -0
index 6104de5..fed8563 100644
@@ -16,6 +16,7 @@
 #include "qemu/osdep.h"
 #include "channel.h"
 #include "migration/migration.h"
+#include "qemu-file-channel.h"
 #include "trace.h"
 #include "qapi/error.h"
 #include "io/channel-tls.h"
migration/colo.c +1 -0
index dd38fed..9cd0250 100644
@@ -13,6 +13,7 @@
 #include "qemu/osdep.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
+#include "qemu-file-channel.h"
 #include "migration/colo.h"
 #include "migration/block.h"
 #include "io/channel-buffer.h"
migration/migration.c +1 -0
index 3ba32eb..ff3f7aa 100644
@@ -19,6 +19,7 @@
 #include "qemu/main-loop.h"
 #include "migration/blocker.h"
 #include "migration/migration.h"
+#include "qemu-file-channel.h"
 #include "migration/qemu-file.h"
 #include "sysemu/sysemu.h"
 #include "block/block.h"
migration/qemu-file-channel.c +1 -0
index 45c13f1..dc991c9 100644
@@ -23,6 +23,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu-file-channel.h"
 #include "migration/qemu-file.h"
 #include "io/channel-socket.h"
 #include "qemu/iov.h"
migration/qemu-file-channel.h new file +11 -0
new file mode 100644
index 0000000..d1bd5ff
@@ -0,0 +1,21 @@
+/*
+ * QEMU migration file channel operations
+ *
+ * Copyright IBM, Corp. 2008
+ *
+ * Authors:
+ *  Anthony Liguori   <[email protected]>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *

migration/qemu-file-channel.h line 21

Quoted 10 lines
migration/qemu-file-channel.h new file +10 -0
+ */
+
+#ifndef QEMU_FILE_CHANNEL_H
+#define QEMU_FILE_CHANNEL_H
+
+#include "io/channel.h"
+
+QEMUFile *qemu_fopen_channel_input(QIOChannel *ioc);
+QEMUFile *qemu_fopen_channel_output(QIOChannel *ioc);
+#endif

OK, similar copyright - but slightly different problem. These two lines come from include/migration/qemu-file.h; they were both added by Daniel in a9cfeb33bb23a81. The qemu-file.h header however has the old Fabrice copyright with a 3 paragraph copyright rather than the GPLv2.

Quoted 4 lines

So, Authors, and copyright need changing - not sure what the right way to do the copyright is. Personally I'd ask Dan really nicely to let it be GPL v2 or newer, but the quicker answer I think is to take the header from qemu-file.h

That is of course fine. Anything I contribute is under Red Hat copyright, and so as another Red Hat employee, you're free to change the license on any code I wrote [1]

Regards,
Daniel

[1] unless I put a comment about having copied the code from another source

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#12 lore raw

Re: [Qemu-devel] [PATCH 3/9] migration: Export qemu-file-channel.c functions in its own file

Quoted 13 lines · Daniel P. Berrange
Quoted 10 lines · Dr. David Alan Gilbert

OK, similar copyright - but slightly different problem. These two lines come from include/migration/qemu-file.h; they were both added by Daniel in a9cfeb33bb23a81. The qemu-file.h header however has the old Fabrice copyright with a 3 paragraph copyright rather than the GPLv2.

So, Authors, and copyright need changing - not sure what the right way to do the copyright is. Personally I'd ask Dan really nicely to let it be GPL v2 or newer, but the quicker answer I think is to take the header from qemu-file.h

Quoted 8 lines

That is of course fine. Anything I contribute is under Red Hat copyright, and so as another Red Hat employee, you're free to change the license on any code I wrote [1]

Regards,
Daniel

[1] unless I put a comment about having copied the code from another source

/*
* QEMU live migration channel operations
*
* Copyright Red Hat, Inc. 2016
*
* Authors:
* Daniel P. Berrange <[email protected]>
*
* 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. */

Putting that one for channel operations and qemu-file-chanel operations (changing the 1st line).

Later, Juan.

#8 lore raw

Re: [Qemu-devel] [PATCH 3/9] migration: Export qemu-file-channel.c functions in its own file

In reply to Juan Quintela
Quoted 44 lines · Juan Quintela
Quoted 16 lines · Peter Xu
Quoted 15 lines · Juan Quintela
---
 include/migration/migration.h |  1 +
 include/migration/qemu-file.h |  4 ----
 migration/channel.c           |  1 +
 migration/colo.c              |  1 +
 migration/migration.c         |  1 +
 migration/qemu-file-channel.c |  1 +
 migration/qemu-file-channel.h | 21 +++++++++++++++++++++
 migration/rdma.c              |  1 +
 migration/savevm.c            |  1 +
 tests/test-vmstate.c          |  1 +
 10 files changed, 29 insertions(+), 4 deletions(-)
 create mode 100644 migration/qemu-file-channel.h
Quoted 12 lines

include/migration/migration.h line 22

Quoted 9 lines
include/migration/migration.h +1 -0
index e831259..8280df1 100644
@@ -19,6 +19,7 @@
 #include "qemu/thread.h"
 #include "qemu/notify.h"
 #include "migration/vmstate.h"
+#include "io/channel.h"

Could I ask why we add this line here? I thought one of the main goals of this series is removing things from migration.h...

I remove from include/migration/qemu-file.h

-#include "io/channel.h"

Because all the QIOChannel functions in qemu-file.h are moved to qemu-file-channel.h.

Great!

But migration/vmstate.h includes qemu-file.h

Quoted 7 lines

And migration.h includes vmstate.h

And migration.h has this functions:

void qemu_start_incoming_migration(const char *uri, Error **errp);
                                            QIOChannel *ioc,
                                            Error **errp);

(In my repo, it does not need QIOChannel, which looks like:
void qemu_start_incoming_migration(const char *uri, Error **errp) but it does not really matter much...)

Quoted 10 lines

void migration_tls_channel_connect(MigrationState *s,
QIOChannel *ioc, const char *hostname, Error **errp);

And nothing else declares the QIOChannel.

So, the easy solution so far is to include this by now to maintain compilation.

I see. It's okay to me.

(Another solution would be moving these functions outside of
migration/migration.h as well since they are used by migration internally as well? Anyway we already have migration/tls.c to keep migration_tls_* functions)

I'll reply to the latest version of this patch for the r-b. Thanks.

Signature · 1 line
Peter Xu
#9 lore raw

Re: [Qemu-devel] [PATCH 3/9] migration: Export qemu-file-channel.c functions in its own file

Quoted 68 lines · Peter Xu
Quoted 44 lines · Juan Quintela
Quoted 16 lines · Peter Xu
Quoted 15 lines · Juan Quintela
---
 include/migration/migration.h |  1 +
 include/migration/qemu-file.h |  4 ----
 migration/channel.c           |  1 +
 migration/colo.c              |  1 +
 migration/migration.c         |  1 +
 migration/qemu-file-channel.c |  1 +
 migration/qemu-file-channel.h | 21 +++++++++++++++++++++
 migration/rdma.c              |  1 +
 migration/savevm.c            |  1 +
 tests/test-vmstate.c          |  1 +
 10 files changed, 29 insertions(+), 4 deletions(-)
 create mode 100644 migration/qemu-file-channel.h
Quoted 12 lines

include/migration/migration.h line 22

Quoted 9 lines
include/migration/migration.h +1 -0
index e831259..8280df1 100644
@@ -19,6 +19,7 @@
 #include "qemu/thread.h"
 #include "qemu/notify.h"
 #include "migration/vmstate.h"
+#include "io/channel.h"

Could I ask why we add this line here? I thought one of the main goals of this series is removing things from migration.h...

I remove from include/migration/qemu-file.h

-#include "io/channel.h"

Because all the QIOChannel functions in qemu-file.h are moved to qemu-file-channel.h.

Great!

But migration/vmstate.h includes qemu-file.h

Quoted 7 lines

And migration.h includes vmstate.h

And migration.h has this functions:

void qemu_start_incoming_migration(const char *uri, Error **errp);
                                            QIOChannel *ioc,
                                            Error **errp);

(In my repo, it does not need QIOChannel, which looks like:
void qemu_start_incoming_migration(const char *uri, Error **errp) but it does not really matter much...)

Quoted 10 lines

void migration_tls_channel_connect(MigrationState *s,
QIOChannel *ioc, const char *hostname, Error **errp);

And nothing else declares the QIOChannel.

So, the easy solution so far is to include this by now to maintain compilation.

Quoted 8 lines

I see. It's okay to me.

(Another solution would be moving these functions outside of
migration/migration.h as well since they are used by migration internally as well? Anyway we already have migration/tls.c to keep migration_tls_* functions)

I'll reply to the latest version of this patch for the r-b. Thanks.

They are moved there on the new cleanup series that I sent on Thrusday. Internally the series were about 70 patches, so I tried to group the patches in series by the way that they do similar things, so some things like this one have not been handled "perfectly". Grouping by this kind of thing made other things less clean. Compromise, as usual.

Thanks, Juan.