From patchwork Fri Jan 19 13:44:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 10175369 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 4754060386 for ; Fri, 19 Jan 2018 14:04:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 37CE3286A1 for ; Fri, 19 Jan 2018 14:04:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C591286A8; Fri, 19 Jan 2018 14:04:46 +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 18073286A1 for ; Fri, 19 Jan 2018 14:04:45 +0000 (UTC) Received: from localhost ([::1]:50956 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecXHf-0002oF-Uu for patchwork-qemu-devel@patchwork.kernel.org; Fri, 19 Jan 2018 09:04:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecX0g-0004Iv-9p for qemu-devel@nongnu.org; Fri, 19 Jan 2018 08:47:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecX0b-0003pF-Cy for qemu-devel@nongnu.org; Fri, 19 Jan 2018 08:47:10 -0500 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:43300) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ecX0b-0003or-6j for qemu-devel@nongnu.org; Fri, 19 Jan 2018 08:47:05 -0500 Received: by mail-pf0-x242.google.com with SMTP id y26so1385630pfi.10 for ; Fri, 19 Jan 2018 05:47:05 -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=OQpUPQH6HjD6uyq6bEO/VS3Vk+UZGo9srO/ZVLp/dcMeCTvejpJUmI4Z2K6YDTF8HE bFkylTSYE9JbnkueLUJH7ZCm9M6HRmvN0PgQ2FlC7d1sakBYSyInErkiP2+xE67QJXZg rukZgjI93+dBtZSonAAuUq29ZLKVz9tbLLeSkNDhk1tseg/OMa0n4XzvM8qi3hVrnG+l 9SAxvMn6QnNs1728KDYCzhudAWEeHM4bagM5TekTZ8d5bS/hBlbgtIT4p9QUb4/viHa7 Rj9+pM1rK5axLHBAoJ6tzQv9dl5pGefoWrdWBPjJf2Clgw4r9ZDZVULDTExXP9+Ze+hU hkag== 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=ByD/Cgy8qSunmv2cLEFl940807ot7eVQqMeioiWdjyrwjx0tGJ+9ILxeesAF2Hx7v9 oJFtBcsWUdueT0YKyEY0BrdpLXekmPbAgdyTg1H5ovFuiNFpQO/DJybG9s00ggcStE8f 08Q1zXL4sHZtx7v+f9/AfQR0v7qhBltcNBOMBa2fFqXTREU9penP1UNFvFvsCBtHklHa CmpzTcZfbwhhGd7NrKQN0XKA8aUrvjFpRVo5Y2+LRk2+sMAjvLsdOoOICIOOM8RjKYZb f/AFSCoj8vUoDxsNOt9LPNWpY5673eltHloPKZA5uVEst7T/eeNgOYqVNkkO/X01c/w3 wgRw== X-Gm-Message-State: AKGB3mILxclEdBYGsnLwXRTu0kk1lYlmLdjNh2DJVHu6ZVeAcoyTa7JU 7S4jLAbGoqJIJjwpGkfWX/KFCtk6 X-Google-Smtp-Source: ACJfBov75np6xH59HaLFa9F0EK3BLIko5ZomtYfjMepnWf1fx6b0pb78KKGKEeirjyA4XrMgxaY7Ug== X-Received: by 10.99.105.72 with SMTP id e69mr33680047pgc.239.1516369623987; Fri, 19 Jan 2018 05:47:03 -0800 (PST) Received: from localhost.localdomain (120.236.201.35.bc.googleusercontent.com. [35.201.236.120]) by smtp.gmail.com with ESMTPSA id r88sm14251865pfb.17.2018.01.19.05.47.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Jan 2018 05:47:03 -0800 (PST) From: Zhang Chen To: qemu-devel@nongnu.org Date: Fri, 19 Jan 2018 21:44:45 +0800 Message-Id: <1516369485-5374-17-git-send-email-zhangckid@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516369485-5374-1-git-send-email-zhangckid@gmail.com> References: <1516369485-5374-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::242 Subject: [Qemu-devel] [PATCH V4 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 , 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 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;