From patchwork Mon May 14 03:23:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 10396895 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 E9947601E7 for ; Mon, 14 May 2018 06:53:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7AE028EC4 for ; Mon, 14 May 2018 06:53:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC3F428ED1; Mon, 14 May 2018 06:53:32 +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 5B9C628EC4 for ; Mon, 14 May 2018 06:53:32 +0000 (UTC) Received: from localhost ([::1]:44664 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fI7MR-0005zp-Op for patchwork-qemu-devel@patchwork.kernel.org; Mon, 14 May 2018 02:53:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fI6gN-0006dK-1O for qemu-devel@nongnu.org; Mon, 14 May 2018 02:10:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fI47B-00015W-PU for qemu-devel@nongnu.org; Sun, 13 May 2018 23:25:34 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:45470) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fI47B-00014F-Hm for qemu-devel@nongnu.org; Sun, 13 May 2018 23:25:33 -0400 Received: by mail-pf0-x244.google.com with SMTP id c10-v6so5305914pfi.12 for ; Sun, 13 May 2018 20:25:33 -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=gDOaczUBMb7s+whdZ/MTEfFb21DM/MqUI5E3f4sM7Ww=; b=hem/EieZW4ZIiu9BITbCdXmjXkbxzZb0ivTNXBF1bLEOFjjAIOgzboe+GgZH3bBKpB GWKeZO2R7Gyi3Xrh5Ub2UfKZDwDjAfBBoFyFwUDXUY5kZn+cKQS4OfFag7o0BwR7lODA NG/3aEjvOymk/MBAEiSgw8nFZ70urZ52y6Z8i+iOwcHXTJnrBgCzEHEqS9G1PKyz+5ee S6b/xGbW3cr0ox2Z95+TCFmnZNEmSbG5YLYwaZofeUrp5yb/twWdhHsXmkaF2zzGUsU5 HeEqCq8XEU8uJBAG8myD2mfCs8qX70zPIZcuQOq0MXvWGrvXz5FL9ho0IoehBLvEdf/j V2kw== 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=gDOaczUBMb7s+whdZ/MTEfFb21DM/MqUI5E3f4sM7Ww=; b=XJtFXAz1WPuok3IHnO8jZW5iz2qB9FWMZjUsZkrr5WNFYESyrXQQyQEptYwJHBwsaI TbJCREs9o2dWVCvAKJ3Z4LdygsvLOC3VgjnoT3vHl/N+Rf8/e1MCndZDEUNkwM+yMFTg R1Nj1Xy2S70dwIfoZGoDdmRaNxqmZZxQae92NbsZ9N9qknH8UPp2HzIU2QGa16X1xpcj KwAkAC7CrnUjZcBcsiN9g+0XC5vyOrvTLZAtO/Ka9MvMXgyGtdhtDKWrDpla/iNJabZ/ tnXsO4uE7UG09S+l6FY+dp7gv/tUAoPyhiTGXebvXZT5Rov9LKc47HX/Tm9AHv7oXSOv 5kDA== X-Gm-Message-State: ALKqPweH2NF6l2FlTmxVL1wnD8PD2SI4nuOTYcQs5QW8yvZk6VT6lopM quB9McGPS8LVXgEMZrzpHswvbA== X-Google-Smtp-Source: AB8JxZop2Ka5NFUCzW+dg9VKHb1R5eZ1ZIo3Qx7OQsRyRsxD2v/rJtSFGH3Ff0un1wsDzsdfEcQijQ== X-Received: by 2002:a62:d9d9:: with SMTP id b86-v6mr8604009pfl.41.1526268332374; Sun, 13 May 2018 20:25:32 -0700 (PDT) Received: from localhost.localdomain (109.227.199.104.bc.googleusercontent.com. [104.199.227.109]) by smtp.gmail.com with ESMTPSA id p6-v6sm17183532pfg.157.2018.05.13.20.25.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 13 May 2018 20:25:31 -0700 (PDT) From: Zhang Chen To: qemu-devel@nongnu.org Date: Mon, 14 May 2018 11:23:48 +0800 Message-Id: <1526268228-27951-18-git-send-email-zhangckid@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526268228-27951-1-git-send-email-zhangckid@gmail.com> References: <1526268228-27951-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:c00::244 Subject: [Qemu-devel] [PATCH V7 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 , Jason Wang , Markus Armbruster , "Dr . David Alan Gilbert" , 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 d67bdc2..a7e0eaa 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(), @@ -552,6 +557,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;