Received: from eggs.gnu.org ([2001:4830:134:3::10]:46990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecX0g-0004Iv-9p for qemu-devel@nongnu.org; Fri, 19 Jan 2018 08:47:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecX0b-0003pF-Cy for qemu-devel@nongnu.org; Fri, 19 Jan 2018 08:47:10 -0500 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:43300) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecX0b-0003or-6j for qemu-devel@nongnu.org; Fri, 19 Jan 2018 08:47:05 -0500 Received: by mail-pf0-x242.google.com with SMTP id y26so1385630pfi.10 for ; Fri, 19 Jan 2018 05:47:05 -0800 (PST) From: Zhang Chen Date: Fri, 19 Jan 2018 21:44:45 +0800 Message-Id: <1516369485-5374-17-git-send-email-zhangckid@gmail.com> In-Reply-To: <1516369485-5374-1-git-send-email-zhangckid@gmail.com> References: <1516369485-5374-1-git-send-email-zhangckid@gmail.com> Subject: [Qemu-devel] [PATCH V4 16/16] COLO: quick failover process by kick COLO thread List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , zhanghailiang , Juan Quintela , "Dr . David Alan Gilbert" , Jason Wang , Eric Blake , Markus Armbruster , Zhang Chen From: zhanghailiang COLO thread may sleep at qemu_sem_wait(&s->colo_checkpoint_sem), while failover works begin, It's better to wakeup it to quick the process. Signed-off-by: zhanghailiang --- migration/colo.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/migration/colo.c b/migration/colo.c index 10bc80c..cc616d9 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -134,6 +134,11 @@ static void primary_vm_do_failover(void) migrate_set_state(&s->state, MIGRATION_STATUS_COLO, MIGRATION_STATUS_COMPLETED); + /* + * kick COLO thread which might wait at + * qemu_sem_wait(&s->colo_checkpoint_sem). + */ + colo_checkpoint_notify(migrate_get_current()); /* * Wake up COLO thread which may blocked in recv() or send(), @@ -519,6 +524,9 @@ static void colo_process_checkpoint(MigrationState *s) qemu_sem_wait(&s->colo_checkpoint_sem); + if (s->state != MIGRATION_STATUS_COLO) { + goto out; + } ret = colo_do_checkpoint_transaction(s, bioc, fb); if (ret < 0) { goto out; -- 2.7.4