diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2017-05-18 10:05:50 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2017-05-18 10:05:52 +0100 |
commit | 2ccbd47c1def618b31af1d88b550f6d2bdd15b0f (patch) | |
tree | 9944ab67319550408e114c6842722e326df7c172 /include | |
parent | adb354dd1e00aa6b8bd674f0e1f70008badded0f (diff) | |
parent | 1bfe5f0586083747f1602931713111673849cd9d (diff) |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/migration/blocker.h | 35 | ||||
-rw-r--r-- | include/migration/migration.h | 50 | ||||
-rw-r--r-- | include/migration/page_cache.h | 86 | ||||
-rw-r--r-- | include/migration/vmstate.h | 2 | ||||
-rw-r--r-- | include/sysemu/sysemu.h | 6 |
5 files changed, 40 insertions, 139 deletions
diff --git a/include/migration/blocker.h b/include/migration/blocker.h new file mode 100644 index 0000000000..acd27018e9 --- /dev/null +++ b/include/migration/blocker.h @@ -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 diff --git a/include/migration/migration.h b/include/migration/migration.h index e29cb0144b..49ec5015e5 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -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 diff --git a/include/migration/page_cache.h b/include/migration/page_cache.h deleted file mode 100644 index 10ed53274c..0000000000 --- a/include/migration/page_cache.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Page cache for QEMU - * The cache is base on a hash of the page address - * - * Copyright 2012 Red Hat, Inc. and/or its affiliates - * - * Authors: - * Orit Wasserman <owasserm@redhat.com> - * - * This work is licensed under the terms of the GNU GPL, version 2 or later. - * See the COPYING file in the top-level directory. - * - */ - -#ifndef PAGE_CACHE_H -#define PAGE_CACHE_H - -/* Page cache for storing guest pages */ -typedef struct PageCache PageCache; - -/** - * cache_init: Initialize the page cache - * - * - * Returns new allocated cache or NULL on error - * - * @cache pointer to the PageCache struct - * @num_pages: cache maximal number of cached pages - * @page_size: cache page size - */ -PageCache *cache_init(int64_t num_pages, unsigned int page_size); - -/** - * cache_fini: free all cache resources - * @cache pointer to the PageCache struct - */ -void cache_fini(PageCache *cache); - -/** - * cache_is_cached: Checks to see if the page is cached - * - * Returns %true if page is cached - * - * @cache pointer to the PageCache struct - * @addr: page addr - * @current_age: current bitmap generation - */ -bool cache_is_cached(const PageCache *cache, uint64_t addr, - uint64_t current_age); - -/** - * get_cached_data: Get the data cached for an addr - * - * Returns pointer to the data cached or NULL if not cached - * - * @cache pointer to the PageCache struct - * @addr: page addr - */ -uint8_t *get_cached_data(const PageCache *cache, uint64_t addr); - -/** - * cache_insert: insert the page into the cache. the page cache - * will dup the data on insert. the previous value will be overwritten - * - * Returns -1 when the page isn't inserted into cache - * - * @cache pointer to the PageCache struct - * @addr: page address - * @pdata: pointer to the page - * @current_age: current bitmap generation - */ -int cache_insert(PageCache *cache, uint64_t addr, const uint8_t *pdata, - uint64_t current_age); - -/** - * cache_resize: resize the page cache. In case of size reduction the extra - * pages will be freed - * - * Returns -1 on error new cache size on success - * - * @cache pointer to the PageCache struct - * @num_pages: new page cache size (in pages) - */ -int64_t cache_resize(PageCache *cache, int64_t num_pages); - -#endif diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index f4bf3f1b4e..848965963a 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -1067,4 +1067,6 @@ int64_t self_announce_delay(int round) void dump_vmstate_json_to_file(FILE *out_fp); +bool vmstate_check_only_migratable(const VMStateDescription *vmsd); + #endif diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index be9e22c955..83c1ceb33e 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -15,7 +15,7 @@ /* vl.c */ extern const char *bios_name; - +extern int only_migratable; extern const char *qemu_name; extern QemuUUID qemu_uuid; extern bool qemu_uuid_set; @@ -75,8 +75,8 @@ 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); -int load_vmstate(const char *name); +int save_vmstate(const char *name, Error **errp); +int load_vmstate(const char *name, Error **errp); void qemu_announce_self(void); |