From patchwork Mon May 14 16:54:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 10398961 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 CE23460216 for ; Mon, 14 May 2018 17:07:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDBDE27D4A for ; Mon, 14 May 2018 17:07:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B22102834A; Mon, 14 May 2018 17:07:07 +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 580B827D4A for ; Mon, 14 May 2018 17:07:07 +0000 (UTC) Received: from localhost ([::1]:47323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIGwE-0002Ph-GS for patchwork-qemu-devel@patchwork.kernel.org; Mon, 14 May 2018 13:07:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33707) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIGlV-00008q-4k for qemu-devel@nongnu.org; Mon, 14 May 2018 12:56:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fIGlU-00068y-IR for qemu-devel@nongnu.org; Mon, 14 May 2018 12:56:01 -0400 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]:41043) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fIGlU-00068d-Cx for qemu-devel@nongnu.org; Mon, 14 May 2018 12:56:00 -0400 Received: by mail-pl0-x241.google.com with SMTP id az12-v6so7706119plb.8 for ; Mon, 14 May 2018 09:56:00 -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=j4C59cjBT4ZORdV4kWXXNsgacKu2nLRUSS7fPUbvGfE=; b=JX6g+rJ4lXzoQ69Q/xbLKerCp/lIARl5jMrUfx0q3FfmVy7MbqrfOBtuM4gTm9Xoa9 i+NiBSp6avnH3DdDLDK1VCL8JNMGvNAnovWzSKG8sHWpKhThEoiHgM8AtJfTAnBh7dTW 0J7gw2d3nXxU3TDDIxL7xyg4/hMVuYANalZB6ydOUASMR/8gUUEam1htVJzL0D03TIhl itgHqx5sJk37z60tlo/6KEgzMN8LXzWXF3QHcdHq6p6or3Odtun/hoP5eNPe042n9aiK yRigfCdl7Sg9WBfiHEWSL0+UIycje1mqd5WyvUmqliyg2PBOaHxfsXbq1hhhYv+glwLx 0ssg== 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=j4C59cjBT4ZORdV4kWXXNsgacKu2nLRUSS7fPUbvGfE=; b=XrrqZ3MN04aR2mVcSOhbeTA41vjaPzD9+sWLOvotgZwfe2ghbsXTQ3AQgTrEV/NEJ9 C9yzYWUdyIa1W7IdBEBv+xFOokaF9S83nyh9Vu7ChPodPIsrBB8RI0ibxa29/VgTqPJk 4zNZ9IrmQzjZSVb9NHR4VapqadRjVJ+BOk0ZOeU1EUk8oI4MP/M7th4YVZ3TE0m35Vnt tl7c826tM7/4TNFybHBc5TuBp73dSUlAIFCOaMH4s1mFWBjumPkOI58twVpek8BRcLIw dvZ3u3mtZGLzuyXy5ERlLrVI04x8jjFQOLIiYh2hb1r5xffsbXW8IDGqsZezywEtH+D2 IRlQ== X-Gm-Message-State: ALKqPwdrudDywDEjqBRtfgdzcndmHhPWu7czvpypaOiXi3zUHWmFcjce Geuka2IiaLQ19v9qrb9vfg2D5Q== X-Google-Smtp-Source: AB8JxZoqyaEh/RpirlFTKxirV+nj5Ft//dpL9e/N3izP6zkzBvJEPKWcyxuWsJ8Yzmp+GdZCB1MYHA== X-Received: by 2002:a17:902:a986:: with SMTP id bh6-v6mr10889045plb.245.1526316959124; Mon, 14 May 2018 09:55:59 -0700 (PDT) Received: from localhost.localdomain (109.227.199.104.bc.googleusercontent.com. [104.199.227.109]) by smtp.gmail.com with ESMTPSA id u69-v6sm631448pgb.42.2018.05.14.09.55.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 May 2018 09:55:58 -0700 (PDT) From: Zhang Chen To: qemu-devel@nongnu.org Date: Tue, 15 May 2018 00:54:24 +0800 Message-Id: <20180514165424.12884-18-zhangckid@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180514165424.12884-1-zhangckid@gmail.com> References: <20180514165424.12884-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::241 Subject: [Qemu-devel] [PATCH V7 RESEND 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 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 15463e2823..16def4865c 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;