From patchwork Thu Jan 4 06:01:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 10143919 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 67BEA6034B for ; Thu, 4 Jan 2018 06:15:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C04C28419 for ; Thu, 4 Jan 2018 06:15:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50F172841D; Thu, 4 Jan 2018 06:15:16 +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 F221528419 for ; Thu, 4 Jan 2018 06:15:15 +0000 (UTC) Received: from localhost ([::1]:47524 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWyo7-0006Xj-9c for patchwork-qemu-devel@patchwork.kernel.org; Thu, 04 Jan 2018 01:15:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37242) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eWybs-00048R-OF for qemu-devel@nongnu.org; Thu, 04 Jan 2018 01:02:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eWybr-0004YQ-Sq for qemu-devel@nongnu.org; Thu, 04 Jan 2018 01:02:36 -0500 Received: from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241]:35592) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eWybr-0004Xy-N4 for qemu-devel@nongnu.org; Thu, 04 Jan 2018 01:02:35 -0500 Received: by mail-pf0-x241.google.com with SMTP id j124so375294pfc.2 for ; Wed, 03 Jan 2018 22:02:35 -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=ykiojIxsoXQaDwibIw/YhxXHvoNepz2NylvpnOYiDqc=; b=EA9nf+mh5mc63oTMMNK7PCIMYRPUr2gcRGuyrBFE+UxWI1cDC9lriSNTByjhYDYxjB q7qKqDVacRyl1ij6gm33K66IzEf16XJMSzwBl9qEuuRWa07EceJOWfNUANrgV+jfYgGW XDxdebsMIF1kUhXJQpl3mGd56mW8HgOtK11RcsW/WROgHlSFhezr5vn98aeiG13vEFV/ P+Wnuo90bw/4I8fLllin4IQBEhHTheG7G2hkbip8da3tr/AnSyIrfO1aG8v6AA/MAPnS GrPa780TrTp6x4jd/EdMAXEPzKMKdRB/jdnwa5F66F1cNBWe3kDiziR2GtjQMkxZYaYL 1/0w== 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=ykiojIxsoXQaDwibIw/YhxXHvoNepz2NylvpnOYiDqc=; b=Ald0D7i+T9EmjGjDXyYT+QHjcgdPaVEcjh7zjLYTbXUT2/sAES3PqWnUq4B3l7Bo73 n54WqFEn0wQnkHkOwTu0pgTXdwAO2PQWahcgWa4nW46NqUoF9pGcJ+t6Ac7i4bac2VUq JAgqacM1qtbC5gaFnoDP17YgMMCVLLFjJ9ygZrKjeXqmNKkJigpsSxPnMZwyiNLuHgzm duQ/8iG6h3vwpwcUpEGUS88IQxOlKVx8boQu+qtxqU+toOB9AR0NZs8IE2OvBDB4oWT6 qY9q5ERe7OcBZigM15OkIkdLEg9qzZZIFr6eZUWGEkkxsRcRM4nRC1uCL9dsU1BNOjTx H5jw== X-Gm-Message-State: AKGB3mL/dvgUAYwbpfy5p0f8EjjKMCNwigB0gXnnxv6M4yZm+P5LCl5Y WzlR/yxw3iUPbTn3qor8FhuYpYx0 X-Google-Smtp-Source: ACJfBou83fnkDvTiFlI7IHIb0CVTfdTDc6A6EYkkqsaQZ+h/016vZTYPPP3GFVQMyKMHLqH4kc5+gQ== X-Received: by 10.99.141.75 with SMTP id z72mr3125525pgd.290.1515045754436; Wed, 03 Jan 2018 22:02:34 -0800 (PST) Received: from localhost.localdomain (120.236.201.35.bc.googleusercontent.com. [35.201.236.120]) by smtp.gmail.com with ESMTPSA id w5sm6214775pfi.74.2018.01.03.22.02.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 03 Jan 2018 22:02:33 -0800 (PST) From: Zhang Chen To: qemu devel Date: Thu, 4 Jan 2018 14:01:15 +0800 Message-Id: <1515045675-6993-17-git-send-email-zhangckid@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515045675-6993-1-git-send-email-zhangckid@gmail.com> References: <1515045675-6993-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::241 Subject: [Qemu-devel] [PATCH RESEND V3 16/16] 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 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 10bc80c..cc616d9 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(), @@ -519,6 +524,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;