From patchwork Mon Sep 3 04:38:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 10585435 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 B910F920 for ; Mon, 3 Sep 2018 04:54:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A58E829515 for ; Mon, 3 Sep 2018 04:54:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9861D29532; Mon, 3 Sep 2018 04:54:18 +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 50AF929515 for ; Mon, 3 Sep 2018 04:54:18 +0000 (UTC) Received: from localhost ([::1]:43432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwgsT-0004vb-Ja for patchwork-qemu-devel@patchwork.kernel.org; Mon, 03 Sep 2018 00:54:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwghC-0002kp-7F for qemu-devel@nongnu.org; Mon, 03 Sep 2018 00:42:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fwghA-0006Dl-BE for qemu-devel@nongnu.org; Mon, 03 Sep 2018 00:42:37 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:37546) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fwgh8-0006DB-WE for qemu-devel@nongnu.org; Mon, 03 Sep 2018 00:42:35 -0400 Received: by mail-pl1-x644.google.com with SMTP id f1-v6so1289490plt.4 for ; Sun, 02 Sep 2018 21:42:34 -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=ydWWVJm8+lt2One58Iz1g6Mmsyo7LHeIHX9sAAhSyw4=; b=fSUDmyFH/Z9gplw3RPsMVlIhNowdZpN72S83GtNR98bcjG368P9FlVnLr5WCbbIVj0 OFOZ0qW5R8lF6TYSRR+1XAX+VdDA9I7zBeAWaGoHsAOe/uLe7wW81xL0c5nWj3fvUYzD UvG/yqchy/i5OwDIMS1MOTj7+2fPd7GsSmooGyFPMq1Aj4v8oB7WTJgaLaxTkoVronJC AlstbwrFfhn6+MfS7a7u/aDEzgda/jFU4LToE0rwwUyN9yNIaVfxycNTDmELKwlrG2LK avWHhDGHI4V1CxygRb4QhVnGsgQWdsyb5k3srexTy5IMiEqiPm3/ajPyg7nBeN7ddIhj xpcg== 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=ydWWVJm8+lt2One58Iz1g6Mmsyo7LHeIHX9sAAhSyw4=; b=O+HA3TOHrDfq7ZOkecYyQjmNtC8bsapfFy1GmLSQPKwf0aZtHP4b3Rg2JmvLj0DwYG 1EzPaYbxoPmlWmcGIoGkcoicyu0rl91cme/uRkLHwqNqUTeDgMi0PTsMSzKhaLygnv6a W/yGwQlAp/FySVTLt6jELu4QIa/UoFH+qBMs9tfT336sqjqvxhl7F7arYd1Q7w20ywy1 jvaivkSEuG8NiywB86GvryhA6dbq3tKTPgFaoTnaC+yo4E+ME1ogRDXMgmwyVBfkdJkL TS80+OdCYKXa58P1Bn1oOb5pfoTn9Vppx0j2x+swAVe/0s0f1GyFp+tSdUDE18mWtX6I SjxA== X-Gm-Message-State: APzg51CDaoJiAx9p6Wv7c34+OpNFJ0yM7T0wgk4yZVRliiskfTovVdeM Cs5XTg8irhzKaJnqf585mLAQRdx5 X-Google-Smtp-Source: ANB0VdZZ5WJp7psgJNuxELJoLsGTlfffywwZN/ysOnwMj585yjM35oLGA6Sx0AV8LrKa8fJwyTa8pQ== X-Received: by 2002:a17:902:6946:: with SMTP id k6-v6mr26638524plt.268.1535949753340; Sun, 02 Sep 2018 21:42:33 -0700 (PDT) Received: from localhost.localdomain (155.150.229.35.bc.googleusercontent.com. [35.229.150.155]) by smtp.gmail.com with ESMTPSA id g6-v6sm32738308pfb.11.2018.09.02.21.42.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Sep 2018 21:42:32 -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, 3 Sep 2018 12:38:59 +0800 Message-Id: <20180903043900.28592-19-zhangckid@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180903043900.28592-1-zhangckid@gmail.com> References: <20180903043900.28592-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::644 Subject: [Qemu-devel] [PATCH V12 18/19] 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 365e913e51..3a3efb916b 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;