~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to include/migration/migration.h

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "qapi-types.h"
23
23
#include "exec/cpu-common.h"
24
24
#include "qemu/coroutine_int.h"
 
25
#include "qom/object.h"
25
26
 
26
27
#define QEMU_VM_FILE_MAGIC           0x5145564d
27
28
#define QEMU_VM_FILE_VERSION_COMPAT  0x00000002
38
39
#define QEMU_VM_COMMAND              0x08
39
40
#define QEMU_VM_SECTION_FOOTER       0x7e
40
41
 
 
42
/* for vl.c */
 
43
extern int only_migratable;
 
44
 
41
45
struct MigrationParams {
42
46
    bool blk;
43
47
    bool shared;
89
93
     */
90
94
    QemuEvent main_thread_load_event;
91
95
 
 
96
    size_t         largest_page_size;
92
97
    bool           have_fault_thread;
93
98
    QemuThread     fault_thread;
94
99
    QemuSemaphore  fault_thread_sem;
104
109
    QEMUFile *to_src_file;
105
110
    QemuMutex rp_mutex;    /* We send replies from multiple threads */
106
111
    void     *postcopy_tmp_page;
 
112
    void     *postcopy_tmp_zero_page;
107
113
 
108
114
    QEMUBH *bh;
109
115
 
113
119
    QemuThread colo_incoming_thread;
114
120
    /* The coroutine we should enter (back) after failover */
115
121
    Coroutine *migration_incoming_co;
 
122
    QemuSemaphore colo_incoming_sem;
116
123
 
117
124
    /* See savevm.c */
118
125
    LoadStateEntry_Head loadvm_handlers;
119
126
};
120
127
 
121
128
MigrationIncomingState *migration_incoming_get_current(void);
122
 
MigrationIncomingState *migration_incoming_state_new(QEMUFile *f);
123
129
void migration_incoming_state_destroy(void);
124
130
 
125
131
/*
177
183
    /* Flag set once the migration thread is running (and needs joining) */
178
184
    bool migration_thread_running;
179
185
 
 
186
    /* Flag set once the migration thread called bdrv_inactivate_all */
 
187
    bool block_inactive;
 
188
 
180
189
    /* Queue of outstanding page requests from the destination */
181
190
    QemuMutex src_page_req_mutex;
182
191
    QSIMPLEQ_HEAD(src_page_requests, MigrationSrcPageRequest) src_page_requests;
183
192
    /* The RAMBlock used in the last src_page_request */
184
193
    RAMBlock *last_req_rb;
 
194
    /* The semaphore is used to notify COLO thread that failover is finished */
 
195
    QemuSemaphore colo_exit_sem;
 
196
 
 
197
    /* The semaphore is used to notify COLO thread to do checkpoint */
 
198
    QemuSemaphore colo_checkpoint_sem;
 
199
    int64_t colo_checkpoint_time;
 
200
    QEMUTimer *colo_delay_timer;
185
201
 
186
202
    /* The last error that occurred */
187
203
    Error *error;
240
256
MigrationState *migrate_init(const MigrationParams *params);
241
257
bool migration_is_blocked(Error **errp);
242
258
bool migration_in_setup(MigrationState *);
 
259
bool migration_is_idle(MigrationState *s);
243
260
bool migration_has_finished(MigrationState *);
244
261
bool migration_has_failed(MigrationState *);
245
262
/* True if outgoing migration has entered postcopy phase */
279
296
int ram_discard_range(MigrationIncomingState *mis, const char *block_name,
280
297
                      uint64_t start, size_t length);
281
298
int ram_postcopy_incoming_init(MigrationIncomingState *mis);
 
299
void ram_postcopy_migrated_memory_release(MigrationState *ms);
282
300
 
283
301
/**
284
302
 * @migrate_add_blocker - prevent migration from proceeding
285
303
 *
286
304
 * @reason - an error to be returned whenever migration is attempted
 
305
 *
 
306
 * @errp - [out] The reason (if any) we cannot block migration right now.
 
307
 *
 
308
 * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set.
287
309
 */
288
 
void migrate_add_blocker(Error *reason);
 
310
int migrate_add_blocker(Error *reason, Error **errp);
289
311
 
290
312
/**
291
313
 * @migrate_del_blocker - remove a blocking error from migration
294
316
 */
295
317
void migrate_del_blocker(Error *reason);
296
318
 
 
319
int check_migratable(Object *obj, Error **err);
 
320
 
 
321
bool migrate_release_ram(void);
297
322
bool migrate_postcopy_ram(void);
298
323
bool migrate_zero_blocks(void);
299
324
 
355
380
void flush_page_queue(MigrationState *ms);
356
381
int ram_save_queue_pages(MigrationState *ms, const char *rbname,
357
382
                         ram_addr_t start, ram_addr_t len);
 
383
uint64_t ram_pagesize_summary(void);
358
384
 
359
385
PostcopyState postcopy_state_get(void);
360
386
/* Set the state and return the old state */