2 * COarse-grain LOck-stepping Virtual Machines for Non-stop Service (COLO)
3 * (a.k.a. Fault Tolerance or Continuous Replication)
5 * Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD.
6 * Copyright (c) 2016 FUJITSU LIMITED
7 * Copyright (c) 2016 Intel Corporation
9 * This work is licensed under the terms of the GNU GPL, version 2 or
10 * later. See the COPYING file in the top-level directory.
13 #include "qemu/osdep.h"
14 #include "sysemu/sysemu.h"
15 #include "qapi/error.h"
16 #include "qapi/qapi-commands-migration.h"
17 #include "migration.h"
18 #include "qemu-file.h"
20 #include "migration/colo.h"
21 #include "io/channel-buffer.h"
23 #include "qemu/error-report.h"
24 #include "qemu/main-loop.h"
26 #include "migration/failover.h"
27 #include "migration/ram.h"
28 #include "block/replication.h"
29 #include "net/colo-compare.h"
31 #include "block/block.h"
32 #include "qapi/qapi-events-migration.h"
33 #include "sysemu/cpus.h"
34 #include "sysemu/runstate.h"
35 #include "net/filter.h"
38 static bool vmstate_loading
;
39 static Notifier packets_compare_notifier
;
41 /* User need to know colo mode after COLO failover */
42 static COLOMode last_colo_mode
;
44 #define COLO_BUFFER_BASE_SIZE (4 * 1024 * 1024)
46 bool migration_in_colo_state(void)
48 MigrationState
*s
= migrate_get_current();
50 return (s
->state
== MIGRATION_STATUS_COLO
);
53 bool migration_incoming_in_colo_state(void)
55 MigrationIncomingState
*mis
= migration_incoming_get_current();
57 return mis
&& (mis
->state
== MIGRATION_STATUS_COLO
);
60 static bool colo_runstate_is_stopped(void)
62 return runstate_check(RUN_STATE_COLO
) || !runstate_is_running();
65 static void colo_checkpoint_notify(void)
67 MigrationState
*s
= migrate_get_current();
68 int64_t next_notify_time
;
70 qemu_event_set(&s
->colo_checkpoint_event
);
71 s
->colo_checkpoint_time
= qemu_clock_get_ms(QEMU_CLOCK_HOST
);
72 next_notify_time
= s
->colo_checkpoint_time
+ migrate_checkpoint_delay();
73 timer_mod(s
->colo_delay_timer
, next_notify_time
);
76 static void colo_checkpoint_notify_timer(void *opaque
)
78 colo_checkpoint_notify();
81 void colo_checkpoint_delay_set(void)
83 if (migration_in_colo_state()) {
84 colo_checkpoint_notify();
88 static void secondary_vm_do_failover(void)
90 /* COLO needs enable block-replication */
92 MigrationIncomingState
*mis
= migration_incoming_get_current();
93 Error
*local_err
= NULL
;
95 /* Can not do failover during the process of VM's loading VMstate, Or
96 * it will break the secondary VM.
98 if (vmstate_loading
) {
99 old_state
= failover_set_state(FAILOVER_STATUS_ACTIVE
,
100 FAILOVER_STATUS_RELAUNCH
);
101 if (old_state
!= FAILOVER_STATUS_ACTIVE
) {
102 error_report("Unknown error while do failover for secondary VM,"
103 "old_state: %s", FailoverStatus_str(old_state
));
108 migrate_set_state(&mis
->state
, MIGRATION_STATUS_COLO
,
109 MIGRATION_STATUS_COMPLETED
);
111 replication_stop_all(true, &local_err
);
113 error_report_err(local_err
);
117 /* Notify all filters of all NIC to do checkpoint */
118 colo_notify_filters_event(COLO_EVENT_FAILOVER
, &local_err
);
120 error_report_err(local_err
);
124 error_report("\"-S\" qemu option will be ignored in secondary side");
125 /* recover runstate to normal migration finish state */
129 * Make sure COLO incoming thread not block in recv or send,
130 * If mis->from_src_file and mis->to_src_file use the same fd,
131 * The second shutdown() will return -1, we ignore this value,
134 if (mis
->from_src_file
) {
135 qemu_file_shutdown(mis
->from_src_file
);
137 if (mis
->to_src_file
) {
138 qemu_file_shutdown(mis
->to_src_file
);
141 old_state
= failover_set_state(FAILOVER_STATUS_ACTIVE
,
142 FAILOVER_STATUS_COMPLETED
);
143 if (old_state
!= FAILOVER_STATUS_ACTIVE
) {
144 error_report("Incorrect state (%s) while doing failover for "
145 "secondary VM", FailoverStatus_str(old_state
));
148 /* Notify COLO incoming thread that failover work is finished */
149 qemu_sem_post(&mis
->colo_incoming_sem
);
151 /* For Secondary VM, jump to incoming co */
152 if (mis
->colo_incoming_co
) {
153 qemu_coroutine_enter(mis
->colo_incoming_co
);
157 static void primary_vm_do_failover(void)
159 MigrationState
*s
= migrate_get_current();
161 Error
*local_err
= NULL
;
163 migrate_set_state(&s
->state
, MIGRATION_STATUS_COLO
,
164 MIGRATION_STATUS_COMPLETED
);
166 * kick COLO thread which might wait at
167 * qemu_sem_wait(&s->colo_checkpoint_sem).
169 colo_checkpoint_notify();
172 * Wake up COLO thread which may blocked in recv() or send(),
173 * The s->rp_state.from_dst_file and s->to_dst_file may use the
174 * same fd, but we still shutdown the fd for twice, it is harmless.
176 if (s
->to_dst_file
) {
177 qemu_file_shutdown(s
->to_dst_file
);
179 if (s
->rp_state
.from_dst_file
) {
180 qemu_file_shutdown(s
->rp_state
.from_dst_file
);
183 old_state
= failover_set_state(FAILOVER_STATUS_ACTIVE
,
184 FAILOVER_STATUS_COMPLETED
);
185 if (old_state
!= FAILOVER_STATUS_ACTIVE
) {
186 error_report("Incorrect state (%s) while doing failover for Primary VM",
187 FailoverStatus_str(old_state
));
191 replication_stop_all(true, &local_err
);
193 error_report_err(local_err
);
197 /* Notify COLO thread that failover work is finished */
198 qemu_sem_post(&s
->colo_exit_sem
);
201 COLOMode
get_colo_mode(void)
203 if (migration_in_colo_state()) {
204 return COLO_MODE_PRIMARY
;
205 } else if (migration_incoming_in_colo_state()) {
206 return COLO_MODE_SECONDARY
;
208 return COLO_MODE_NONE
;
212 void colo_do_failover(void)
214 /* Make sure VM stopped while failover happened. */
215 if (!colo_runstate_is_stopped()) {
216 vm_stop_force_state(RUN_STATE_COLO
);
219 switch (last_colo_mode
= get_colo_mode()) {
220 case COLO_MODE_PRIMARY
:
221 primary_vm_do_failover();
223 case COLO_MODE_SECONDARY
:
224 secondary_vm_do_failover();
227 error_report("colo_do_failover failed because the colo mode"
228 " could not be obtained");
232 void qmp_xen_set_replication(bool enable
, bool primary
,
233 bool has_failover
, bool failover
,
236 ReplicationMode mode
= primary
?
237 REPLICATION_MODE_PRIMARY
:
238 REPLICATION_MODE_SECONDARY
;
240 if (has_failover
&& enable
) {
241 error_setg(errp
, "Parameter 'failover' is only for"
242 " stopping replication");
247 replication_start_all(mode
, errp
);
252 replication_stop_all(failover
, failover
? NULL
: errp
);
256 ReplicationStatus
*qmp_query_xen_replication_status(Error
**errp
)
259 ReplicationStatus
*s
= g_new0(ReplicationStatus
, 1);
261 replication_get_error_all(&err
);
264 s
->desc
= g_strdup(error_get_pretty(err
));
273 void qmp_xen_colo_do_checkpoint(Error
**errp
)
277 replication_do_checkpoint_all(&err
);
279 error_propagate(errp
, err
);
282 /* Notify all filters of all NIC to do checkpoint */
283 colo_notify_filters_event(COLO_EVENT_CHECKPOINT
, errp
);
286 COLOStatus
*qmp_query_colo_status(Error
**errp
)
288 COLOStatus
*s
= g_new0(COLOStatus
, 1);
290 s
->mode
= get_colo_mode();
291 s
->last_mode
= last_colo_mode
;
293 switch (failover_get_state()) {
294 case FAILOVER_STATUS_NONE
:
295 s
->reason
= COLO_EXIT_REASON_NONE
;
297 case FAILOVER_STATUS_COMPLETED
:
298 s
->reason
= COLO_EXIT_REASON_REQUEST
;
301 if (migration_in_colo_state()) {
302 s
->reason
= COLO_EXIT_REASON_PROCESSING
;
304 s
->reason
= COLO_EXIT_REASON_ERROR
;
311 static void colo_send_message(QEMUFile
*f
, COLOMessage msg
,
316 if (msg
>= COLO_MESSAGE__MAX
) {
317 error_setg(errp
, "%s: Invalid message", __func__
);
320 qemu_put_be32(f
, msg
);
321 ret
= qemu_fflush(f
);
323 error_setg_errno(errp
, -ret
, "Can't send COLO message");
325 trace_colo_send_message(COLOMessage_str(msg
));
328 static void colo_send_message_value(QEMUFile
*f
, COLOMessage msg
,
329 uint64_t value
, Error
**errp
)
331 Error
*local_err
= NULL
;
334 colo_send_message(f
, msg
, &local_err
);
336 error_propagate(errp
, local_err
);
339 qemu_put_be64(f
, value
);
340 ret
= qemu_fflush(f
);
342 error_setg_errno(errp
, -ret
, "Failed to send value for message:%s",
343 COLOMessage_str(msg
));
347 static COLOMessage
colo_receive_message(QEMUFile
*f
, Error
**errp
)
352 msg
= qemu_get_be32(f
);
353 ret
= qemu_file_get_error(f
);
355 error_setg_errno(errp
, -ret
, "Can't receive COLO message");
358 if (msg
>= COLO_MESSAGE__MAX
) {
359 error_setg(errp
, "%s: Invalid message", __func__
);
362 trace_colo_receive_message(COLOMessage_str(msg
));
366 static void colo_receive_check_message(QEMUFile
*f
, COLOMessage expect_msg
,
370 Error
*local_err
= NULL
;
372 msg
= colo_receive_message(f
, &local_err
);
374 error_propagate(errp
, local_err
);
377 if (msg
!= expect_msg
) {
378 error_setg(errp
, "Unexpected COLO message %d, expected %d",
383 static uint64_t colo_receive_message_value(QEMUFile
*f
, uint32_t expect_msg
,
386 Error
*local_err
= NULL
;
390 colo_receive_check_message(f
, expect_msg
, &local_err
);
392 error_propagate(errp
, local_err
);
396 value
= qemu_get_be64(f
);
397 ret
= qemu_file_get_error(f
);
399 error_setg_errno(errp
, -ret
, "Failed to get value for COLO message: %s",
400 COLOMessage_str(expect_msg
));
405 static int colo_do_checkpoint_transaction(MigrationState
*s
,
406 QIOChannelBuffer
*bioc
,
409 Error
*local_err
= NULL
;
412 colo_send_message(s
->to_dst_file
, COLO_MESSAGE_CHECKPOINT_REQUEST
,
418 colo_receive_check_message(s
->rp_state
.from_dst_file
,
419 COLO_MESSAGE_CHECKPOINT_REPLY
, &local_err
);
423 /* Reset channel-buffer directly */
424 qio_channel_io_seek(QIO_CHANNEL(bioc
), 0, 0, NULL
);
428 if (failover_get_state() != FAILOVER_STATUS_NONE
) {
432 vm_stop_force_state(RUN_STATE_COLO
);
434 trace_colo_vm_state_change("run", "stop");
436 * Failover request bh could be called after vm_stop_force_state(),
437 * So we need check failover_request_is_active() again.
439 if (failover_get_state() != FAILOVER_STATUS_NONE
) {
444 replication_do_checkpoint_all(&local_err
);
450 colo_send_message(s
->to_dst_file
, COLO_MESSAGE_VMSTATE_SEND
, &local_err
);
455 /* Note: device state is saved into buffer */
456 ret
= qemu_save_device_state(fb
);
463 if (migrate_auto_converge()) {
464 mig_throttle_counter_reset();
467 * Only save VM's live state, which not including device state.
468 * TODO: We may need a timeout mechanism to prevent COLO process
469 * to be blocked here.
471 qemu_savevm_live_state(s
->to_dst_file
);
476 * We need the size of the VMstate data in Secondary side,
477 * With which we can decide how much data should be read.
479 colo_send_message_value(s
->to_dst_file
, COLO_MESSAGE_VMSTATE_SIZE
,
480 bioc
->usage
, &local_err
);
485 qemu_put_buffer(s
->to_dst_file
, bioc
->data
, bioc
->usage
);
486 ret
= qemu_fflush(s
->to_dst_file
);
491 colo_receive_check_message(s
->rp_state
.from_dst_file
,
492 COLO_MESSAGE_VMSTATE_RECEIVED
, &local_err
);
497 qemu_event_reset(&s
->colo_checkpoint_event
);
498 colo_notify_compares_event(NULL
, COLO_EVENT_CHECKPOINT
, &local_err
);
503 colo_receive_check_message(s
->rp_state
.from_dst_file
,
504 COLO_MESSAGE_VMSTATE_LOADED
, &local_err
);
514 trace_colo_vm_state_change("stop", "run");
518 error_report_err(local_err
);
523 static void colo_compare_notify_checkpoint(Notifier
*notifier
, void *data
)
525 colo_checkpoint_notify();
528 static void colo_process_checkpoint(MigrationState
*s
)
530 QIOChannelBuffer
*bioc
;
532 Error
*local_err
= NULL
;
535 if (get_colo_mode() != COLO_MODE_PRIMARY
) {
536 error_report("COLO mode must be COLO_MODE_PRIMARY");
540 failover_init_state();
542 s
->rp_state
.from_dst_file
= qemu_file_get_return_path(s
->to_dst_file
);
543 if (!s
->rp_state
.from_dst_file
) {
544 error_report("Open QEMUFile from_dst_file failed");
548 packets_compare_notifier
.notify
= colo_compare_notify_checkpoint
;
549 colo_compare_register_notifier(&packets_compare_notifier
);
552 * Wait for Secondary finish loading VM states and enter COLO
555 colo_receive_check_message(s
->rp_state
.from_dst_file
,
556 COLO_MESSAGE_CHECKPOINT_READY
, &local_err
);
560 bioc
= qio_channel_buffer_new(COLO_BUFFER_BASE_SIZE
);
561 fb
= qemu_file_new_output(QIO_CHANNEL(bioc
));
562 object_unref(OBJECT(bioc
));
565 replication_start_all(REPLICATION_MODE_PRIMARY
, &local_err
);
573 trace_colo_vm_state_change("stop", "run");
575 timer_mod(s
->colo_delay_timer
, qemu_clock_get_ms(QEMU_CLOCK_HOST
) +
576 migrate_checkpoint_delay());
578 while (s
->state
== MIGRATION_STATUS_COLO
) {
579 if (failover_get_state() != FAILOVER_STATUS_NONE
) {
580 error_report("failover request");
584 qemu_event_wait(&s
->colo_checkpoint_event
);
586 if (s
->state
!= MIGRATION_STATUS_COLO
) {
589 ret
= colo_do_checkpoint_transaction(s
, bioc
, fb
);
596 /* Throw the unreported error message after exited from loop */
598 error_report_err(local_err
);
606 * There are only two reasons we can get here, some error happened
607 * or the user triggered failover.
609 switch (failover_get_state()) {
610 case FAILOVER_STATUS_COMPLETED
:
611 qapi_event_send_colo_exit(COLO_MODE_PRIMARY
,
612 COLO_EXIT_REASON_REQUEST
);
615 qapi_event_send_colo_exit(COLO_MODE_PRIMARY
,
616 COLO_EXIT_REASON_ERROR
);
619 /* Hope this not to be too long to wait here */
620 qemu_sem_wait(&s
->colo_exit_sem
);
621 qemu_sem_destroy(&s
->colo_exit_sem
);
624 * It is safe to unregister notifier after failover finished.
625 * Besides, colo_delay_timer and colo_checkpoint_sem can't be
626 * released before unregister notifier, or there will be use-after-free
629 colo_compare_unregister_notifier(&packets_compare_notifier
);
630 timer_free(s
->colo_delay_timer
);
631 qemu_event_destroy(&s
->colo_checkpoint_event
);
634 * Must be called after failover BH is completed,
635 * Or the failover BH may shutdown the wrong fd that
636 * re-used by other threads after we release here.
638 if (s
->rp_state
.from_dst_file
) {
639 qemu_fclose(s
->rp_state
.from_dst_file
);
640 s
->rp_state
.from_dst_file
= NULL
;
644 void migrate_start_colo_process(MigrationState
*s
)
647 qemu_event_init(&s
->colo_checkpoint_event
, false);
648 s
->colo_delay_timer
= timer_new_ms(QEMU_CLOCK_HOST
,
649 colo_checkpoint_notify_timer
, NULL
);
651 qemu_sem_init(&s
->colo_exit_sem
, 0);
652 colo_process_checkpoint(s
);
656 static void colo_incoming_process_checkpoint(MigrationIncomingState
*mis
,
657 QEMUFile
*fb
, QIOChannelBuffer
*bioc
, Error
**errp
)
661 Error
*local_err
= NULL
;
665 vm_stop_force_state(RUN_STATE_COLO
);
667 trace_colo_vm_state_change("run", "stop");
669 /* FIXME: This is unnecessary for periodic checkpoint mode */
670 colo_send_message(mis
->to_src_file
, COLO_MESSAGE_CHECKPOINT_REPLY
,
673 error_propagate(errp
, local_err
);
677 colo_receive_check_message(mis
->from_src_file
,
678 COLO_MESSAGE_VMSTATE_SEND
, &local_err
);
680 error_propagate(errp
, local_err
);
685 cpu_synchronize_all_states();
686 ret
= qemu_loadvm_state_main(mis
->from_src_file
, mis
);
690 error_setg(errp
, "Load VM's live state (ram) error");
694 value
= colo_receive_message_value(mis
->from_src_file
,
695 COLO_MESSAGE_VMSTATE_SIZE
, &local_err
);
697 error_propagate(errp
, local_err
);
702 * Read VM device state data into channel buffer,
703 * It's better to re-use the memory allocated.
704 * Here we need to handle the channel buffer directly.
706 if (value
> bioc
->capacity
) {
707 bioc
->capacity
= value
;
708 bioc
->data
= g_realloc(bioc
->data
, bioc
->capacity
);
710 total_size
= qemu_get_buffer(mis
->from_src_file
, bioc
->data
, value
);
711 if (total_size
!= value
) {
712 error_setg(errp
, "Got %" PRIu64
" VMState data, less than expected"
713 " %" PRIu64
, total_size
, value
);
716 bioc
->usage
= total_size
;
717 qio_channel_io_seek(QIO_CHANNEL(bioc
), 0, 0, NULL
);
719 colo_send_message(mis
->to_src_file
, COLO_MESSAGE_VMSTATE_RECEIVED
,
722 error_propagate(errp
, local_err
);
727 vmstate_loading
= true;
728 colo_flush_ram_cache();
729 ret
= qemu_load_device_state(fb
);
731 error_setg(errp
, "COLO: load device state failed");
732 vmstate_loading
= false;
737 replication_get_error_all(&local_err
);
739 error_propagate(errp
, local_err
);
740 vmstate_loading
= false;
745 /* discard colo disk buffer */
746 replication_do_checkpoint_all(&local_err
);
748 error_propagate(errp
, local_err
);
749 vmstate_loading
= false;
753 /* Notify all filters of all NIC to do checkpoint */
754 colo_notify_filters_event(COLO_EVENT_CHECKPOINT
, &local_err
);
757 error_propagate(errp
, local_err
);
758 vmstate_loading
= false;
763 vmstate_loading
= false;
766 trace_colo_vm_state_change("stop", "run");
768 if (failover_get_state() == FAILOVER_STATUS_RELAUNCH
) {
772 colo_send_message(mis
->to_src_file
, COLO_MESSAGE_VMSTATE_LOADED
,
774 error_propagate(errp
, local_err
);
777 static void colo_wait_handle_message(MigrationIncomingState
*mis
,
778 QEMUFile
*fb
, QIOChannelBuffer
*bioc
, Error
**errp
)
781 Error
*local_err
= NULL
;
783 msg
= colo_receive_message(mis
->from_src_file
, &local_err
);
785 error_propagate(errp
, local_err
);
790 case COLO_MESSAGE_CHECKPOINT_REQUEST
:
791 colo_incoming_process_checkpoint(mis
, fb
, bioc
, errp
);
794 error_setg(errp
, "Got unknown COLO message: %d", msg
);
799 void colo_shutdown(void)
801 MigrationIncomingState
*mis
= NULL
;
802 MigrationState
*s
= NULL
;
804 switch (get_colo_mode()) {
805 case COLO_MODE_PRIMARY
:
806 s
= migrate_get_current();
807 qemu_event_set(&s
->colo_checkpoint_event
);
808 qemu_sem_post(&s
->colo_exit_sem
);
810 case COLO_MODE_SECONDARY
:
811 mis
= migration_incoming_get_current();
812 qemu_sem_post(&mis
->colo_incoming_sem
);
819 static void *colo_process_incoming_thread(void *opaque
)
821 MigrationIncomingState
*mis
= opaque
;
823 QIOChannelBuffer
*bioc
= NULL
; /* Cache incoming device state */
824 Error
*local_err
= NULL
;
826 rcu_register_thread();
827 qemu_sem_init(&mis
->colo_incoming_sem
, 0);
829 migrate_set_state(&mis
->state
, MIGRATION_STATUS_ACTIVE
,
830 MIGRATION_STATUS_COLO
);
832 if (get_colo_mode() != COLO_MODE_SECONDARY
) {
833 error_report("COLO mode must be COLO_MODE_SECONDARY");
837 /* Make sure all file formats throw away their mutable metadata */
839 bdrv_activate_all(&local_err
);
842 error_report_err(local_err
);
846 failover_init_state();
848 mis
->to_src_file
= qemu_file_get_return_path(mis
->from_src_file
);
849 if (!mis
->to_src_file
) {
850 error_report("COLO incoming thread: Open QEMUFile to_src_file failed");
854 * Note: the communication between Primary side and Secondary side
855 * should be sequential, we set the fd to unblocked in migration incoming
856 * coroutine, and here we are in the COLO incoming thread, so it is ok to
857 * set the fd back to blocked.
859 qemu_file_set_blocking(mis
->from_src_file
, true);
861 colo_incoming_start_dirty_log();
863 bioc
= qio_channel_buffer_new(COLO_BUFFER_BASE_SIZE
);
864 fb
= qemu_file_new_input(QIO_CHANNEL(bioc
));
865 object_unref(OBJECT(bioc
));
868 replication_start_all(REPLICATION_MODE_SECONDARY
, &local_err
);
875 trace_colo_vm_state_change("stop", "run");
877 colo_send_message(mis
->to_src_file
, COLO_MESSAGE_CHECKPOINT_READY
,
883 while (mis
->state
== MIGRATION_STATUS_COLO
) {
884 colo_wait_handle_message(mis
, fb
, bioc
, &local_err
);
886 error_report_err(local_err
);
890 if (failover_get_state() == FAILOVER_STATUS_RELAUNCH
) {
891 failover_set_state(FAILOVER_STATUS_RELAUNCH
,
892 FAILOVER_STATUS_NONE
);
893 failover_request_active(NULL
);
897 if (failover_get_state() != FAILOVER_STATUS_NONE
) {
898 error_report("failover request");
905 * There are only two reasons we can get here, some error happened
906 * or the user triggered failover.
908 switch (failover_get_state()) {
909 case FAILOVER_STATUS_COMPLETED
:
910 qapi_event_send_colo_exit(COLO_MODE_SECONDARY
,
911 COLO_EXIT_REASON_REQUEST
);
914 qapi_event_send_colo_exit(COLO_MODE_SECONDARY
,
915 COLO_EXIT_REASON_ERROR
);
922 /* Hope this not to be too long to loop here */
923 qemu_sem_wait(&mis
->colo_incoming_sem
);
924 qemu_sem_destroy(&mis
->colo_incoming_sem
);
926 rcu_unregister_thread();
930 void coroutine_fn
colo_incoming_co(void)
932 MigrationIncomingState
*mis
= migration_incoming_get_current();
935 assert(bql_locked());
936 assert(migration_incoming_colo_enabled());
938 qemu_thread_create(&th
, "mig/dst/colo", colo_process_incoming_thread
,
939 mis
, QEMU_THREAD_JOINABLE
);
941 mis
->colo_incoming_co
= qemu_coroutine_self();
942 qemu_coroutine_yield();
943 mis
->colo_incoming_co
= NULL
;
946 /* Wait checkpoint incoming thread exit before free resource */
947 qemu_thread_join(&th
);
950 /* We hold the global BQL, so it is safe here */
951 colo_release_ram_cache();