aboutsummaryrefslogtreecommitdiff
path: root/migration/colo.c
diff options
context:
space:
mode:
authorRao, Lei <lei.rao@intel.com>2021-11-11 10:11:33 +0800
committerJuan Quintela <quintela@redhat.com>2021-12-15 10:31:42 +0100
commit795969ab1fe6d5a0f524be92e2e1ecd13f1873eb (patch)
treeb83ac36b95c6dd809d0a01e983ec7221c2bd4f05 /migration/colo.c
parent0e0f0479e28c6c1a1d024b2e5200cade479d6901 (diff)
Fixed a QEMU hang when guest poweroff in COLO mode
When the PVM guest poweroff, the COLO thread may wait a semaphore in colo_process_checkpoint().So, we should wake up the COLO thread before migration shutdown. Signed-off-by: Lei Rao <lei.rao@intel.com> Reviewed-by: Zhang Chen <chen.zhang@intel.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration/colo.c')
-rw-r--r--migration/colo.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/migration/colo.c b/migration/colo.c
index c8fadae956..2a85504966 100644
--- a/migration/colo.c
+++ b/migration/colo.c
@@ -819,6 +819,26 @@ static void colo_wait_handle_message(MigrationIncomingState *mis,
}
}
+void colo_shutdown(void)
+{
+ MigrationIncomingState *mis = NULL;
+ MigrationState *s = NULL;
+
+ switch (get_colo_mode()) {
+ case COLO_MODE_PRIMARY:
+ s = migrate_get_current();
+ qemu_event_set(&s->colo_checkpoint_event);
+ qemu_sem_post(&s->colo_exit_sem);
+ break;
+ case COLO_MODE_SECONDARY:
+ mis = migration_incoming_get_current();
+ qemu_sem_post(&mis->colo_incoming_sem);
+ break;
+ default:
+ break;
+ }
+}
+
void *colo_process_incoming_thread(void *opaque)
{
MigrationIncomingState *mis = opaque;