From patchwork Wed Jun 27 20:41:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 10492657 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 B1C4A60386 for ; Wed, 27 Jun 2018 20:57:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B27A82A049 for ; Wed, 27 Jun 2018 20:57:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A34B32A068; Wed, 27 Jun 2018 20:57:24 +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 2787E2A049 for ; Wed, 27 Jun 2018 20:57:24 +0000 (UTC) Received: from localhost ([::1]:33181 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYHVD-0006yC-By for patchwork-qemu-devel@patchwork.kernel.org; Wed, 27 Jun 2018 16:57:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYHHk-0004nB-QE for qemu-devel@nongnu.org; Wed, 27 Jun 2018 16:43:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYHHk-0007FW-0v for qemu-devel@nongnu.org; Wed, 27 Jun 2018 16:43:28 -0400 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:39602) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fYHHj-0007EM-RL for qemu-devel@nongnu.org; Wed, 27 Jun 2018 16:43:27 -0400 Received: by mail-pl0-x243.google.com with SMTP id s24-v6so1591157plq.6 for ; Wed, 27 Jun 2018 13:43:27 -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=ragI1+v4Vn2KDxHmu3KSKIVydBgNG/mgE2wgjdn2G64=; b=myi9J2n2znbQxhQAsWw2SlCC2LxJAi2L78JEFsrSm3AQjUIlzknEi6yH8j7DnBaSTE cCVqQXBc93gBdtdqAVkHZrFv6cENmDE5OPMF2DsRBLyBaqO0XHYSwITa7vK7dYMZQ2BN v/f0bio73oP3wrnV0pUOHIFH2pZ0A+G0P9IykeHjLiOw4D1f5I2dK4EtRPY0P6pmaAEf 4khAOEP34+7RFQ4c+Q9uIj5LFidHv1a6HSvX45HOW/FlHoBh7bYGZAYWnwnDw2vlSMqi VM9B/tC0xyC9MYstlYI4pDVWppA6zKNfEfXwiOfFL0GQhxncL7dknLYvRMlNygA+o8Da mx6Q== 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=ragI1+v4Vn2KDxHmu3KSKIVydBgNG/mgE2wgjdn2G64=; b=nWD2T66nGbxKJdpd+Q9t6OzAjbGiBWXVjZkMGC8Qh0zd2J0pDHIZ/X+i7EF14zBDQW XRE7nRXKA6Q2MZzGqHuV4+48MgzENlpa8oXci3kXk7MsW6th53K1P3UkgFuY8KFFbZm6 9RLBfmXoAm1f2VfTzOvu3G3Sq59QhXcIQCE5d7ywXn6Bzsf3k6W4eH2+3pR7AyNVqVg5 lGJzhFes7gs8bk4YDWyrlb+csik3syntaO2OIlUkFQIrH2gF1xe5w5z6qFak+aiX+J/i th5CmaNjTdBHc5kM+KOlyL9HH94H+l3y7/rawCmwaBZ2A1ulAyFNYpXEGAUzbJRBlk6a 1QMA== X-Gm-Message-State: APt69E0hkqmRS+8SAvUl/WLVdIMVCrWU/wLCUSCzcg7NsTmR+yTRnYMM ge5zMySM5bSSc6PO3C1ATpVU2A== X-Google-Smtp-Source: AAOMgpdzbbhtW/goItwUcUSolG2y+1U1RfHniDXQJNicFgTnAM+UwhFJJnsbKi+KDQNZVw6j42hZow== X-Received: by 2002:a17:902:6047:: with SMTP id a7-v6mr95134plt.188.1530132206702; Wed, 27 Jun 2018 13:43:26 -0700 (PDT) Received: from localhost.localdomain (155.150.229.35.bc.googleusercontent.com. [35.229.150.155]) by smtp.gmail.com with ESMTPSA id c67-v6sm9690428pfj.173.2018.06.27.13.43.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Jun 2018 13:43:25 -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: Thu, 28 Jun 2018 04:41:35 +0800 Message-Id: <20180627204136.4177-20-zhangckid@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180627204136.4177-1-zhangckid@gmail.com> References: <20180627204136.4177-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::243 Subject: [Qemu-devel] [PATCH V9 19/20] 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 4d0ee7d8aa..553b28adbb 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -131,6 +131,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(), @@ -557,6 +562,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;