From patchwork Sun Mar 11 07:45:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 10274561 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 430CA602BD for ; Sun, 11 Mar 2018 08:01:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 38474289A1 for ; Sun, 11 Mar 2018 08:01:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B47D28ED6; Sun, 11 Mar 2018 08:01:49 +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 ABBAA289A1 for ; Sun, 11 Mar 2018 08:01:48 +0000 (UTC) Received: from localhost ([::1]:53432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1euvvP-00026W-Vf for patchwork-qemu-devel@patchwork.kernel.org; Sun, 11 Mar 2018 04:01:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1euvgu-0006tN-7o for qemu-devel@nongnu.org; Sun, 11 Mar 2018 03:46:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1euvgr-0001BX-19 for qemu-devel@nongnu.org; Sun, 11 Mar 2018 03:46:48 -0400 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:46063) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1euvgq-0001B1-Qv for qemu-devel@nongnu.org; Sun, 11 Mar 2018 03:46:44 -0400 Received: by mail-pg0-x244.google.com with SMTP id s13so2337868pgn.12 for ; Sat, 10 Mar 2018 23:46:44 -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=618m6dLFPqsd/G6u07N4YC+vNq5frrRpcsIx6mQsyjs=; b=bmz1d4Mah0xQ/MP70Tmy2X/bP1nDKusjYfWpJhsYjAnnCudyisq4JJpWGH9/ZAOnmg E7iZwAkUWARsW+GlBxr7B0RLR2dTfv0HXt0aN+x6aETo/iQOYCqekDFE/sLlA6EF5Q/+ 4WkpaoRtgC31zRrJ1ELWPffZfrsZPxxtNEIRyxvDvnzHNMA9B3GoMsIjXlCWp3ayGwLI r9jrjzMRKvBIOpL14aBT0zZCvM1k67WCd+8yW5WDSksG1UzDJNuyPdCrrwKCpsLZD2O9 gWopaSmCEFtU+pewoksSzI/3J4HkDRF4Gfyr6G2Ypf59XiS/3xzAUDJAY8VNbnMWWH+4 t/Hw== 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=618m6dLFPqsd/G6u07N4YC+vNq5frrRpcsIx6mQsyjs=; b=K7wKZUX+0JSlmNNVZ9E6QNZd1fHKEUDJpOGcBDN7to8MQAV6IyIoQP4u9BNBbzVJQS Q+AkAIU/QQf1k4zo5AELmVG3dhlVBWHNxmqi4am0XBEeei373aWtyvenRRe6uKTQj4iP zbZExdTwvr/BLLwY8JJkMNaPX9DPuMcVBtleA+mr3HRq4hE2Nt0OgpL6EtSly3rBAeZO n4L6Nfv7vcQZ6aP99F4bkXsrO31sajIk5aNnzr4G20CbRjtwHQXAFBOZyxT2Hz8BxQzV Qlmml/KMrvzJAPEZs7RHWpq/pY6+AQkLPj7C334bpLLAd986O5EL9Hp0K+isMAPrUnpn OvWw== X-Gm-Message-State: AElRT7EAHCL2pkDzg0t2BUduAGZVIHASrYkRsbE5fl4H9WMu7YCCa8BP fT0xSu7bk9s506s72h1QGjDO4MSY X-Google-Smtp-Source: AG47ELtV50vy5TDTBm9laW2RzrVAJhCYQ45+RBV+IvrbL//wE/Rr86Jh5lXqo368fI+C2kNYcWVing== X-Received: by 10.99.109.136 with SMTP id i130mr3452268pgc.380.1520754403570; Sat, 10 Mar 2018 23:46:43 -0800 (PST) Received: from localhost.localdomain (120.236.201.35.bc.googleusercontent.com. [35.201.236.120]) by smtp.gmail.com with ESMTPSA id t16sm10917037pfm.69.2018.03.10.23.46.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 10 Mar 2018 23:46:42 -0800 (PST) From: Zhang Chen To: qemu-devel@nongnu.org Date: Sun, 11 Mar 2018 15:45:14 +0800 Message-Id: <1520754314-5969-19-git-send-email-zhangckid@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520754314-5969-1-git-send-email-zhangckid@gmail.com> References: <1520754314-5969-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:c05::244 Subject: [Qemu-devel] [PATCH V6 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 1a59baa..1bc5f02 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(), @@ -549,6 +554,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;