summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAnthony Liguori2013-03-11 14:30:34 +0100
committerAnthony Liguori2013-03-11 14:30:34 +0100
commitfe3cc14fd83e0c8f376d849ccd0fc3433388442d (patch)
tree8a354b91eab8a1ac16b4186f9fbb2a75772b75fe /include
parentarm: fix compilation with CONFIG_FDT (diff)
parentpage_cache: dup memory on insert (diff)
downloadqemu-fe3cc14fd83e0c8f376d849ccd0fc3433388442d.tar.gz
qemu-fe3cc14fd83e0c8f376d849ccd0fc3433388442d.tar.xz
qemu-fe3cc14fd83e0c8f376d849ccd0fc3433388442d.zip
Merge remote-tracking branch 'quintela/migration.next' into staging
# By Paolo Bonzini (40) and others # Via Juan Quintela * quintela/migration.next: (46 commits) page_cache: dup memory on insert page_cache: fix memory leak Fix cache_resize to keep old entry age Fix page_cache leak in cache_resize migration: inline migrate_fd_close migration: eliminate s->migration_file migration: move contents of migration_close to migrate_fd_cleanup migration: move rate limiting to QEMUFile migration: small changes around rate-limiting migration: use qemu_ftell to compute bandwidth migration: use QEMUFile for writing outgoing migration data migration: use QEMUFile for migration channel lifetime qemu-file: simplify and export qemu_ftell qemu-file: add writable socket QEMUFile qemu-file: check exit status when closing a pipe QEMUFile qemu-file: fsync a writable stdio QEMUFile migration: merge qemu_popen_cmd with qemu_popen migration: use qemu_file_rate_limit consistently migration: remove useless qemu_file_get_error check migration: detect error before sleeping ...
Diffstat (limited to 'include')
-rw-r--r--include/migration/migration.h12
-rw-r--r--include/migration/page_cache.h3
-rw-r--r--include/migration/qemu-file.h21
-rw-r--r--include/migration/vmstate.h21
-rw-r--r--include/qemu/atomic.h1
-rw-r--r--include/qemu/osdep.h7
-rw-r--r--include/sysemu/sysemu.h6
7 files changed, 35 insertions, 36 deletions
diff --git a/include/migration/migration.h b/include/migration/migration.h
index d1214097fe..bb617fdacf 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -34,18 +34,11 @@ struct MigrationState
int64_t bandwidth_limit;
size_t bytes_xfer;
size_t xfer_limit;
- uint8_t *buffer;
- size_t buffer_size;
- size_t buffer_capacity;
QemuThread thread;
-
+ QEMUBH *cleanup_bh;
QEMUFile *file;
- int fd;
+
int state;
- int (*get_error)(MigrationState *s);
- int (*close)(MigrationState *s);
- int (*write)(MigrationState *s, const void *buff, size_t size);
- void *opaque;
MigrationParams params;
int64_t total_time;
int64_t downtime;
@@ -54,7 +47,6 @@ struct MigrationState
int64_t dirty_bytes_rate;
bool enabled_capabilities[MIGRATION_CAPABILITY_MAX];
int64_t xbzrle_cache_size;
- bool complete;
};
void process_incoming_migration(QEMUFile *f);
diff --git a/include/migration/page_cache.h b/include/migration/page_cache.h
index 3839ac7726..87894fea9f 100644
--- a/include/migration/page_cache.h
+++ b/include/migration/page_cache.h
@@ -57,7 +57,8 @@ bool cache_is_cached(const PageCache *cache, uint64_t addr);
uint8_t *get_cached_data(const PageCache *cache, uint64_t addr);
/**
- * cache_insert: insert the page into the cache. the previous value will be overwritten
+ * cache_insert: insert the page into the cache. the page cache
+ * will dup the data on insert. the previous value will be overwritten
*
* @cache pointer to the PageCache struct
* @addr: page address
diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h
index 46fc11dc99..df812617f8 100644
--- a/include/migration/qemu-file.h
+++ b/include/migration/qemu-file.h
@@ -51,33 +51,17 @@ typedef int (QEMUFileCloseFunc)(void *opaque);
*/
typedef int (QEMUFileGetFD)(void *opaque);
-/* Called to determine if the file has exceeded its bandwidth allocation. The
- * bandwidth capping is a soft limit, not a hard limit.
- */
-typedef int (QEMUFileRateLimit)(void *opaque);
-
-/* Called to change the current bandwidth allocation. This function must return
- * the new actual bandwidth. It should be new_rate if everything goes ok, and
- * the old rate otherwise
- */
-typedef int64_t (QEMUFileSetRateLimit)(void *opaque, int64_t new_rate);
-typedef int64_t (QEMUFileGetRateLimit)(void *opaque);
-
typedef struct QEMUFileOps {
QEMUFilePutBufferFunc *put_buffer;
QEMUFileGetBufferFunc *get_buffer;
QEMUFileCloseFunc *close;
QEMUFileGetFD *get_fd;
- QEMUFileRateLimit *rate_limit;
- QEMUFileSetRateLimit *set_rate_limit;
- QEMUFileGetRateLimit *get_rate_limit;
} QEMUFileOps;
QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops);
QEMUFile *qemu_fopen(const char *filename, const char *mode);
QEMUFile *qemu_fdopen(int fd, const char *mode);
-QEMUFile *qemu_fopen_socket(int fd);
-QEMUFile *qemu_popen(FILE *popen_file, const char *mode);
+QEMUFile *qemu_fopen_socket(int fd, const char *mode);
QEMUFile *qemu_popen_cmd(const char *command, const char *mode);
int qemu_get_fd(QEMUFile *f);
int qemu_fclose(QEMUFile *f);
@@ -110,7 +94,8 @@ unsigned int qemu_get_be32(QEMUFile *f);
uint64_t qemu_get_be64(QEMUFile *f);
int qemu_file_rate_limit(QEMUFile *f);
-int64_t qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate);
+void qemu_file_reset_rate_limit(QEMUFile *f);
+void qemu_file_set_rate_limit(QEMUFile *f, int64_t new_rate);
int64_t qemu_file_get_rate_limit(QEMUFile *f);
int qemu_file_get_error(QEMUFile *f);
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 94a409b708..a64db941bc 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -32,15 +32,28 @@ typedef void SaveStateHandler(QEMUFile *f, void *opaque);
typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id);
typedef struct SaveVMHandlers {
+ /* This runs inside the iothread lock. */
void (*set_params)(const MigrationParams *params, void * opaque);
SaveStateHandler *save_state;
- int (*save_live_setup)(QEMUFile *f, void *opaque);
- int (*save_live_iterate)(QEMUFile *f, void *opaque);
+
+ void (*cancel)(void *opaque);
int (*save_live_complete)(QEMUFile *f, void *opaque);
+
+ /* This runs both outside and inside the iothread lock. */
+ bool (*is_active)(void *opaque);
+
+ /* This runs outside the iothread lock in the migration case, and
+ * within the lock in the savevm case. The callback had better only
+ * use data that is local to the migration thread or protected
+ * by other locks.
+ */
+ int (*save_live_iterate)(QEMUFile *f, void *opaque);
+
+ /* This runs outside the iothread lock! */
+ int (*save_live_setup)(QEMUFile *f, void *opaque);
uint64_t (*save_live_pending)(QEMUFile *f, void *opaque, uint64_t max_size);
- void (*cancel)(void *opaque);
+
LoadStateHandler *load_state;
- bool (*is_active)(void *opaque);
} SaveVMHandlers;
int register_savevm(DeviceState *dev,
diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h
index 96a194bbee..10becb6101 100644
--- a/include/qemu/atomic.h
+++ b/include/qemu/atomic.h
@@ -16,6 +16,7 @@
*/
#define smp_wmb() barrier()
#define smp_rmb() barrier()
+
/*
* We use GCC builtin if it's available, as that can use
* mfence on 32 bit as well, e.g. if built with -march=pentium-m.
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 87d3b9cfa8..df244006c7 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -9,6 +9,13 @@
#include <sys/signal.h>
#endif
+#ifndef _WIN32
+#include <sys/wait.h>
+#else
+#define WIFEXITED(x) 1
+#define WEXITSTATUS(x) (x)
+#endif
+
#include <sys/time.h>
#if defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index b19ec952b4..6578782fc3 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -73,10 +73,10 @@ void do_info_snapshots(Monitor *mon, const QDict *qdict);
void qemu_announce_self(void);
bool qemu_savevm_state_blocked(Error **errp);
-int qemu_savevm_state_begin(QEMUFile *f,
- const MigrationParams *params);
+void qemu_savevm_state_begin(QEMUFile *f,
+ const MigrationParams *params);
int qemu_savevm_state_iterate(QEMUFile *f);
-int qemu_savevm_state_complete(QEMUFile *f);
+void qemu_savevm_state_complete(QEMUFile *f);
void qemu_savevm_state_cancel(void);
uint64_t qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size);
int qemu_loadvm_state(QEMUFile *f);