From patchwork Fri Aug 3 09:13:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: 858585 jemmy X-Patchwork-Id: 10554809 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 1459613BF for ; Fri, 3 Aug 2018 09:18:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 087EB2C1F3 for ; Fri, 3 Aug 2018 09:18:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED71A2C1FC; Fri, 3 Aug 2018 09:18:17 +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 65F5E2C1F3 for ; Fri, 3 Aug 2018 09:18:17 +0000 (UTC) Received: from localhost ([::1]:49758 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1flWDw-0004zl-6Q for patchwork-qemu-devel@patchwork.kernel.org; Fri, 03 Aug 2018 05:18:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1flW9q-0001O0-S1 for qemu-devel@nongnu.org; Fri, 03 Aug 2018 05:14:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1flW9p-0001BI-0m for qemu-devel@nongnu.org; Fri, 03 Aug 2018 05:14:02 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]:42315) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1flW9o-0001AO-PD for qemu-devel@nongnu.org; Fri, 03 Aug 2018 05:14:00 -0400 Received: by mail-pg1-x535.google.com with SMTP id y4-v6so2562664pgp.9 for ; Fri, 03 Aug 2018 02:14: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=Gw1eRPs9Eiy6kcsN8PtO8YyrNNK7Uhup63R4pYFlYZQ=; b=NFVI2MmYB9a1nOH2vDfTlQBddcvjVKAiEi541VW8NhJ4YbORaCQIDOa0jYpkRio129 1eV0qR9iaU3uinthoBBqAEEgDD7lFdAD5YzgQB9usIAGvx4IYc76OkdoWfl7pqDtpah5 3CjwjBYwdpgOoO2BEPLLPOUVKntXYARrcTwXjszJX5wxjOvNaf2YQbe1rP6LoBt2zAOT iuNtVIckqFCM032hAqgowo8yP0XrZ/mb8rZcpONV0X4LlFvmvqeMlP4SvAd3UI42Vchq mSAUs3G54/5U7cHFGQhV9Q0g1RtJCOhQ1ZK05d2cr9BdVTtUCXYczpnXwW7Ma0hJKcWI hDPQ== 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=Gw1eRPs9Eiy6kcsN8PtO8YyrNNK7Uhup63R4pYFlYZQ=; b=CFM/Eo8cJdAjqfFr03D2BWs5mBkn9VRpLnJ3ISSDxCHk34P1G6pH80HlHTCdcCN/Mn tF9dtwfSgtEecCC5s7NCtCNzsQ3iEf6K3rvJJYuMgDutQ+QMn/8sbnLA5L8Zvqoo3UTB cGPceUCTwnV7BteireZNjLA25jxEOei8jvilIGtWqcUiRb6xALOobu3fMfcmFJzjBABt A8i/I9XxnpBfKWyvJ0HIcfRibGTEiXROTQs45XNff+uIx6MGdXNnkDgT64yM26MjnF57 Qd+bKFj6whxqh42mwQv45WCUIL1OcD7wxzJYnzvHgPiDltfSdZmfh+3VnyuZC9kXS05D c/bA== X-Gm-Message-State: AOUpUlE2Enf3HA8s7BmVl5I4jf8NnC3lA6UCt1fdG4j1JTXBkYaCnxb0 ajpHjcRhPy1Ux3ZmjbW5ReM= X-Google-Smtp-Source: AAOMgpeemQCcYoa1HZsYwVR3E5Noa7oDZDqKC13StrBG4zfZP3zAiOZ8/E17ifRXhjGfYVQan5OGjQ== X-Received: by 2002:a65:6455:: with SMTP id s21-v6mr2814308pgv.394.1533287640022; Fri, 03 Aug 2018 02:14:00 -0700 (PDT) Received: from VM_120_46_centos.localdomain ([119.28.87.64]) by smtp.gmail.com with ESMTPSA id e21-v6sm7991352pfl.187.2018.08.03.02.13.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 02:13:59 -0700 (PDT) From: Lidong Chen X-Google-Original-From: Lidong Chen To: zhang.zhanghailiang@huawei.com, quintela@redhat.com, dgilbert@redhat.com Date: Fri, 3 Aug 2018 17:13:39 +0800 Message-Id: <1533287630-4221-2-git-send-email-lidongchen@tencent.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1533287630-4221-1-git-send-email-lidongchen@tencent.com> References: <1533287630-4221-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:4864:20::535 Subject: [Qemu-devel] [PATCH v6 01/12] migration: disable RDMA WRITE after postcopy started 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: Lidong Chen , 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 From: Lidong Chen RDMA WRITE operations are performed with no notification to the destination qemu, then the destination qemu can not wakeup. This patch disable RDMA WRITE after postcopy started. Signed-off-by: Lidong Chen Reviewed-by: Dr. David Alan Gilbert --- migration/qemu-file.c | 8 ++++++-- migration/rdma.c | 12 ++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/migration/qemu-file.c b/migration/qemu-file.c index 0463f4c..977b9ae 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -253,8 +253,12 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, if (f->hooks && f->hooks->save_page) { int ret = f->hooks->save_page(f, f->opaque, block_offset, offset, size, bytes_sent); - f->bytes_xfer += size; - if (ret != RAM_SAVE_CONTROL_DELAYED) { + if (ret != RAM_SAVE_CONTROL_NOT_SUPP) { + f->bytes_xfer += size; + } + + if (ret != RAM_SAVE_CONTROL_DELAYED && + ret != RAM_SAVE_CONTROL_NOT_SUPP) { if (bytes_sent && *bytes_sent > 0) { qemu_update_position(f, *bytes_sent); } else if (ret < 0) { diff --git a/migration/rdma.c b/migration/rdma.c index 8bd7159..76424a5 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -2921,6 +2921,10 @@ static size_t qemu_rdma_save_page(QEMUFile *f, void *opaque, CHECK_ERROR_STATE(); + if (migrate_get_current()->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) { + return RAM_SAVE_CONTROL_NOT_SUPP; + } + qemu_fflush(f); if (size > 0) { @@ -3480,6 +3484,10 @@ static int qemu_rdma_registration_start(QEMUFile *f, void *opaque, CHECK_ERROR_STATE(); + if (migrate_get_current()->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) { + return 0; + } + trace_qemu_rdma_registration_start(flags); qemu_put_be64(f, RAM_SAVE_FLAG_HOOK); qemu_fflush(f); @@ -3502,6 +3510,10 @@ static int qemu_rdma_registration_stop(QEMUFile *f, void *opaque, CHECK_ERROR_STATE(); + if (migrate_get_current()->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) { + return 0; + } + qemu_fflush(f); ret = qemu_rdma_drain_cq(f, rdma);