From patchwork Sun Jul 22 19:33:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 10539393 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 57F581805 for ; Sun, 22 Jul 2018 19:44:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46D3C2842E for ; Sun, 22 Jul 2018 19:44:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B33C28434; Sun, 22 Jul 2018 19:44:55 +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 E466B2842E for ; Sun, 22 Jul 2018 19:44:54 +0000 (UTC) Received: from localhost ([::1]:57264 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhKHm-0002cc-2e for patchwork-qemu-devel@patchwork.kernel.org; Sun, 22 Jul 2018 15:44:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fhK99-0003We-B3 for qemu-devel@nongnu.org; Sun, 22 Jul 2018 15:36:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fhK96-00016k-7j for qemu-devel@nongnu.org; Sun, 22 Jul 2018 15:35:59 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:33572) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fhK96-00016b-1t for qemu-devel@nongnu.org; Sun, 22 Jul 2018 15:35:56 -0400 Received: by mail-pf1-x442.google.com with SMTP id b17-v6so495856pfi.0 for ; Sun, 22 Jul 2018 12:35:55 -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=mU7awURrWAnfdKXiuwCryS0yrZb2zbth6Y2Fz4lEEgw=; b=i1+WA6vF5sIWUzFFcFQOtOEJpOc6yZMp162cxRitduNB86JCncLDoFWwLnut1ptvMO eLiw7MPwyQjtC9RkkCBYZufXc+VQLHr0CVborJzrOxpiNkNtQJZb+JaFI3/GqL3WyTbS EYJYqGDJLR2bccRM/I+dULh6bnHTkagmS0UqpLyjKW8umkoE8moqoYhvjabinmj3qHen K/W70ObjgQGu4JGatpXUS1ZFmVrYHc8fABu+dbkhxddi3eipCXpdpeuXk7qd/ClnUxvg 8B3ipD/u5qii8YbjJ2W5kH5WFy1Ai7Mq+K7H/8TMJJUi3dYodn4G3Km+Cs/Y/Nje4HRG sWfg== 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=mU7awURrWAnfdKXiuwCryS0yrZb2zbth6Y2Fz4lEEgw=; b=d4cwuKYgjfmAKLTy9ZqDeIhLC5Z79noVjze3ezJFwsTBUIps3qFa7AK6ToFdWBkEIq Vn155/KlJnG0Z1oOlsVHHJrcxKxJsnIWSqTK3iXKoWszeikpXzhtNq44kTkL/cR1OHaD 3ZuofcmL6t4Hf7dd7O6vNV7GaO5MV8p3nVHZxssKhHv6s51Hk4PrOH27YEgrO71bDnhN zNzrZ67g3Df0t9bnsIlViqVnZOiEh6TeO3dpG+rMYCY5/7eKvet2z9zcpHTRKy3Q7QCK nreH5Axha96Fb5jYBvV2T7IKGQtUKjbvDDDHzACjgDKAvOwb7sdDsvYTko/dJN/lmoo6 vong== X-Gm-Message-State: AOUpUlE64kfG1YBlctpJfr8n0r+oCv4cPVvh+2zRkF+MWrPa6RNk8btk 53jEL2g0hwGHduJkimID3hgROv/W X-Google-Smtp-Source: AAOMgpcAcMnZzEuNLUF0eh8qKLjF6MRELFofRArWdvcBBtW+ZWWQ7ySfoNL9qx5h8Vu3dGp+xJL30Q== X-Received: by 2002:a62:90d4:: with SMTP id q81-v6mr10484591pfk.37.1532288154885; Sun, 22 Jul 2018 12:35:54 -0700 (PDT) Received: from localhost.localdomain (155.150.229.35.bc.googleusercontent.com. [35.229.150.155]) by smtp.gmail.com with ESMTPSA id 87-v6sm14215353pfn.103.2018.07.22.12.35.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Jul 2018 12:35:53 -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: Mon, 23 Jul 2018 03:33:49 +0800 Message-Id: <20180722193350.6028-20-zhangckid@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180722193350.6028-1-zhangckid@gmail.com> References: <20180722193350.6028-1-zhangckid@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH V10 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 8221a18add..e951159071 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(), @@ -539,6 +544,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;