mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'quintela/tags/migration/20170517' into staging
migration/next for 20170517 # gpg: Signature made Wed 17 May 2017 11:46:36 AM BST # gpg: using RSA key 0xF487EF185872D723 # gpg: Good signature from "Juan Quintela <quintela@redhat.com>" # gpg: aka "Juan Quintela <quintela@trasno.org>" # Primary key fingerprint: 1899 FF8E DEBF 58CC EE03 4B82 F487 EF18 5872 D723 * quintela/tags/migration/20170517: migration: Move check_migratable() into qdev.c migration: Move postcopy stuff to postcopy-ram.c migration: Move page_cache.c to migration/ migration: Create migration/blocker.h ram: Rename RAM_SAVE_FLAG_COMPRESS to RAM_SAVE_FLAG_ZERO migration: Pass Error ** argument to {save,load}_vmstate migration: Fix regression with compression threads Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
@@ -49,7 +49,6 @@ common-obj-$(CONFIG_POSIX) += os-posix.o
|
||||
common-obj-$(CONFIG_LINUX) += fsdev/
|
||||
|
||||
common-obj-y += migration/
|
||||
common-obj-y += page_cache.o #aio.o
|
||||
|
||||
common-obj-$(CONFIG_SPICE) += spice-qemu-char.o
|
||||
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
#include <zlib.h>
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "crypto/cipher.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/blocker.h"
|
||||
|
||||
/**************************************************************/
|
||||
/* QEMU COW block driver with compression and encryption support */
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/bswap.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/blocker.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include "qemu/uuid.h"
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
#include "qemu/crc32c.h"
|
||||
#include "qemu/bswap.h"
|
||||
#include "block/vhdx.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/blocker.h"
|
||||
#include "qemu/uuid.h"
|
||||
|
||||
/* Options for VHDX creation */
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/bswap.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/blocker.h"
|
||||
#include "qemu/cutils.h"
|
||||
#include <zlib.h>
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
#include "block/block_int.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "qemu/module.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/blocker.h"
|
||||
#include "qemu/bswap.h"
|
||||
#include "qemu/uuid.h"
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@
|
||||
#include "block/block_int.h"
|
||||
#include "qemu/module.h"
|
||||
#include "qemu/bswap.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/blocker.h"
|
||||
#include "qapi/qmp/qint.h"
|
||||
#include "qapi/qmp/qbool.h"
|
||||
#include "qapi/qmp/qstring.h"
|
||||
|
||||
@@ -1274,17 +1274,22 @@ void hmp_loadvm(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
int saved_vm_running = runstate_is_running();
|
||||
const char *name = qdict_get_str(qdict, "name");
|
||||
Error *err = NULL;
|
||||
|
||||
vm_stop(RUN_STATE_RESTORE_VM);
|
||||
|
||||
if (load_vmstate(name) == 0 && saved_vm_running) {
|
||||
if (load_vmstate(name, &err) == 0 && saved_vm_running) {
|
||||
vm_start();
|
||||
}
|
||||
hmp_handle_error(mon, &err);
|
||||
}
|
||||
|
||||
void hmp_savevm(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
save_vmstate(qdict_get_try_str(qdict, "name"));
|
||||
Error *err = NULL;
|
||||
|
||||
save_vmstate(qdict_get_try_str(qdict, "name"), &err);
|
||||
hmp_handle_error(mon, &err);
|
||||
}
|
||||
|
||||
void hmp_delvm(Monitor *mon, const QDict *qdict)
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
#include "9p-xattr.h"
|
||||
#include "coth.h"
|
||||
#include "trace.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/blocker.h"
|
||||
|
||||
int open_fd_hw;
|
||||
int total_open_fd;
|
||||
|
||||
+16
-4
@@ -37,7 +37,7 @@
|
||||
#include "hw/boards.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "qapi-event.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/vmstate.h"
|
||||
|
||||
bool qdev_hotplug = false;
|
||||
static bool qdev_hot_added = false;
|
||||
@@ -861,6 +861,20 @@ static bool device_get_realized(Object *obj, Error **errp)
|
||||
return dev->realized;
|
||||
}
|
||||
|
||||
static bool check_only_migratable(Object *obj, Error **err)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_GET_CLASS(obj);
|
||||
|
||||
if (!vmstate_check_only_migratable(dc->vmsd)) {
|
||||
error_setg(err, "Device %s is not migratable, but "
|
||||
"--only-migratable was specified",
|
||||
object_get_typename(obj));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void device_set_realized(Object *obj, bool value, Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
@@ -870,7 +884,6 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
|
||||
Error *local_err = NULL;
|
||||
bool unattached_parent = false;
|
||||
static int unattached_count;
|
||||
int ret;
|
||||
|
||||
if (dev->hotplugged && !dc->hotpluggable) {
|
||||
error_setg(errp, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj));
|
||||
@@ -878,8 +891,7 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
|
||||
}
|
||||
|
||||
if (value && !dev->realized) {
|
||||
ret = check_migratable(obj, &local_err);
|
||||
if (ret < 0) {
|
||||
if (!check_only_migratable(obj, &local_err)) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@
|
||||
#include "qemu/queue.h"
|
||||
#include "qemu/atomic.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/blocker.h"
|
||||
#include "trace.h"
|
||||
|
||||
#include "qxl.h"
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "hw/virtio/virtio.h"
|
||||
#include "hw/virtio/virtio-gpu.h"
|
||||
#include "hw/virtio/virtio-bus.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/blocker.h"
|
||||
#include "qemu/log.h"
|
||||
#include "qapi/error.h"
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "qemu-common.h"
|
||||
#include "cpu.h"
|
||||
#include "hw/sysbus.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/blocker.h"
|
||||
#include "sysemu/kvm.h"
|
||||
#include "kvm_arm.h"
|
||||
#include "gic_internal.h"
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "sysemu/kvm.h"
|
||||
#include "kvm_arm.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/blocker.h"
|
||||
|
||||
#define TYPE_KVM_ARM_ITS "arm-its-kvm"
|
||||
#define KVM_ARM_ITS(obj) OBJECT_CHECK(GICv3ITSState, (obj), TYPE_KVM_ARM_ITS)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "kvm_arm.h"
|
||||
#include "gicv3_internal.h"
|
||||
#include "vgic_common.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/blocker.h"
|
||||
|
||||
#ifdef DEBUG_GICV3_KVM
|
||||
#define DPRINTF(fmt, ...) \
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
#include "hw/pci/msi.h"
|
||||
#include "hw/pci/msix.h"
|
||||
#include "sysemu/kvm.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/blocker.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/event_notifier.h"
|
||||
#include "qom/object_interfaces.h"
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "monitor/monitor.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/blocker.h"
|
||||
#include "hw/virtio/vhost-scsi.h"
|
||||
#include "hw/virtio/vhost.h"
|
||||
#include "hw/virtio/virtio-scsi.h"
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
#include "exec/address-spaces.h"
|
||||
#include "hw/virtio/virtio-bus.h"
|
||||
#include "hw/virtio/virtio-access.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/blocker.h"
|
||||
#include "sysemu/dma.h"
|
||||
|
||||
/* enabled until disconnected backend stabilizes */
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* QEMU migration blockers
|
||||
*
|
||||
* Copyright IBM, Corp. 2008
|
||||
*
|
||||
* Authors:
|
||||
* Anthony Liguori <aliguori@us.ibm.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2. See
|
||||
* the COPYING file in the top-level directory.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MIGRATION_BLOCKER_H
|
||||
#define MIGRATION_BLOCKER_H
|
||||
|
||||
/**
|
||||
* @migrate_add_blocker - prevent migration from proceeding
|
||||
*
|
||||
* @reason - an error to be returned whenever migration is attempted
|
||||
*
|
||||
* @errp - [out] The reason (if any) we cannot block migration right now.
|
||||
*
|
||||
* @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set.
|
||||
*/
|
||||
int migrate_add_blocker(Error *reason, Error **errp);
|
||||
|
||||
/**
|
||||
* @migrate_del_blocker - remove a blocking error from migration
|
||||
*
|
||||
* @reason - the error blocking migration
|
||||
*/
|
||||
void migrate_del_blocker(Error *reason);
|
||||
|
||||
#endif
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "qapi-types.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "qemu/coroutine_int.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
#define QEMU_VM_FILE_MAGIC 0x5145564d
|
||||
#define QEMU_VM_FILE_VERSION_COMPAT 0x00000002
|
||||
@@ -39,9 +38,6 @@
|
||||
#define QEMU_VM_COMMAND 0x08
|
||||
#define QEMU_VM_SECTION_FOOTER 0x7e
|
||||
|
||||
/* for vl.c */
|
||||
extern int only_migratable;
|
||||
|
||||
struct MigrationParams {
|
||||
bool blk;
|
||||
bool shared;
|
||||
@@ -61,28 +57,6 @@ enum mig_rp_message_type {
|
||||
|
||||
typedef QLIST_HEAD(, LoadStateEntry) LoadStateEntry_Head;
|
||||
|
||||
/* The current postcopy state is read/set by postcopy_state_get/set
|
||||
* which update it atomically.
|
||||
* The state is updated as postcopy messages are received, and
|
||||
* in general only one thread should be writing to the state at any one
|
||||
* time, initially the main thread and then the listen thread;
|
||||
* Corner cases are where either thread finishes early and/or errors.
|
||||
* The state is checked as messages are received to ensure that
|
||||
* the source is sending us messages in the correct order.
|
||||
* The state is also used by the RAM reception code to know if it
|
||||
* has to place pages atomically, and the cleanup code at the end of
|
||||
* the main thread to know if it has to delay cleanup until the end
|
||||
* of postcopy.
|
||||
*/
|
||||
typedef enum {
|
||||
POSTCOPY_INCOMING_NONE = 0, /* Initial state - no postcopy */
|
||||
POSTCOPY_INCOMING_ADVISE,
|
||||
POSTCOPY_INCOMING_DISCARD,
|
||||
POSTCOPY_INCOMING_LISTENING,
|
||||
POSTCOPY_INCOMING_RUNNING,
|
||||
POSTCOPY_INCOMING_END
|
||||
} PostcopyState;
|
||||
|
||||
/* State for the incoming migration */
|
||||
struct MigrationIncomingState {
|
||||
QEMUFile *from_src_file;
|
||||
@@ -275,26 +249,6 @@ int ram_discard_range(const char *block_name, uint64_t start, size_t length);
|
||||
int ram_postcopy_incoming_init(MigrationIncomingState *mis);
|
||||
void ram_postcopy_migrated_memory_release(MigrationState *ms);
|
||||
|
||||
/**
|
||||
* @migrate_add_blocker - prevent migration from proceeding
|
||||
*
|
||||
* @reason - an error to be returned whenever migration is attempted
|
||||
*
|
||||
* @errp - [out] The reason (if any) we cannot block migration right now.
|
||||
*
|
||||
* @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set.
|
||||
*/
|
||||
int migrate_add_blocker(Error *reason, Error **errp);
|
||||
|
||||
/**
|
||||
* @migrate_del_blocker - remove a blocking error from migration
|
||||
*
|
||||
* @reason - the error blocking migration
|
||||
*/
|
||||
void migrate_del_blocker(Error *reason);
|
||||
|
||||
int check_migratable(Object *obj, Error **err);
|
||||
|
||||
bool migrate_release_ram(void);
|
||||
bool migrate_postcopy_ram(void);
|
||||
bool migrate_zero_blocks(void);
|
||||
@@ -357,8 +311,4 @@ void global_state_store_running(void);
|
||||
void migration_page_queue_free(void);
|
||||
int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len);
|
||||
uint64_t ram_pagesize_summary(void);
|
||||
|
||||
PostcopyState postcopy_state_get(void);
|
||||
/* Set the state and return the old state */
|
||||
PostcopyState postcopy_state_set(PostcopyState new_state);
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user