From patchwork Sun Jun 3 05:05:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 10445133 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 4522F60234 for ; Sun, 3 Jun 2018 05:14:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35D40284C8 for ; Sun, 3 Jun 2018 05:14:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29543289D4; Sun, 3 Jun 2018 05:14:54 +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=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, 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 C27AE284C8 for ; Sun, 3 Jun 2018 05:14:53 +0000 (UTC) Received: from localhost ([::1]:33668 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPLLx-0005nu-0W for patchwork-qemu-devel@patchwork.kernel.org; Sun, 03 Jun 2018 01:14:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPLEm-0000kp-2B for qemu-devel@nongnu.org; Sun, 03 Jun 2018 01:07:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPLEl-0001F6-6n for qemu-devel@nongnu.org; Sun, 03 Jun 2018 01:07:28 -0400 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]:38413) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fPLEl-0001Ea-0y for qemu-devel@nongnu.org; Sun, 03 Jun 2018 01:07:27 -0400 Received: by mail-pl0-x244.google.com with SMTP id b14-v6so511546pls.5 for ; Sat, 02 Jun 2018 22:07:26 -0700 (PDT) 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=LLhwPayMmp0eMKNTbN/o7NgGKlb/J1/zJjpk0khgm0s=; b=GhOqhOuHsSKMQw2DfdcMyVSMwrPnbeMxWX44LzKoc6+K99IJgFB6KZFal6VGO/o/60 +hs+9uwHcpnILurK8iQ0k5C43hGrC60zy1CKJyOT3l46PwXrfBV4o/X7YKdlitmp5jL2 7hWdZABGJL7hjfO6HeVkzEBZn0e/dNp8ZvMjHjjhPafTwZUW+e6O6qydkghVOcfKCjMu ND4UvXWymrUw3Qe/SuSDz6m6GbMzvvuFpjBoLxxeXki1PUOM1KCWrcbiX+eAhToE5lwe OAtaAotw1trT8oEZzBfog9mEV1f0P0TO1OVybC6QzHFuAM7ug8jVXMPOfEFLBw7Gg9BJ F5KA== 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=LLhwPayMmp0eMKNTbN/o7NgGKlb/J1/zJjpk0khgm0s=; b=SeX4+L2MTnnh9SYAJefwwQl0mv4vRSR/sQ+7hZS6WTytRCU1g6Cth8WZu9QHsEXfoD NArhAW9qPNgTXc9Fpy/4RTsKM0+6V5p6+8U5e2ns8dKOLoP572PVYu/9P+PhYulm6xH4 zwe8wa99xknv4rE2dsjrLM+TgqWm64jX8LuwoaiY+DfEykWS++p0aIL37GxBA3+25ra9 EBS8jLq37u/JVbeTvp5GTmNk+jDJSXjXTBohYXSWjutnWu6kaZ4/0mdgL+oo6YhbY8g3 ITpna+oBQOEz8KgQ/9flGvbZMvIOU/cJE9yicthUwIUFyhke20aUFMfduK6n0QXt79gE NS6Q== X-Gm-Message-State: ALKqPwd4JXMhwbz+03Z3gMfGsnHlM/wuG0dstFG7nl3Q/u8gt3JlTD8L jHTkUlA+x6twHRjVorS9B4yWtA== X-Google-Smtp-Source: ADUXVKJ/fsXPFT0RxKSP0xUS7j6/DnUJKE4Qt1AcgU8tbhyAjQPZZpt9WhmlqYJslJ2Y+zwn8vLioA== X-Received: by 2002:a17:902:b110:: with SMTP id q16-v6mr16900803plr.286.1528002445835; Sat, 02 Jun 2018 22:07:25 -0700 (PDT) Received: from localhost.localdomain (197.225.229.35.bc.googleusercontent.com. [35.229.225.197]) by smtp.gmail.com with ESMTPSA id 10-v6sm45841595pgb.40.2018.06.02.22.07.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Jun 2018 22:07:24 -0700 (PDT) From: Zhang Chen To: qemu-devel@nongnu.org, Paolo Bonzini , Juan Quintela , "Dr . David Alan Gilbert" , Jason Wang , Eric Blake , Markus Armbruster Date: Sun, 3 Jun 2018 13:05:46 +0800 Message-Id: <20180603050546.6827-18-zhangckid@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180603050546.6827-1-zhangckid@gmail.com> References: <20180603050546.6827-1-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 V8 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 , Zhang Chen 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 Reviewed-by: Dr. David Alan Gilbert --- migration/colo.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/migration/colo.c b/migration/colo.c index e3824d139a..1d01f5ba08 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -135,6 +135,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(), @@ -561,6 +566,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;