From patchwork Sat May 5 14:35:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: 858585 jemmy X-Patchwork-Id: 10382185 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 CC4216053F for ; Sat, 5 May 2018 14:42:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC83B28F24 for ; Sat, 5 May 2018 14:42:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B04AE29066; Sat, 5 May 2018 14:42:26 +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 5301D28F24 for ; Sat, 5 May 2018 14:42:26 +0000 (UTC) Received: from localhost ([::1]:39061 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEyOH-0004Rq-AD for patchwork-qemu-devel@patchwork.kernel.org; Sat, 05 May 2018 10:42:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEyIJ-0008T9-JG for qemu-devel@nongnu.org; Sat, 05 May 2018 10:36:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEyII-0008GM-Q0 for qemu-devel@nongnu.org; Sat, 05 May 2018 10:36:15 -0400 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:44958) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fEyII-0008G5-Jd for qemu-devel@nongnu.org; Sat, 05 May 2018 10:36:14 -0400 Received: by mail-pg0-x244.google.com with SMTP id 82-v6so17312447pge.11 for ; Sat, 05 May 2018 07:36:14 -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=PyWc5EFvCalprNQtF0ueBfM34TbNe8VfPGXTG01pGZ0=; b=OMiON8aB9ufQ3IQipquhy3Qg4qQ7n0tWu7Eq1zAyXiP4nwKDiqDCupz/tYrWwTSjbB n/aEADWKiEHUFTyg2sQH7tBfUCobuRGkeTiQ7BBzRDqNHMkkjMTVv4OLIihKPVPiFgrk g/IeFdkkl1UuXJSASxwkqFUr1fDmA46DTtgMFW8AUuahpdEVvl7/9QQm0jnRbuv00KDL LdoxPVaQqGcJ8SRqmiB+iWRAmP0+F/KqSnfzEohX+782O2rjBlzj+7S8xdSAyvlVPhAJ hPKfzHIT3CMsGD4sdDTBG1kBYuAVTHujTv35y25FI2fLKdKVib+iRqiht+17yUagATal 6zkQ== 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=PyWc5EFvCalprNQtF0ueBfM34TbNe8VfPGXTG01pGZ0=; b=Qq7LaaTociqTlqcM6ki8CjVYLWFoQhG6lKsaAMYt0a+dyfDbDjIU0q0xSNXV8u0tW8 oRWAC+KwjWK2vK023sHVBaK4v3DZz9XLndfwqX9gTPgd25VNFjDtTdTWwTfmmiygz+mL lV3U45+iAIlWUPqXoFK07XIlADKvUptHH4ZyMyeGVYa0syFf01dAN6qEvtUP/O6xHiBy TQMcNRlgo1/jJBLuGTTopqvM4I17mH55xpLDhURSyeNtJkJIQZeHB/mgq5BzXijTuMVj UtfwqHxG5CJ6q+9pOi64lgXizIt6zzIlvH6tSk6XI3KsGdOYIqNz7p49LCeaSTwskbQF v3ww== X-Gm-Message-State: ALQs6tBupJA8s+bi1Q8Nuq4sp1XGMS5ulIogFn/GnLA4ZECApsQ8JJWj 8i97BwGgG+srF8/N6GI+3jQZIQ== X-Google-Smtp-Source: AB8JxZrouq7Mgrhts3K2gbYK+QoBoU2SJgZvKiapo6NQTZ32c64m1Fgk+VNnMfzEmNoQmRo0NN79kw== X-Received: by 2002:a17:902:bb06:: with SMTP id l6-v6mr32016806pls.255.1525530973786; Sat, 05 May 2018 07:36:13 -0700 (PDT) Received: from VM_127_91_centos.localdomain ([119.28.195.137]) by smtp.gmail.com with ESMTPSA id n67sm38529640pfh.188.2018.05.05.07.36.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 May 2018 07:36:13 -0700 (PDT) From: Lidong Chen X-Google-Original-From: Lidong Chen To: quintela@redhat.com, dgilbert@redhat.com, berrange@redhat.com Date: Sat, 5 May 2018 22:35:36 +0800 Message-Id: <1525530936-21835-7-git-send-email-lidongchen@tencent.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525530936-21835-1-git-send-email-lidongchen@tencent.com> References: <1525530936-21835-1-git-send-email-lidongchen@tencent.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::244 Subject: [Qemu-devel] [PATCH v3 6/6] migration: Stop rdma yielding during incoming postcopy 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: adido@mellanox.com, galsha@mellanox.com, aviadye@mellanox.com, qemu-devel@nongnu.org, Lidong Chen Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP During incoming postcopy, the destination qemu will invoke qemu_rdma_wait_comp_channel in a seprate thread. So does not use rdma yield, and poll the completion channel fd instead. Signed-off-by: Lidong Chen Reviewed-by: Dr. David Alan Gilbert --- migration/rdma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/migration/rdma.c b/migration/rdma.c index 854f355..ed9cfb1 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -1490,11 +1490,13 @@ static int qemu_rdma_wait_comp_channel(RDMAContext *rdma) * Coroutine doesn't start until migration_fd_process_incoming() * so don't yield unless we know we're running inside of a coroutine. */ - if (rdma->migration_started_on_destination) { + if (rdma->migration_started_on_destination && + migration_incoming_get_current()->state == MIGRATION_STATUS_ACTIVE) { yield_until_fd_readable(rdma->comp_channel->fd); } else { /* This is the source side, we're in a separate thread * or destination prior to migration_fd_process_incoming() + * after postcopy, the destination also in a seprate thread. * we can't yield; so we have to poll the fd. * But we need to be able to handle 'cancel' or an error * without hanging forever.