Another cleanup of includes
cover Another cleanup of includes
Hi
This series:
- make all migration methods export its functions in its own header
- move block.h into migration/
- create migration/savevm.h for functions exported in savevm.c
- create migration/ram.h for functions from ram.c
- split qemu-file.h into it an qemu-file-types.h
only the last one is used outside of migration/
- move migration.h to be private
- create include/migration/misc.h for misc exported functions that don't belong anywhere
Please review.
Thanks, Juan.
Juan Quintela (11):
migration: Create savevm.h for functions exported from savevm.c
migration: Remove unneeded includes of migration/vmstate.h
migration: Split qemu-file.h
migration: Export exec.c functions in its own file
migration: Export fd.c functions in its own file
migration: Export socket.c functions in its own file
migration: Export tls.c functions in its own file
migration: Export rdma.c functions in its own file
migration: Create include for migration snapshots
migration: Export ram.c functions in its own file
migration: Move include/migration/block.h into migration/
hmp.c | 5 +-
hw/core/qdev.c | 1 -
hw/i2c/i2c-ddc.c | 1 +
hw/intc/s390_flic.c | 1 -
hw/intc/s390_flic_kvm.c | 1 -
hw/s390x/s390-skeys.c | 1 -
include/block/block_int.h | 4 +-
include/hw/acpi/memory_hotplug.h | 1 -
include/hw/acpi/pcihp.h | 1 -
include/hw/hw.h | 2 +-
include/hw/pci/shpc.h | 1 -
include/migration/migration.h | 68 -----------
include/migration/misc.h | 29 +++++
include/migration/qemu-file-types.h | 164 +++++++++++++++++++++++++++
include/migration/snapshot.h | 20 ++++
include/net/net.h | 1 -
include/sysemu/sysemu.h | 50 --------
migration/block.c | 5 +-
{include/migration => migration}/block.h | 2 -
migration/channel.c | 1 +
migration/colo.c | 5 +-
migration/exec.c | 1 +
migration/exec.h | 26 +++++
migration/fd.c | 1 +
migration/fd.h | 23 ++++
migration/migration.c | 11 +-
migration/postcopy-ram.c | 4 +-
migration/qemu-file-channel.c | 3 +-
migration/qemu-file.c | 2 +-
{include/migration => migration}/qemu-file.h | 157 +------------------------
migration/ram.c | 4 +-
migration/ram.h | 70 ++++++++++++
migration/rdma.c | 5 +-
migration/rdma.h | 25 ++++
migration/savevm.c | 36 +++++-
migration/savevm.h | 41 +++++++
migration/socket.c | 3 +-
migration/socket.h | 28 +++++
migration/tls.c | 1 +
migration/tls.h | 34 ++++++
migration/vmstate-types.c | 3 +-
migration/vmstate.c | 2 +-
replay/replay-snapshot.c | 5 +-
target/alpha/cpu.c | 1 -
target/hppa/cpu.c | 1 -
target/s390x/cpu.c | 1 -
target/tilegx/cpu.c | 1 -
tests/test-vmstate.c | 3 +-
vl.c | 5 +-
49 files changed, 544 insertions(+), 317 deletions(-)
create mode 100644 include/migration/misc.h
create mode 100644 include/migration/qemu-file-types.h
create mode 100644 include/migration/snapshot.h
rename {include/migration => migration}/block.h (93%)
create mode 100644 migration/exec.h
create mode 100644 migration/fd.h
rename {include/migration => migration}/qemu-file.h (62%)
create mode 100644 migration/ram.h
create mode 100644 migration/rdma.h
create mode 100644 migration/savevm.h
create mode 100644 migration/socket.h
create mode 100644 migration/tls.hSignature · 1 line
2.9.3
PATCH 1/11 migration: Create savevm.h for functions exported from savevm.c
This removes last trace of migration functions from sysemu/sysemu.h.
--- include/sysemu/sysemu.h | 47 ----------------------------------------------- migration/colo.c | 1 + migration/migration.c | 1 + migration/postcopy-ram.c | 1 + migration/savevm.c | 29 +++++++++++++++++++++++++---- migration/savevm.h | 41 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 69 insertions(+), 51 deletions(-) create mode 100644 migration/savevm.h
include/sysemu/sysemu.h +0 -47
@@ -79,53 +79,6 @@ int load_vmstate(const char *name, Error **errp);void qemu_announce_self (void ); -/* Subcommands for QEMU_VM_COMMAND */ -enum qemu_vm_cmd { -MIG_CMD_INVALID =0 ,/* Must be 0 */ -MIG_CMD_OPEN_RETURN_PATH ,/* Tell the dest to open the Return path */ -MIG_CMD_PING ,/* Request a PONG on the RP */ - -MIG_CMD_POSTCOPY_ADVISE ,/* Prior to any page transfers, just -warn we might want to do PC */ -MIG_CMD_POSTCOPY_LISTEN ,/* Start listening for incoming -pages as it's running. */ -MIG_CMD_POSTCOPY_RUN ,/* Start execution */ - -MIG_CMD_POSTCOPY_RAM_DISCARD ,/* A list of pages to discard that -were previously sent during -precopy but are dirty. */ -MIG_CMD_PACKAGED ,/* Send a wrapped stream within this stream */ -MIG_CMD_MAX -}; - -#define MAX_VM_CMD_PACKAGED_SIZE (1ul << 24) - -bool qemu_savevm_state_blocked (Error **errp); -void qemu_savevm_state_begin (QEMUFile *f); -void qemu_savevm_state_header (QEMUFile *f); -int qemu_savevm_state_iterate (QEMUFile *f,bool postcopy); -void qemu_savevm_state_cleanup (void ); -void qemu_savevm_state_complete_postcopy (QEMUFile *f); -void qemu_savevm_state_complete_precopy (QEMUFile *f,bool iterable_only); -void qemu_savevm_state_pending (QEMUFile *f,uint64_t max_size, -uint64_t *res_non_postcopiable, -uint64_t *res_postcopiable); -void qemu_savevm_command_send (QEMUFile *f,enum qemu_vm_cmd command, -uint16_t len,uint8_t *data); -void qemu_savevm_send_ping (QEMUFile *f,uint32_t value); -void qemu_savevm_send_open_return_path (QEMUFile *f); -int qemu_savevm_send_packaged (QEMUFile *f,const uint8_t *buf,size_t len); -void qemu_savevm_send_postcopy_advise (QEMUFile *f); -void qemu_savevm_send_postcopy_listen (QEMUFile *f); -void qemu_savevm_send_postcopy_run (QEMUFile *f); - -void qemu_savevm_send_postcopy_ram_discard (QEMUFile *f,const char *name, -uint16_t len, -uint64_t *start_list, -uint64_t *length_list); - -int qemu_loadvm_state (QEMUFile *f); -extern int autostart; typedef enum {
migration/colo.c +1 -0
@@ -16,6 +16,7 @@#include "qemu-file-channel.h" #include "migration/migration.h" #include "migration/qemu-file.h" +#include "savevm.h" #include "migration/colo.h" #include "migration/block.h" #include "io/channel-buffer.h"
migration/migration.c +1 -0
@@ -19,6 +19,7 @@#include "qemu/main-loop.h" #include "migration/blocker.h" #include "migration/migration.h" +#include "savevm.h" #include "qemu-file-channel.h" #include "migration/qemu-file.h" #include "migration/vmstate.h"
migration/postcopy-ram.c +1 -0
@@ -22,6 +22,7 @@#include "exec/target_page.h" #include "migration/migration.h" #include "migration/qemu-file.h" +#include "savevm.h" #include "postcopy-ram.h" #include "sysemu/sysemu.h" #include "sysemu/balloon.h"
migration/savevm.c +25 -4
@@ -36,6 +36,7 @@#include "qemu/timer.h" #include "migration/migration.h" #include "qemu-file-channel.h" +#include "savevm.h" #include "postcopy-ram.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h"
@@ -63,6 +64,26 @@ const unsigned int postcopy_ram_discard_version = 0;static bool skip_section_footers; +/* Subcommands for QEMU_VM_COMMAND */ +enum qemu_vm_cmd { +MIG_CMD_INVALID =0 ,/* Must be 0 */ +MIG_CMD_OPEN_RETURN_PATH ,/* Tell the dest to open the Return path */ +MIG_CMD_PING ,/* Request a PONG on the RP */ + +MIG_CMD_POSTCOPY_ADVISE ,/* Prior to any page transfers, just +warn we might want to do PC */ +MIG_CMD_POSTCOPY_LISTEN ,/* Start listening for incoming +pages as it's running. */ +MIG_CMD_POSTCOPY_RUN ,/* Start execution */ + +MIG_CMD_POSTCOPY_RAM_DISCARD ,/* A list of pages to discard that +were previously sent during +precopy but are dirty. */ +MIG_CMD_PACKAGED ,/* Send a wrapped stream within this stream */ +MIG_CMD_MAX +}; + +#define MAX_VM_CMD_PACKAGED_SIZE (1ul << 24) static struct mig_cmd_args { ssize_t len; /* -1 = variable */ const char *name;
@@ -807,10 +828,10 @@ static void save_section_footer(QEMUFile *f, SaveStateEntry *se)* @len: Length of associated data * @data: Data associated with command. */ -void qemu_savevm_command_send (QEMUFile *f, -enum qemu_vm_cmd command, -uint16_t len, -uint8_t *data) +static void qemu_savevm_command_send (QEMUFile *f, +enum qemu_vm_cmd command, +uint16_t len, +uint8_t *data) {trace_savevm_command_send (command, len);qemu_put_byte (f,QEMU_VM_COMMAND );
migration/savevm.h new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
2.9.3
Re: [Qemu-devel] [PATCH 01/11] migration: Create savevm.h for functions exported from savevm.c
Quoted 3 lines · Juan Quintela
This removes last trace of migration functions from
sysemu/sysemu.h.Signed-off-by Juan Quintela <[email protected]>
Quoted 206 lines
--- include/sysemu/sysemu.h | 47 ----------------------------------------------- migration/colo.c | 1 + migration/migration.c | 1 + migration/postcopy-ram.c | 1 + migration/savevm.c | 29 +++++++++++++++++++++++++---- migration/savevm.h | 41 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 69 insertions(+), 51 deletions(-) create mode 100644 migration/savevm.hinclude/sysemu/sysemu.h +0
-47@@ -79,53 +79,6 @@ int load_vmstate(const char *name, Error **errp);void qemu_announce_self (void ); -/* Subcommands for QEMU_VM_COMMAND */ -enum qemu_vm_cmd { -MIG_CMD_INVALID =0 ,/* Must be 0 */ -MIG_CMD_OPEN_RETURN_PATH ,/* Tell the dest to open the Return path */ -MIG_CMD_PING ,/* Request a PONG on the RP */ - -MIG_CMD_POSTCOPY_ADVISE ,/* Prior to any page transfers, just -warn we might want to do PC */ -MIG_CMD_POSTCOPY_LISTEN ,/* Start listening for incoming -pages as it's running. */ -MIG_CMD_POSTCOPY_RUN ,/* Start execution */ - -MIG_CMD_POSTCOPY_RAM_DISCARD ,/* A list of pages to discard that -were previously sent during -precopy but are dirty. */ -MIG_CMD_PACKAGED ,/* Send a wrapped stream within this stream */ -MIG_CMD_MAX -}; - -#define MAX_VM_CMD_PACKAGED_SIZE (1ul << 24) - -bool qemu_savevm_state_blocked (Error **errp); -void qemu_savevm_state_begin (QEMUFile *f); -void qemu_savevm_state_header (QEMUFile *f); -int qemu_savevm_state_iterate (QEMUFile *f,bool postcopy); -void qemu_savevm_state_cleanup (void ); -void qemu_savevm_state_complete_postcopy (QEMUFile *f); -void qemu_savevm_state_complete_precopy (QEMUFile *f,bool iterable_only); -void qemu_savevm_state_pending (QEMUFile *f,uint64_t max_size, -uint64_t *res_non_postcopiable, -uint64_t *res_postcopiable); -void qemu_savevm_command_send (QEMUFile *f,enum qemu_vm_cmd command, -uint16_t len,uint8_t *data); -void qemu_savevm_send_ping (QEMUFile *f,uint32_t value); -void qemu_savevm_send_open_return_path (QEMUFile *f); -int qemu_savevm_send_packaged (QEMUFile *f,const uint8_t *buf,size_t len); -void qemu_savevm_send_postcopy_advise (QEMUFile *f); -void qemu_savevm_send_postcopy_listen (QEMUFile *f); -void qemu_savevm_send_postcopy_run (QEMUFile *f); - -void qemu_savevm_send_postcopy_ram_discard (QEMUFile *f,const char *name, -uint16_t len, -uint64_t *start_list, -uint64_t *length_list); - -int qemu_loadvm_state (QEMUFile *f); -extern int autostart; typedef enum {migration/colo.c +1
-0@@ -16,6 +16,7 @@#include "qemu-file-channel.h" #include "migration/migration.h" #include "migration/qemu-file.h" +#include "savevm.h" #include "migration/colo.h" #include "migration/block.h" #include "io/channel-buffer.h" migration/migration.c +1
-0@@ -19,6 +19,7 @@#include "qemu/main-loop.h" #include "migration/blocker.h" #include "migration/migration.h" +#include "savevm.h" #include "qemu-file-channel.h" #include "migration/qemu-file.h" #include "migration/vmstate.h" migration/postcopy-ram.c +1
-0@@ -22,6 +22,7 @@#include "exec/target_page.h" #include "migration/migration.h" #include "migration/qemu-file.h" +#include "savevm.h" #include "postcopy-ram.h" #include "sysemu/sysemu.h" #include "sysemu/balloon.h" migration/savevm.c +25
-4@@ -36,6 +36,7 @@#include "qemu/timer.h" #include "migration/migration.h" #include "qemu-file-channel.h" +#include "savevm.h" #include "postcopy-ram.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" @@ -63,6 +64,26 @@ const unsigned int postcopy_ram_discard_version = 0;static bool skip_section_footers; +/* Subcommands for QEMU_VM_COMMAND */ +enum qemu_vm_cmd { +MIG_CMD_INVALID =0 ,/* Must be 0 */ +MIG_CMD_OPEN_RETURN_PATH ,/* Tell the dest to open the Return path */ +MIG_CMD_PING ,/* Request a PONG on the RP */ + +MIG_CMD_POSTCOPY_ADVISE ,/* Prior to any page transfers, just +warn we might want to do PC */ +MIG_CMD_POSTCOPY_LISTEN ,/* Start listening for incoming +pages as it's running. */ +MIG_CMD_POSTCOPY_RUN ,/* Start execution */ + +MIG_CMD_POSTCOPY_RAM_DISCARD ,/* A list of pages to discard that +were previously sent during +precopy but are dirty. */ +MIG_CMD_PACKAGED ,/* Send a wrapped stream within this stream */ +MIG_CMD_MAX +}; + +#define MAX_VM_CMD_PACKAGED_SIZE (1ul << 24) static struct mig_cmd_args { ssize_t len; /* -1 = variable */ const char *name;@@ -807,10 +828,10 @@ static void save_section_footer(QEMUFile *f, SaveStateEntry *se)* @len: Length of associated data * @data: Data associated with command. */ -void qemu_savevm_command_send (QEMUFile *f, -enum qemu_vm_cmd command, -uint16_t len, -uint8_t *data) +static void qemu_savevm_command_send (QEMUFile *f, +enum qemu_vm_cmd command, +uint16_t len, +uint8_t *data) {trace_savevm_command_send (command, len);qemu_put_byte (f,QEMU_VM_COMMAND );migration/savevm.h new file +41
-0@@ -0,0 +1,41 @@ +/* +* QEMU save vm functions +* +* Copyright (c) 2003-2008 Fabrice Bellard +* Copyright (c) 2009-2017 Red Hat Inc +* +* Authors: +* Juan Quintela <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or later. +* See the COPYING file in the top-level directory. +*/ + +#ifndef MIGRATION_SAVEVM_H +#define MIGRATION_SAVEVM_H + +bool qemu_savevm_state_blocked (Error **errp); +void qemu_savevm_state_begin (QEMUFile *f); +void qemu_savevm_state_header (QEMUFile *f); +int qemu_savevm_state_iterate (QEMUFile *f,bool postcopy); +void qemu_savevm_state_cleanup (void ); +void qemu_savevm_state_complete_postcopy (QEMUFile *f); +void qemu_savevm_state_complete_precopy (QEMUFile *f,bool iterable_only); +void qemu_savevm_state_pending (QEMUFile *f,uint64_t max_size, +uint64_t *res_non_postcopiable, +uint64_t *res_postcopiable); +void qemu_savevm_send_ping (QEMUFile *f,uint32_t value); +void qemu_savevm_send_open_return_path (QEMUFile *f); +int qemu_savevm_send_packaged (QEMUFile *f,const uint8_t *buf,size_t len); +void qemu_savevm_send_postcopy_advise (QEMUFile *f); +void qemu_savevm_send_postcopy_listen (QEMUFile *f); +void qemu_savevm_send_postcopy_run (QEMUFile *f); + +void qemu_savevm_send_postcopy_ram_discard (QEMUFile *f,const char *name, +uint16_t len, +uint64_t *start_list, +uint64_t *length_list); + +int qemu_loadvm_state (QEMUFile *f); + +#endif
PATCH 2/11 migration: Remove unneeded includes of migration/vmstate.h
In reply to Juan Quintela--- hw/core/qdev.c | 1 - include/hw/acpi/memory_hotplug.h | 1 - include/hw/acpi/pcihp.h | 1 - include/hw/pci/shpc.h | 1 - include/net/net.h | 1 - target/alpha/cpu.c | 1 - target/hppa/cpu.c | 1 - target/s390x/cpu.c | 1 - target/tilegx/cpu.c | 1 - 9 files changed, 9 deletions(-)
hw/core/qdev.c +0 -1
@@ -37,7 +37,6 @@#include "hw/boards.h" #include "hw/sysbus.h" #include "qapi-event.h" -#include "migration/vmstate.h" bool qdev_hotplug = false;static bool qdev_hot_added = false;
include/hw/acpi/memory_hotplug.h +0 -1
@@ -3,7 +3,6 @@#include "hw/qdev-core.h" #include "hw/acpi/acpi.h" -#include "migration/vmstate.h" #include "hw/acpi/aml-build.h" /**
include/hw/acpi/pcihp.h +0 -1
@@ -28,7 +28,6 @@#define HW_ACPI_PCIHP_H #include "hw/acpi/acpi.h" -#include "migration/vmstate.h" #include "hw/hotplug.h" #define ACPI_PCIHP_IO_BASE_PROP "acpi-pcihp-io-base"
include/hw/pci/shpc.h +0 -1
@@ -3,7 +3,6 @@#include "qemu-common.h" #include "exec/memory.h" -#include "migration/vmstate.h" #include "hw/hotplug.h" #include "hw/pci/pci.h"
include/net/net.h +0 -1
@@ -6,7 +6,6 @@#include "qapi/qmp/qdict.h" #include "qemu/option.h" #include "net/queue.h" -#include "migration/vmstate.h" #include "qapi-types.h" #define MAC_FMT "%02X:%02X:%02X:%02X:%02X:%02X"
target/alpha/cpu.c +0 -1
@@ -23,7 +23,6 @@#include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" -#include "migration/vmstate.h" #include "exec/exec-all.h"
target/hppa/cpu.c +0 -1
@@ -22,7 +22,6 @@#include "qapi/error.h" #include "cpu.h" #include "qemu-common.h" -#include "migration/vmstate.h" #include "exec/exec-all.h"
target/s390x/cpu.c +0 -1
@@ -32,7 +32,6 @@#include "qemu/error-report.h" #include "trace.h" #include "qapi/visitor.h" -#include "migration/vmstate.h" #include "exec/exec-all.h" #ifndef CONFIG_USER_ONLY #include "hw/hw.h"
target/tilegx/cpu.c +0 -1
@@ -23,7 +23,6 @@#include "cpu.h" #include "qemu-common.h" #include "hw/qdev-properties.h" -#include "migration/vmstate.h" #include "linux-user/syscall_defs.h" #include "exec/exec-all.h"
Signature · 1 line
2.9.3
Re: [Qemu-devel] [PATCH 02/11] migration: Remove unneeded includes of migration/vmstate.h
Quoted 19 lines · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>--- hw/core/qdev.c | 1 - include/hw/acpi/memory_hotplug.h | 1 - include/hw/acpi/pcihp.h | 1 - include/hw/pci/shpc.h | 1 - include/net/net.h | 1 - target/alpha/cpu.c | 1 - target/hppa/cpu.c | 1 - target/s390x/cpu.c | 1 - target/tilegx/cpu.c | 1 - 9 files changed, 9 deletions(-)hw/core/qdev.c +0
-0
hw/core/qdev.c line 42
Quoted 7 lines
hw/core/qdev.c +0
-1@@ -37,7 +37,6 @@#include "hw/boards.h" #include "hw/sysbus.h" #include "qapi-event.h" -#include "migration/vmstate.h" bool qdev_hotplug = false;static bool qdev_hot_added = false;
This one uses "VMStateDescription", "vmstate_check_only_migratable", "vmstate_register_with_alias_id" and "vmstate_unregister" from migration/savevm.h
include/hw/acpi/memory_hotplug.h line 8
Quoted 12 lines
include/hw/acpi/memory_hotplug.h +0
-1@@ -3,7 +3,6 @@#include "hw/qdev-core.h" #include "hw/acpi/acpi.h" -#include "migration/vmstate.h" #include "hw/acpi/aml-build.h" /**
This one uses "VMSTATE_STRUCT()" which is defined in migration/vmstate.h
include/hw/acpi/pcihp.h line 33
Quoted 12 lines
include/hw/acpi/pcihp.h +0
-1@@ -28,7 +28,6 @@#define HW_ACPI_PCIHP_H #include "hw/acpi/acpi.h" -#include "migration/vmstate.h" #include "hw/hotplug.h" #define ACPI_PCIHP_IO_BASE_PROP "acpi-pcihp-io-base"
This one uses "VMSTATE_STRUCT()" which is defined in migration/vmstate.h
include/hw/pci/shpc.h line 7
Quoted 11 lines
include/hw/pci/shpc.h +0
-1@@ -3,7 +3,6 @@#include "qemu-common.h" #include "exec/memory.h" -#include "migration/vmstate.h" #include "hw/hotplug.h" #include "hw/pci/pci.h"
This one uses "VMSTATE_BUFFER_UNSAFE_INFO_TEST()" which is defined in migration/vmstate.h.
include/net/net.h line 11
Quoted 13 lines
include/net/net.h +0
-1@@ -6,7 +6,6 @@#include "qapi/qmp/qdict.h" #include "qemu/option.h" #include "net/queue.h" -#include "migration/vmstate.h" #include "qapi-types.h" #define MAC_FMT "%02X:%02X:%02X:%02X:%02X:%02X"
This one uses "vmstate_offset_array()" which is defined in migration/vmstate.h
Perhaps you can explain why you think they are unneeded?
Thanks,
Laurent
Re: [Qemu-devel] [PATCH 02/11] migration: Remove unneeded includes of migration/vmstate.h
Quoted 25 lines · Laurent Vivier
Quoted 24 lines · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>--- hw/core/qdev.c | 1 - include/hw/acpi/memory_hotplug.h | 1 - include/hw/acpi/pcihp.h | 1 - include/hw/pci/shpc.h | 1 - include/net/net.h | 1 - target/alpha/cpu.c | 1 - target/hppa/cpu.c | 1 - target/s390x/cpu.c | 1 - target/tilegx/cpu.c | 1 - 9 files changed, 9 deletions(-)hw/core/qdev.c +0
-1@@ -37,7 +37,6 @@#include "hw/boards.h" #include "hw/sysbus.h" #include "qapi-event.h" -#include "migration/vmstate.h"
Quoted 6 lines
hw/core/qdev.c line 42
Quoted 2 lines
hw/core/qdev.c +0
-0bool qdev_hotplug = false;static bool qdev_hot_added = false;This one uses "VMStateDescription", "
vmstate_check_only_migratable", "vmstate_register_with_alias_id" and "vmstate_unregister" frommigration/savevm.h
#includes "hw/qdev.h"
which 1st include is
#include "hw/hw.h"
which include "migration/vmstate.h"
After this series the only include file that includes migration/vmstate.h is hw/hw.h. Removing it makes no sense (IMHO) because it would mean including it directly in more than half of the tree.
Quoted 7 lines
Quoted 7 lines
include/hw/acpi/memory_hotplug.h +0
-0@@ -3,7 +3,6 @@
Quoted 8 lines
include/hw/acpi/memory_hotplug.h line 8
Quoted 6 lines
include/hw/acpi/memory_hotplug.h +0
-1#include "hw/qdev-core.h" #include "hw/acpi/acpi.h" -#include "migration/vmstate.h" #include "hw/acpi/aml-build.h" /** This one uses "
VMSTATE_STRUCT()" which is defined inmigration/vmstate.h
#include "hw/acpi/acpi.h"
which includes:
#include "hw/acpi/acpi_dev_interface.h"
->
#include "hw/boards.h"
->
#include "hw/hw.h"
Quoted 7 lines
Quoted 7 lines
include/hw/acpi/pcihp.h +0
-0@@ -28,7 +28,6 @@#define HW_ACPI_PCIHP_H
Quoted 7 lines
include/hw/acpi/pcihp.h line 33
Quoted 5 lines
include/hw/acpi/pcihp.h +0
-1#include "hw/acpi/acpi.h" -#include "migration/vmstate.h" #include "hw/hotplug.h" #define ACPI_PCIHP_IO_BASE_PROP "acpi-pcihp-io-base"This one uses "
VMSTATE_STRUCT()" which is defined inmigration/vmstate.h
see previous one
Quoted 6 lines
Quoted 6 lines
include/hw/pci/shpc.h +0
-0@@ -3,7 +3,6 @@
Quoted 8 lines
include/hw/pci/shpc.h line 7
Quoted 5 lines
include/hw/pci/shpc.h +0
-1#include "qemu-common.h" #include "exec/memory.h" -#include "migration/vmstate.h" #include "hw/hotplug.h" #include "hw/pci/pci.h" This one uses "
VMSTATE_BUFFER_UNSAFE_INFO_TEST()" which is defined inmigration/vmstate.h.
#include "hw/pci/pci.h"
->
#include "hw/qedev.h"
->
#included "hw/hw.h"
Quoted 12 lines
Quoted 12 lines
include/net/net.h +0
-1@@ -6,7 +6,6 @@#include "qapi/qmp/qdict.h" #include "qemu/option.h" #include "net/queue.h" -#include "migration/vmstate.h" #include "qapi-types.h"
Quoted 6 lines
include/net/net.h line 11
Quoted 1 line
include/net/net.h +0
-0#define MAC_FMT "%02X:%02X:%02X:%02X:%02X:%02X"This one uses "
vmstate_offset_array()" which is defined inmigration/vmstate.hPerhaps you can explain why you think they are unneeded?
In all previous ones, they arrive to hw/hw.h for means that are not going to be removed. For this one, I am getting trouble finding a normal chain.
#include "qemu/osdep.h"
#include "net/net.h"
with this change works. But I am not able to find *why*.
So, I am dropping this last bit.
Is that ok for you?
Later, Juan.
Re: [Qemu-devel] [PATCH 02/11] migration: Remove unneeded includes of migration/vmstate.h
Quoted 132 lines · Juan Quintela
Quoted 25 lines · Laurent Vivier
Quoted 24 lines · Juan Quintela
Signed-off-by Juan Quintela <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>--- hw/core/qdev.c | 1 - include/hw/acpi/memory_hotplug.h | 1 - include/hw/acpi/pcihp.h | 1 - include/hw/pci/shpc.h | 1 - include/net/net.h | 1 - target/alpha/cpu.c | 1 - target/hppa/cpu.c | 1 - target/s390x/cpu.c | 1 - target/tilegx/cpu.c | 1 - 9 files changed, 9 deletions(-)hw/core/qdev.c +0
-1@@ -37,7 +37,6 @@#include "hw/boards.h" #include "hw/sysbus.h" #include "qapi-event.h" -#include "migration/vmstate.h" Quoted 6 lines
hw/core/qdev.c line 42
Quoted 2 lines
hw/core/qdev.c +0
-0bool qdev_hotplug = false;static bool qdev_hot_added = false;This one uses "VMStateDescription", "
vmstate_check_only_migratable", "vmstate_register_with_alias_id" and "vmstate_unregister" frommigration/savevm.h#includes "
hw/qdev.h"which 1st include is
#include "
hw/hw.h"which include "
migration/vmstate.h"After this series the only include file that includes
migration/vmstate.hishw/hw.h. Removing it makes no sense (IMHO) because it would mean including it directly in more than half of the tree.Quoted 7 lines
Quoted 7 lines
include/hw/acpi/memory_hotplug.h +0
-0@@ -3,7 +3,6 @@Quoted 8 lines
include/hw/acpi/memory_hotplug.h line 8
Quoted 6 lines
include/hw/acpi/memory_hotplug.h +0
-1#include "hw/qdev-core.h" #include "hw/acpi/acpi.h" -#include "migration/vmstate.h" #include "hw/acpi/aml-build.h" /** This one uses "
VMSTATE_STRUCT()" which is defined inmigration/vmstate.h#include "
hw/acpi/acpi.h"which includes:
#include "
hw/acpi/acpi_dev_interface.h"->
#include "
hw/boards.h"->
#include "
hw/hw.h"Quoted 7 lines
Quoted 7 lines
include/hw/acpi/pcihp.h +0
-0@@ -28,7 +28,6 @@#define HW_ACPI_PCIHP_H Quoted 7 lines
include/hw/acpi/pcihp.h line 33
Quoted 5 lines
include/hw/acpi/pcihp.h +0
-1#include "hw/acpi/acpi.h" -#include "migration/vmstate.h" #include "hw/hotplug.h" #define ACPI_PCIHP_IO_BASE_PROP "acpi-pcihp-io-base"This one uses "
VMSTATE_STRUCT()" which is defined inmigration/vmstate.hsee previous one
Quoted 6 lines
Quoted 6 lines
include/hw/pci/shpc.h +0
-0@@ -3,7 +3,6 @@Quoted 8 lines
include/hw/pci/shpc.h line 7
Quoted 5 lines
include/hw/pci/shpc.h +0
-1#include "qemu-common.h" #include "exec/memory.h" -#include "migration/vmstate.h" #include "hw/hotplug.h" #include "hw/pci/pci.h" This one uses "
VMSTATE_BUFFER_UNSAFE_INFO_TEST()" which is defined inmigration/vmstate.h.#include "
hw/pci/pci.h"
->
#include "hw/qedev.h"
->
#included "hw/hw.h"Quoted 12 lines
Quoted 12 lines
include/net/net.h +0
-1@@ -6,7 +6,6 @@#include "qapi/qmp/qdict.h" #include "qemu/option.h" #include "net/queue.h" -#include "migration/vmstate.h" #include "qapi-types.h" Quoted 6 lines
include/net/net.h line 11
Quoted 1 line
include/net/net.h +0
-0#define MAC_FMT "%02X:%02X:%02X:%02X:%02X:%02X"This one uses "
vmstate_offset_array()" which is defined inmigration/vmstate.hPerhaps you can explain why you think they are unneeded?
Quoted 8 lines
In all previous ones, they arrive to
hw/hw.hfor means that are not going to be removed. For this one, I am getting trouble finding a normal chain.#include "
qemu/osdep.h"
#include "net/net.h"with this change works. But I am not able to find *why*.
Perhaps you can play with "cc -E"?
Quoted 4 lines
So, I am dropping this last bit.
Is that ok for you?
It makes sense
Thanks,
Laurent
PATCH 3/11 migration: Split qemu-file.h
In reply to Juan QuintelaSplit the file into public and internal interfaces. I have to rename the external one because we can't have two include files with the same name in the same directory. Build system gets confused. The only exported functions are the ones that handle basic types.
---
hw/i2c/i2c-ddc.c | 1 +
hw/intc/s390_flic.c | 1 -
hw/intc/s390_flic_kvm.c | 1 -
hw/s390x/s390-skeys.c | 1 -
include/hw/hw.h | 2 +-
include/migration/qemu-file-types.h | 164 +++++++++++++++++++++++++++
migration/block.c | 2 +-
migration/colo.c | 2 +-
migration/migration.c | 2 +-
migration/postcopy-ram.c | 2 +-
migration/qemu-file-channel.c | 3 +-
migration/qemu-file.c | 2 +-
{include/migration => migration}/qemu-file.h | 157 +------------------------
migration/ram.c | 2 +-
migration/rdma.c | 2 +-
migration/savevm.c | 1 +
migration/socket.c | 2 +-
migration/vmstate-types.c | 3 +-
migration/vmstate.c | 2 +-
tests/test-vmstate.c | 3 +-
20 files changed, 186 insertions(+), 169 deletions(-)
create mode 100644 include/migration/qemu-file-types.h
rename {include/migration => migration}/qemu-file.h (62%)hw/i2c/i2c-ddc.c +1 -0
@@ -17,6 +17,7 @@*/ #include "qemu/osdep.h" +#include "qemu-common.h" #include "qemu/log.h" #include "hw/i2c/i2c.h" #include "hw/i2c/i2c-ddc.h"
hw/intc/s390_flic.c +0 -1
@@ -13,7 +13,6 @@#include "qemu/osdep.h" #include "qemu/error-report.h" #include "hw/sysbus.h" -#include "migration/qemu-file.h" #include "hw/s390x/s390_flic.h" #include "trace.h" #include "hw/qdev.h"
hw/intc/s390_flic_kvm.c +0 -1
@@ -17,7 +17,6 @@#include "qemu/error-report.h" #include "hw/sysbus.h" #include "sysemu/kvm.h" -#include "migration/qemu-file.h" #include "hw/s390x/s390_flic.h" #include "hw/s390x/adapter.h" #include "trace.h"
hw/s390x/s390-skeys.c +0 -1
@@ -12,7 +12,6 @@#include "qemu/osdep.h" #include "hw/boards.h" #include "qmp-commands.h" -#include "migration/qemu-file.h" #include "hw/s390x/storage-keys.h" #include "qemu/error-report.h" #include "sysemu/kvm.h"
include/hw/hw.h +1 -1
@@ -11,7 +11,7 @@#include "exec/memory.h" #include "hw/irq.h" #include "migration/vmstate.h" -#include "migration/qemu-file.h" +#include "migration/qemu-file-types.h" #include "qemu/module.h" #include "sysemu/reset.h"
include/migration/qemu-file-types.h new file +164 -0
164 lines not on this page · raw message
migration/block.c +1 -1
@@ -26,7 +26,7 @@#include "migration/block.h" #include "migration/migration.h" #include "sysemu/blockdev.h" -#include "migration/qemu-file.h" +#include "qemu-file.h" #include "migration/vmstate.h" #include "sysemu/block-backend.h"
migration/colo.c +1 -1
@@ -15,7 +15,7 @@#include "sysemu/sysemu.h" #include "qemu-file-channel.h" #include "migration/migration.h" -#include "migration/qemu-file.h" +#include "qemu-file.h" #include "savevm.h" #include "migration/colo.h" #include "migration/block.h"
migration/migration.c +1 -1
@@ -21,7 +21,7 @@#include "migration/migration.h" #include "savevm.h" #include "qemu-file-channel.h" -#include "migration/qemu-file.h" +#include "qemu-file.h" #include "migration/vmstate.h" #include "sysemu/sysemu.h" #include "block/block.h"
migration/postcopy-ram.c +1 -1
@@ -21,7 +21,7 @@#include "qemu-common.h" #include "exec/target_page.h" #include "migration/migration.h" -#include "migration/qemu-file.h" +#include "qemu-file.h" #include "savevm.h" #include "postcopy-ram.h" #include "sysemu/sysemu.h"
migration/qemu-file-channel.c +2 -1
@@ -24,7 +24,8 @@#include "qemu/osdep.h" #include "qemu-file-channel.h" -#include "migration/qemu-file.h" +#include "exec/cpu-common.h" +#include "qemu-file.h" #include "io/channel-socket.h" #include "qemu/iov.h"
migration/qemu-file.c +1 -1
@@ -29,7 +29,7 @@#include "qemu/sockets.h" #include "qemu/coroutine.h" #include "migration/migration.h" -#include "migration/qemu-file.h" +#include "qemu-file.h" #include "trace.h" #define IO_BUF_SIZE 32768
migration/qemu-file.h renamed from include/migration/qemu-file.h +4 -153
191 lines not on this page · raw message
migration/ram.c +1 -1
@@ -37,7 +37,7 @@#include "qemu/main-loop.h" #include "xbzrle.h" #include "migration/migration.h" -#include "migration/qemu-file.h" +#include "qemu-file.h" #include "migration/vmstate.h" #include "postcopy-ram.h" #include "exec/address-spaces.h"
migration/rdma.c +1 -1
@@ -18,7 +18,7 @@#include "qemu-common.h" #include "qemu/cutils.h" #include "migration/migration.h" -#include "migration/qemu-file.h" +#include "qemu-file.h" #include "exec/cpu-common.h" #include "qemu-file-channel.h" #include "qemu/error-report.h"
migration/savevm.c +1 -0
@@ -36,6 +36,7 @@#include "qemu/timer.h" #include "migration/migration.h" #include "qemu-file-channel.h" +#include "qemu-file.h" #include "savevm.h" #include "postcopy-ram.h" #include "qapi/qmp/qerror.h"
migration/socket.c +1 -1
@@ -21,7 +21,7 @@#include "qapi/error.h" #include "channel.h" #include "migration/migration.h" -#include "migration/qemu-file.h" +#include "qemu-file.h" #include "io/channel-socket.h" #include "trace.h"
migration/vmstate-types.c +2 -1
@@ -12,8 +12,9 @@#include "qemu/osdep.h" #include "qemu-common.h" +#include "exec/cpu-common.h" +#include "qemu-file.h" #include "migration/migration.h" -#include "migration/qemu-file.h" #include "migration/vmstate.h" #include "qemu/error-report.h" #include "qemu/queue.h"
migration/vmstate.c +1 -1
@@ -13,8 +13,8 @@#include "qemu/osdep.h" #include "qemu-common.h" #include "migration/migration.h" -#include "migration/qemu-file.h" #include "migration/vmstate.h" +#include "qemu-file.h" #include "qemu/bitops.h" #include "qemu/error-report.h" #include "trace.h"
tests/test-vmstate.c +2 -1
@@ -27,7 +27,8 @@#include "qemu-common.h" #include "migration/migration.h" #include "migration/vmstate.h" -#include "migration/qemu-file.h" +#include "migration/qemu-file-types.h" +#include "../migration/qemu-file.h" #include "../migration/qemu-file-channel.h" #include "qemu/coroutine.h" #include "io/channel-file.h"
Signature · 1 line
2.9.3
PATCH 4/11 migration: Export exec.c functions in its own file
In reply to Juan Quintela--- include/migration/migration.h | 4 ---- migration/exec.c | 1 + migration/exec.h | 26 ++++++++++++++++++++++++++ migration/migration.c | 1 + 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 migration/exec.h
include/migration/migration.h +0 -4
@@ -168,10 +168,6 @@ void migration_tls_channel_connect(MigrationState *s,uint64_t migrate_max_downtime (void ); -void exec_start_incoming_migration (const char *host_port,Error **errp); - -void exec_start_outgoing_migration (MigrationState *s,const char *host_port,Error **errp); -void tcp_start_incoming_migration (const char *host_port,Error **errp);void tcp_start_outgoing_migration (MigrationState *s,const char *host_port,Error **errp);
migration/exec.c +1 -0
@@ -21,6 +21,7 @@#include "qapi/error.h" #include "qemu-common.h" #include "channel.h" +#include "exec.h" #include "migration/migration.h" #include "io/channel-command.h" #include "trace.h"
migration/exec.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* QEMU live migration +* +* Copyright IBM, Corp. 2008 +* Copyright Dell MessageOne 2008 +* Copyright Red Hat, Inc. 2015-2016 +* +* Authors: +* Anthony Liguori <[email protected]> +* Charles Duffy <[email protected]> +* 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. +*/ + +#ifndef QEMU_MIGRATION_EXEC_H +#define QEMU_MIGRATION_EXEC_H +void exec_start_incoming_migration (const char *host_port,Error **errp); + +void exec_start_outgoing_migration (MigrationState *s,const char *host_port, +Error **errp); +#endif
migration/migration.c +1 -0
@@ -18,6 +18,7 @@#include "qemu/error-report.h" #include "qemu/main-loop.h" #include "migration/blocker.h" +#include "exec.h" #include "migration/migration.h" #include "savevm.h" #include "qemu-file-channel.h"
Signature · 1 line
2.9.3
PATCH 5/11 migration: Export fd.c functions in its own file
In reply to Juan Quintela--- include/migration/migration.h | 4 ---- migration/fd.c | 1 + migration/fd.h | 23 +++++++++++++++++++++++ migration/migration.c | 1 + 4 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 migration/fd.h
include/migration/migration.h +0 -4
@@ -176,10 +176,6 @@ void unix_start_incoming_migration(const char *path, Error **errp);void unix_start_outgoing_migration (MigrationState *s,const char *path,Error **errp); -void fd_start_incoming_migration (const char *path,Error **errp); - -void fd_start_outgoing_migration (MigrationState *s,const char *fdname,Error **errp); -void rdma_start_outgoing_migration (void *opaque,const char *host_port,Error **errp);void rdma_start_incoming_migration (const char *host_port,Error **errp);
migration/fd.c +1 -0
@@ -18,6 +18,7 @@#include "qapi/error.h" #include "qemu-common.h" #include "channel.h" +#include "fd.h" #include "migration/migration.h" #include "monitor/monitor.h" #include "io/channel-util.h"
migration/fd.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* QEMU live migration via generic fd +* +* Copyright Red Hat, Inc. 2009-2016 +* +* Authors: +* Chris Lalancette <[email protected]> +* 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. +*/ + +#ifndef QEMU_MIGRATION_FD_H +#define QEMU_MIGRATION_FD_H +void fd_start_incoming_migration (const char *path,Error **errp); + +void fd_start_outgoing_migration (MigrationState *s,const char *fdname, +Error **errp); +#endif
migration/migration.c +1 -0
@@ -19,6 +19,7 @@#include "qemu/main-loop.h" #include "migration/blocker.h" #include "exec.h" +#include "fd.h" #include "migration/migration.h" #include "savevm.h" #include "qemu-file-channel.h"
Signature · 1 line
2.9.3
PATCH 6/11 migration: Export socket.c functions in its own file
In reply to Juan Quintela--- include/migration/migration.h | 8 -------- migration/migration.c | 1 + migration/socket.c | 1 + migration/socket.h | 28 ++++++++++++++++++++++++++++ 4 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 migration/socket.h
include/migration/migration.h +0 -8
@@ -168,14 +168,6 @@ void migration_tls_channel_connect(MigrationState *s,uint64_t migrate_max_downtime (void ); -void tcp_start_incoming_migration (const char *host_port,Error **errp); - -void tcp_start_outgoing_migration (MigrationState *s,const char *host_port,Error **errp); - -void unix_start_incoming_migration (const char *path,Error **errp); - -void unix_start_outgoing_migration (MigrationState *s,const char *path,Error **errp); -void rdma_start_outgoing_migration (void *opaque,const char *host_port,Error **errp);void rdma_start_incoming_migration (const char *host_port,Error **errp);
migration/migration.c +1 -0
@@ -20,6 +20,7 @@#include "migration/blocker.h" #include "exec.h" #include "fd.h" +#include "socket.h" #include "migration/migration.h" #include "savevm.h" #include "qemu-file-channel.h"
migration/socket.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/error-report.h" #include "qapi/error.h" #include "channel.h" +#include "socket.h" #include "migration/migration.h" #include "qemu-file.h" #include "io/channel-socket.h"
migration/socket.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* QEMU live migration via socket +* +* Copyright Red Hat, Inc. 2009-2016 +* +* Authors: +* Chris Lalancette <[email protected]> +* 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. +*/ + +#ifndef QEMU_MIGRATION_SOCKET_H +#define QEMU_MIGRATION_SOCKET_H +void tcp_start_incoming_migration (const char *host_port,Error **errp); + +void tcp_start_outgoing_migration (MigrationState *s,const char *host_port, +Error **errp); + +void unix_start_incoming_migration (const char *path,Error **errp); + +void unix_start_outgoing_migration (MigrationState *s,const char *path, +Error **errp); +#endif
Signature · 1 line
2.9.3
PATCH 7/11 migration: Export tls.c functions in its own file
In reply to Juan QuintelaJust for the functions exported from tls.c. Notice that we can't remove the migration/migration.h include from tls.c because it access directly MigrationState for the tls params.
--- include/migration/migration.h | 10 ---------- migration/channel.c | 1 + migration/migration.c | 1 - migration/tls.c | 1 + migration/tls.h | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 36 insertions(+), 11 deletions(-) create mode 100644 migration/tls.h
include/migration/migration.h +0 -10
@@ -18,7 +18,6 @@#include "qemu-common.h" #include "qemu/thread.h" #include "qemu/notify.h" -#include "io/channel.h" #include "qapi-types.h" #include "exec/cpu-common.h" #include "qemu/coroutine_int.h"
@@ -157,15 +156,6 @@ void migration_fd_process_incoming(QEMUFile *f);void qemu_start_incoming_migration (const char *uri,Error **errp); -void migration_tls_channel_process_incoming (MigrationState *s, -QIOChannel *ioc, -Error **errp); - -void migration_tls_channel_connect (MigrationState *s, -QIOChannel *ioc, -const char *hostname, -Error **errp); -uint64_t migrate_max_downtime (void );void rdma_start_outgoing_migration (void *opaque,const char *host_port,Error **errp);
migration/channel.c +1 -0
@@ -15,6 +15,7 @@#include "qemu/osdep.h" #include "channel.h" +#include "tls.h" #include "migration/migration.h" #include "qemu-file-channel.h" #include "trace.h"
migration/migration.c +0 -1
@@ -43,7 +43,6 @@#include "exec/address-spaces.h" #include "exec/target_page.h" #include "io/channel-buffer.h" -#include "io/channel-tls.h" #include "migration/colo.h" #define MAX_THROTTLE (32 << 20)/* Migration transfer speed throttling */
migration/tls.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/osdep.h" #include "channel.h" #include "migration/migration.h" +#include "tls.h" #include "io/channel-tls.h" #include "crypto/tlscreds.h" #include "qemu/error-report.h"
migration/tls.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* QEMU migration TLS support +* +* Copyright (c) 2015 Red Hat, Inc. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; either +* version 2 of the License, or (at your option) any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, see <http://www.gnu.org/licenses/>. +* +*/ + +#ifndef QEMU_MIGRATION_TLS_H +#define QEMU_MIGRATION_TLS_H + +#include "io/channel.h" + +void migration_tls_channel_process_incoming (MigrationState *s, +QIOChannel *ioc, +Error **errp); + +void migration_tls_channel_connect (MigrationState *s, +QIOChannel *ioc, +const char *hostname, +Error **errp); +#endif
Signature · 1 line
2.9.3
PATCH 8/11 migration: Export rdma.c functions in its own file
In reply to Juan Quintela--- include/migration/migration.h | 4 ---- migration/migration.c | 1 + migration/rdma.c | 1 + migration/rdma.h | 25 +++++++++++++++++++++++++ 4 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 migration/rdma.h
include/migration/migration.h +0 -4
@@ -158,10 +158,6 @@ void qemu_start_incoming_migration(const char *uri, Error **errp);uint64_t migrate_max_downtime (void ); -void rdma_start_outgoing_migration (void *opaque,const char *host_port,Error **errp); - -void rdma_start_incoming_migration (const char *host_port,Error **errp); -void migrate_fd_error (MigrationState *s,const Error *error);void migrate_fd_connect (MigrationState *s);
migration/migration.c +1 -0
@@ -21,6 +21,7 @@#include "exec.h" #include "fd.h" #include "socket.h" +#include "rdma.h" #include "migration/migration.h" #include "savevm.h" #include "qemu-file-channel.h"
migration/rdma.c +1 -0
@@ -17,6 +17,7 @@#include "qapi/error.h" #include "qemu-common.h" #include "qemu/cutils.h" +#include "rdma.h" #include "migration/migration.h" #include "qemu-file.h" #include "exec/cpu-common.h"
migration/rdma.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* RDMA protocol and interfaces +* +* Copyright IBM, Corp. 2010-2013 +* Copyright Red Hat, Inc. 2015-2016 +* +* Authors: +* Michael R. Hines <[email protected]> +* Jiuxing Liu <[email protected]> +* Daniel P. Berrange <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2 or +* later. See the COPYING file in the top-level directory. +* +*/ + +#ifndef QEMU_MIGRATION_RDMA_H +#define QEMU_MIGRATION_RDMA_H + +void rdma_start_outgoing_migration (void *opaque,const char *host_port, +Error **errp); + +void rdma_start_incoming_migration (const char *host_port,Error **errp); + +#endif
Signature · 1 line
2.9.3
PATCH 9/11 migration: Create include for migration snapshots
In reply to Juan QuintelaStart removing migration code from sysemu/sysemu.h.
--- hmp.c | 5 +++-- include/block/block_int.h | 4 ++-- include/migration/snapshot.h | 20 ++++++++++++++++++++ include/sysemu/sysemu.h | 3 --- migration/savevm.c | 5 +++-- replay/replay-snapshot.c | 5 +++-- vl.c | 3 ++- 7 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 include/migration/snapshot.h
hmp.c +3 -2
@@ -42,6 +42,7 @@#include "qemu/error-report.h" #include "exec/ramlist.h" #include "hw/intc/intc.h" +#include "migration/snapshot.h" #ifdef CONFIG_SPICE #include <spice/enums.h>
@@ -1284,7 +1285,7 @@ void hmp_loadvm(Monitor *mon, const QDict *qdict)vm_stop (RUN_STATE_RESTORE_VM ); -if (load_vmstate (name, &err) ==0 && saved_vm_running) { +if (load_snapshot (name, &err) ==0 && saved_vm_running) {vm_start (); }hmp_handle_error (mon, &err);
@@ -1294,7 +1295,7 @@ void hmp_savevm(Monitor *mon, const QDict *qdict) {Error *err =NULL ; -save_vmstate (qdict_get_try_str (qdict,"name" ), &err); +save_snapshot (qdict_get_try_str (qdict,"name" ), &err);hmp_handle_error (mon, &err); }
include/block/block_int.h +2 -2
@@ -601,8 +601,8 @@ struct BlockDriverState {int copy_on_read;/* If we are reading a disk image, give its size in sectors. -* Generally read-only; it is written to by load_vmstate and save_vmstate, -* but the block layer is quiescent during those. +* Generally read-only; it is written to by load_snapshot and +* save_snaphost, but the block layer is quiescent during those. */ int64_t total_sectors;
include/migration/snapshot.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* 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_SAVEVM_H +#define QEMU_MIGRATION_SAVEVM_H + +int save_snapshot (const char *name,Error **errp); +int load_snapshot (const char *name,Error **errp); + +#endif
include/sysemu/sysemu.h +0 -3
@@ -74,9 +74,6 @@ void qemu_remove_exit_notifier(Notifier *notify);void qemu_add_machine_init_done_notifier (Notifier *notify);void qemu_remove_machine_init_done_notifier (Notifier *notify); -int save_vmstate (const char *name,Error **errp); -int load_vmstate (const char *name,Error **errp); -void qemu_announce_self (void );extern int autostart;
migration/savevm.c +3 -2
@@ -35,6 +35,7 @@#include "sysemu/sysemu.h" #include "qemu/timer.h" #include "migration/migration.h" +#include "migration/snapshot.h" #include "qemu-file-channel.h" #include "qemu-file.h" #include "savevm.h"
@@ -2087,7 +2088,7 @@ int qemu_loadvm_state(QEMUFile *f)return ret; } -int save_vmstate (const char *name,Error **errp) +int save_snapshot (const char *name,Error **errp) {BlockDriverState *bs, *bs1;QEMUSnapshotInfo sn1, *sn = &sn1, old_sn1, *old_sn = &old_sn1;
@@ -2244,7 +2245,7 @@ void qmp_xen_load_devices_state(const char *filename, Error **errp)migration_incoming_state_destroy (); } -int load_vmstate (const char *name,Error **errp) +int load_snapshot (const char *name,Error **errp) {BlockDriverState *bs, *bs_vm_state;QEMUSnapshotInfo sn;
replay/replay-snapshot.c +3 -2
@@ -19,6 +19,7 @@#include "qapi/qmp/qstring.h" #include "qemu/error-report.h" #include "migration/vmstate.h" +#include "migration/snapshot.h" static void replay_pre_save (void *opaque) {
@@ -66,13 +67,13 @@ void replay_vmstate_init(void)if (replay_snapshot) {if (replay_mode ==REPLAY_MODE_RECORD ) { -if (save_vmstate (replay_snapshot, &err) !=0 ) { +if (save_snapshot (replay_snapshot, &err) !=0 ) {error_report_err (err);error_report ("Could not create snapshot for icount record" );exit (1 ); } }else if (replay_mode ==REPLAY_MODE_PLAY ) { -if (load_vmstate (replay_snapshot, &err) !=0 ) { +if (load_snapshot (replay_snapshot, &err) !=0 ) {error_report_err (err);error_report ("Could not load snapshot for icount replay" );exit (1 );
vl.c +2 -1
@@ -87,6 +87,7 @@ int main(int argc, char **argv)#include "sysemu/blockdev.h" #include "hw/block/block.h" #include "migration/block.h" +#include "migration/snapshot.h" #include "sysemu/tpm.h" #include "sysemu/dma.h" #include "audio/audio.h"
@@ -4702,7 +4703,7 @@ int main(int argc, char **argv, char **envp)replay_vmstate_init (); }else if (loadvm) {Error *local_err =NULL ; -if (load_vmstate (loadvm, &local_err) <0 ) { +if (load_snapshot (loadvm, &local_err) <0 ) {error_report_err (local_err); autostart =0 ; }
Signature · 1 line
2.9.3
PATCH 10/11 migration: Export ram.c functions in its own file
In reply to Juan QuintelaAll functions are internal except for ram_mig_init(). Create migration/misc.h for this kind of functions.
--- include/migration/migration.h | 38 ----------------------- include/migration/misc.h | 21 +++++++++++++ migration/migration.c | 1 + migration/postcopy-ram.c | 1 + migration/ram.c | 2 ++ migration/ram.h | 70 +++++++++++++++++++++++++++++++++++++++++++ migration/rdma.c | 2 +- migration/savevm.c | 1 + vl.c | 1 + 9 files changed, 98 insertions(+), 39 deletions(-) create mode 100644 include/migration/misc.h create mode 100644 migration/ram.h
include/migration/migration.h +0 -38
@@ -176,38 +176,6 @@ bool migration_in_postcopy(void);bool migration_in_postcopy_after_devices (MigrationState *);MigrationState *migrate_get_current (void ); -void migrate_compress_threads_create (void ); -void migrate_compress_threads_join (void ); -void migrate_decompress_threads_create (void ); -void migrate_decompress_threads_join (void ); -uint64_t ram_bytes_remaining (void ); -uint64_t ram_bytes_transferred (void ); -uint64_t ram_bytes_total (void ); -uint64_t ram_dirty_sync_count (void ); -uint64_t ram_dirty_pages_rate (void ); -uint64_t ram_postcopy_requests (void ); -void free_xbzrle_decoded_buf (void ); - -void acct_update_position (QEMUFile *f,size_t size,bool zero); - -uint64_t dup_mig_pages_transferred (void ); -uint64_t norm_mig_pages_transferred (void ); -uint64_t xbzrle_mig_bytes_transferred (void ); -uint64_t xbzrle_mig_pages_transferred (void ); -uint64_t xbzrle_mig_pages_overflow (void ); -uint64_t xbzrle_mig_pages_cache_miss (void ); -double xbzrle_mig_cache_miss_rate (void ); - -void ram_handle_compressed (void *host,uint8_t ch,uint64_t size); -void ram_debug_dump_bitmap (unsigned long *todump,bool expected, -unsigned long pages); -/* For outgoing discard bitmap */ -int ram_postcopy_send_discard_bitmap (MigrationState *ms); -/* For incoming postcopy discard */ -int ram_discard_range (const char *block_name,uint64_t start,size_t length); -int ram_postcopy_incoming_init (MigrationIncomingState *mis); -void ram_postcopy_migrated_memory_release (MigrationState *ms); -bool migrate_release_ram (void );bool migrate_postcopy_ram (void );bool migrate_zero_blocks (void );
@@ -218,8 +186,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 (void );bool migrate_use_block_incremental (void );
@@ -258,7 +224,6 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size, uint64_t *bytes_sent); -void ram_mig_init (void );void savevm_skip_section_footers (void );void register_global_state (void );void global_state_set_optional (void );
@@ -266,7 +231,4 @@ void savevm_skip_configuration(void);int global_state_store (void );void global_state_store_running (void ); -void migration_page_queue_free (void ); -int ram_save_queue_pages (const char *rbname,ram_addr_t start,ram_addr_t len); -uint64_t ram_pagesize_summary (void );#endif
include/migration/misc.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* QEMU migration miscellaneus exported functions +* +* Copyright IBM, Corp. 2008 +* +* Authors: +* Anthony Liguori <[email protected]> +* +* This work is licensed under the terms of the GNU GPL, version 2. See +* the COPYING file in the top-level directory. +* +*/ + +#ifndef MIGRATION_MISC_H +#define MIGRATION_MISC_H + +/* migration/ram.c */ + +void ram_mig_init (void ); + +#endif
migration/migration.c +1 -0
@@ -22,6 +22,7 @@#include "fd.h" #include "socket.h" #include "rdma.h" +#include "ram.h" #include "migration/migration.h" #include "savevm.h" #include "qemu-file-channel.h"
migration/postcopy-ram.c +1 -0
@@ -24,6 +24,7 @@#include "qemu-file.h" #include "savevm.h" #include "postcopy-ram.h" +#include "ram.h" #include "sysemu/sysemu.h" #include "sysemu/balloon.h" #include "qemu/error-report.h"
migration/ram.c +2 -0
@@ -36,7 +36,9 @@#include "qemu/timer.h" #include "qemu/main-loop.h" #include "xbzrle.h" +#include "ram.h" #include "migration/migration.h" +#include "migration/misc.h" #include "qemu-file.h" #include "migration/vmstate.h" #include "postcopy-ram.h"
migration/ram.h new file +70 -0
70 lines not on this page · raw message
migration/rdma.c +1 -1
@@ -20,7 +20,7 @@#include "rdma.h" #include "migration/migration.h" #include "qemu-file.h" -#include "exec/cpu-common.h" +#include "ram.h" #include "qemu-file-channel.h" #include "qemu/error-report.h" #include "qemu/main-loop.h"
migration/savevm.c +1 -0
@@ -36,6 +36,7 @@#include "qemu/timer.h" #include "migration/migration.h" #include "migration/snapshot.h" +#include "ram.h" #include "qemu-file-channel.h" #include "qemu-file.h" #include "savevm.h"
vl.c +1 -0
@@ -87,6 +87,7 @@ int main(int argc, char **argv)#include "sysemu/blockdev.h" #include "hw/block/block.h" #include "migration/block.h" +#include "migration/misc.h" #include "migration/snapshot.h" #include "sysemu/tpm.h" #include "sysemu/dma.h"
Signature · 1 line
2.9.3
PATCH 11/11 migration: Move include/migration/block.h into migration/
In reply to Juan QuintelaAll functions were internal, except blk_mig_init() that is exported in misc.h now.
---
include/migration/misc.h | 8 ++++++++
migration/block.c | 3 ++-
{include/migration => migration}/block.h | 2 --
migration/colo.c | 2 +-
migration/migration.c | 2 +-
vl.c | 1 -
6 files changed, 12 insertions(+), 6 deletions(-)
rename {include/migration => migration}/block.h (93%)include/migration/misc.h +8 -0
@@ -18,4 +18,12 @@void ram_mig_init (void ); +/* migration/block.c */ + +#ifdef CONFIG_LIVE_BLOCK_MIGRATION +void blk_mig_init (void ); +#else +static inline void blk_mig_init (void ) {} +#endif +#endif
migration/block.c +2 -1
@@ -23,7 +23,8 @@#include "qemu/cutils.h" #include "qemu/queue.h" #include "qemu/timer.h" -#include "migration/block.h" +#include "block.h" +#include "migration/misc.h" #include "migration/migration.h" #include "sysemu/blockdev.h" #include "qemu-file.h"
migration/block.h renamed from include/migration/block.h +0 -2
@@ -15,14 +15,12 @@#define MIGRATION_BLOCK_H #ifdef CONFIG_LIVE_BLOCK_MIGRATION -void blk_mig_init (void );int blk_mig_active (void );uint64_t blk_mig_bytes_transferred (void );uint64_t blk_mig_bytes_remaining (void );uint64_t blk_mig_bytes_total (void );#else -static inline void blk_mig_init (void ) { }static inline int blk_mig_active (void ) {return false;
migration/colo.c +1 -1
@@ -18,7 +18,7 @@#include "qemu-file.h" #include "savevm.h" #include "migration/colo.h" -#include "migration/block.h" +#include "block.h" #include "io/channel-buffer.h" #include "trace.h" #include "qemu/error-report.h"
migration/migration.c +1 -1
@@ -34,7 +34,7 @@#include "qapi/util.h" #include "qemu/sockets.h" #include "qemu/rcu.h" -#include "migration/block.h" +#include "block.h" #include "postcopy-ram.h" #include "qemu/thread.h" #include "qmp-commands.h"
vl.c +0 -1
@@ -86,7 +86,6 @@ int main(int argc, char **argv)#include "qemu/log.h" #include "sysemu/blockdev.h" #include "hw/block/block.h" -#include "migration/block.h" #include "migration/misc.h" #include "migration/snapshot.h" #include "sysemu/tpm.h"
Signature · 1 line
2.9.3