kvmvapic: Fix TB invalidation after instruction patching
[qemu-kvm.git] / migration.h
blobc3a23cc6c8fa8f0ee601e82b26d1b722985676cd
1 /*
2 * QEMU live migration
4 * Copyright IBM, Corp. 2008
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #ifndef QEMU_MIGRATION_H
15 #define QEMU_MIGRATION_H
17 #include "qdict.h"
18 #include "qemu-common.h"
19 #include "notify.h"
20 #include "error.h"
21 #include "vmstate.h"
22 #include "qapi-types.h"
24 struct MigrationParams {
25 bool blk;
26 bool shared;
29 typedef struct MigrationState MigrationState;
31 struct MigrationState
33 int64_t bandwidth_limit;
34 QEMUFile *file;
35 int fd;
36 int state;
37 int (*get_error)(MigrationState *s);
38 int (*close)(MigrationState *s);
39 int (*write)(MigrationState *s, const void *buff, size_t size);
40 void *opaque;
41 MigrationParams params;
42 int64_t total_time;
43 int64_t downtime;
44 int64_t expected_downtime;
45 int64_t dirty_pages_rate;
46 bool enabled_capabilities[MIGRATION_CAPABILITY_MAX];
47 int64_t xbzrle_cache_size;
50 void process_incoming_migration(QEMUFile *f);
52 void qemu_start_incoming_migration(const char *uri, Error **errp);
54 uint64_t migrate_max_downtime(void);
56 void do_info_migrate_print(Monitor *mon, const QObject *data);
58 void do_info_migrate(Monitor *mon, QObject **ret_data);
60 void exec_start_incoming_migration(const char *host_port, Error **errp);
62 void exec_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp);
64 void tcp_start_incoming_migration(const char *host_port, Error **errp);
66 void tcp_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp);
68 void unix_start_incoming_migration(const char *path, Error **errp);
70 void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp);
72 void fd_start_incoming_migration(const char *path, Error **errp);
74 void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp);
76 void migrate_fd_error(MigrationState *s);
78 void migrate_fd_connect(MigrationState *s);
80 ssize_t migrate_fd_put_buffer(MigrationState *s, const void *data,
81 size_t size);
82 void migrate_fd_put_ready(MigrationState *s);
83 int migrate_fd_wait_for_unfreeze(MigrationState *s);
84 int migrate_fd_close(MigrationState *s);
86 void add_migration_state_change_notifier(Notifier *notify);
87 void remove_migration_state_change_notifier(Notifier *notify);
88 bool migration_is_active(MigrationState *);
89 bool migration_has_finished(MigrationState *);
90 bool migration_has_failed(MigrationState *);
91 MigrationState *migrate_get_current(void);
93 uint64_t ram_bytes_remaining(void);
94 uint64_t ram_bytes_transferred(void);
95 uint64_t ram_bytes_total(void);
97 extern SaveVMHandlers savevm_ram_handlers;
99 uint64_t dup_mig_bytes_transferred(void);
100 uint64_t dup_mig_pages_transferred(void);
101 uint64_t norm_mig_bytes_transferred(void);
102 uint64_t norm_mig_pages_transferred(void);
103 uint64_t xbzrle_mig_bytes_transferred(void);
104 uint64_t xbzrle_mig_pages_transferred(void);
105 uint64_t xbzrle_mig_pages_overflow(void);
106 uint64_t xbzrle_mig_pages_cache_miss(void);
109 * @migrate_add_blocker - prevent migration from proceeding
111 * @reason - an error to be returned whenever migration is attempted
113 void migrate_add_blocker(Error *reason);
116 * @migrate_del_blocker - remove a blocking error from migration
118 * @reason - the error blocking migration
120 void migrate_del_blocker(Error *reason);
122 int xbzrle_encode_buffer(uint8_t *old_buf, uint8_t *new_buf, int slen,
123 uint8_t *dst, int dlen);
124 int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen);
126 int migrate_use_xbzrle(void);
127 int64_t migrate_xbzrle_cache_size(void);
129 int64_t xbzrle_cache_resize(int64_t new_size);
131 #endif