From patchwork Sat Mar 10 21:22:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 10274385 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 67A9B605D2 for ; Sat, 10 Mar 2018 21:36:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 578AE285BE for ; Sat, 10 Mar 2018 21:36:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41D3E28E40; Sat, 10 Mar 2018 21:36:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A6427285BE for ; Sat, 10 Mar 2018 21:36:57 +0000 (UTC) Received: from localhost ([::1]:52042 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eumAi-00064l-C0 for patchwork-qemu-devel@patchwork.kernel.org; Sat, 10 Mar 2018 16:36:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eulxq-0003FT-0K for qemu-devel@nongnu.org; Sat, 10 Mar 2018 16:23:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eulxm-0003U2-Sf for qemu-devel@nongnu.org; Sat, 10 Mar 2018 16:23:37 -0500 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]:46891) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eulxm-0003Tw-Mt for qemu-devel@nongnu.org; Sat, 10 Mar 2018 16:23:34 -0500 Received: by mail-pl0-x244.google.com with SMTP id y8-v6so7140987pll.13 for ; Sat, 10 Mar 2018 13:23:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pYSpfSOCMnJHb7OrZlaDcPmcRr6aYPMvPFICQCYTPDU=; b=VlUPaSKiwxTysk89OO/FkzPwbjOzV03WfV4aUHUN0mcwfZWNCvDya3WRWEb8LyXsN/ VAfcB/dP4RvyOFsL7p6CrL+RsVrnSUcbd0pxDqYw77Etx2nQjVb+Jbm5zfw5ednj8Ai6 q+vwKXxu4u9F90Xu13dU9RWv79ODIHq5M/5kJdA/2/VQD38HyXrcEfbaLBbKFf5x1nen jIiqNKEZpWS2QXZ7lyESbmqicOTy6nMSv0c0Gj4XQIJgYnECg4C9L2oaVWZW3Snomdq1 hbKO8Bfzfh31eFE8W/0p4ZVeD9fu3Ci0oP5e2gol2X0GBYn8pdhQcBvGu49sU0vbzoIs bm4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pYSpfSOCMnJHb7OrZlaDcPmcRr6aYPMvPFICQCYTPDU=; b=dV1Gk4w0s5UGxs/K6uxqWmwHaKPyDdriftEcqBFEUdu/+eaURFfzQZehzxsGxoQYpO Csqnbv7HeuV2bURvNEk8NIW6Rm2M3BNFB0Jb4HJW9Epc0xobBG3uUQi72owUuzvn/692 wlaySGVEegYZ3FUeJy2GT5OwLjh3RTQEvw9WipO4br2d61X4qzgEja7N2PQzTwrhiK7L o2ABSYLh7C244FG7iKCt/5wxfroLCiHevEZZz63HBNJn6hA9F2/0pIDRfK9L++oBOr2q d1zhV8+oz9RTDXP081iXyBp/C6jClg8/9DIn1TOQyUyf6SXQcxijW/v1T1zSOXAlQlW/ IrzQ== X-Gm-Message-State: AElRT7EWYkYShv2f9DX3gb7HWYAlZ2uB0snUrLGKSZTHDSkNq8SirNT7 urcVODKfuPm3g2EanpQPstmwNHE2 X-Google-Smtp-Source: AG47ELvAeUobPbPknejEV53lNQRoD9VtEnKFsbxU405P6Pp8gY5fkhKfY2gFtknv+w5UP9QwCPBdnA== X-Received: by 2002:a17:902:1c5:: with SMTP id b63-v6mr3030689plb.311.1520717013591; Sat, 10 Mar 2018 13:23:33 -0800 (PST) Received: from localhost.localdomain (120.236.201.35.bc.googleusercontent.com. [35.201.236.120]) by smtp.gmail.com with ESMTPSA id q65sm10532191pfd.140.2018.03.10.13.23.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 10 Mar 2018 13:23:32 -0800 (PST) From: Zhang Chen To: qemu-devel@nongnu.org Date: Sun, 11 Mar 2018 05:22:07 +0800 Message-Id: <1520716927-17068-18-git-send-email-zhangckid@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520716927-17068-1-git-send-email-zhangckid@gmail.com> References: <1520716927-17068-1-git-send-email-zhangckid@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::244 Subject: [Qemu-devel] [PATCH V5 17/17] COLO: quick failover process by kick COLO thread X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: zhanghailiang , Li Zhijian , Juan Quintela , Jason Wang , "Dr . David Alan Gilbert" , Markus Armbruster , Zhang Chen , Paolo Bonzini Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 5fb4d8c..de0442e 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(), @@ -553,6 +558,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;