From patchwork Wed Apr 25 14:35:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: 858585 jemmy X-Patchwork-Id: 10363407 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 863056032C for ; Wed, 25 Apr 2018 14:53:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7323928178 for ; Wed, 25 Apr 2018 14:53:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6623C28B8A; Wed, 25 Apr 2018 14:53:56 +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 B349728178 for ; Wed, 25 Apr 2018 14:53:55 +0000 (UTC) Received: from localhost ([::1]:37415 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBLnu-0005BU-UH for patchwork-qemu-devel@patchwork.kernel.org; Wed, 25 Apr 2018 10:53:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32861) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fBLWd-0008E4-2j for qemu-devel@nongnu.org; Wed, 25 Apr 2018 10:36:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fBLWb-0007cB-Gs for qemu-devel@nongnu.org; Wed, 25 Apr 2018 10:36:03 -0400 Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:36202) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fBLWb-0007bf-Aw for qemu-devel@nongnu.org; Wed, 25 Apr 2018 10:36:01 -0400 Received: by mail-pf0-x242.google.com with SMTP id g14so15397522pfh.3 for ; Wed, 25 Apr 2018 07:36:01 -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=h0muVa4tgPrnd19U+fsYjX6XPExQlZ7KfFCyM3pqQ50=; b=pOuXHU9R7/eYJRpPUqsA+z6q4H4pKs9apaMH48nGsoWQEkDhrohf92OtJ7WqYP71QO qMIbeYqCf31wjGP/2EGnKhjXbK03RStRo2//aqm+Ffnzrv8nPoKeg4z2MVwJQEeAbUuu I7QD0omUOKrJipTBR1nsOI1XHDg+Cz8oeQGLz3vGu7ZQF/xM4jUBMSOmuTnptw7GJEKo lDM8JewPhjnn+1eW05SVzDDWxgGp/AL0K7+BOBz3Sc8jBHbhfRQeNVo8hvyMCCy8yqqy XcjbUpeTlT2nXloY+B/lSQ/urLvwBTab88Z2/nBoe8baoyOw7HtEzKi/0UL+rNEK3l3T 8fMA== 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=h0muVa4tgPrnd19U+fsYjX6XPExQlZ7KfFCyM3pqQ50=; b=shuB5zl6z5bsfwJ3Oa2DXDoS5oz+txhsn8aYjxQVMrBGx8SAhklol4t2DjB4Ffurqf AAf4Rjqh1a8jJgyczIvRbUJF2ajWAwF1Vqsb1+LhbyToAoG74oQ+N4ofTx81L4G1fVHF erAH5Vd7ok2WVFsrxRB3wHKAb5xH6UQn6FvdfVSHIIBl7OkRiLUDI8fPFouV/aw/a2nb I1kiQVF+i0xQ2RivbZFqGJ1EiVvld183tYD1S4kkkMXo6p6YHyKInAfob5UNAaRSVD6M MXcvnQhnMZCnkh6kUrdS+5FgWu6sV7BfK2S3IvP/5nqxiQURRSkfFOip+qNsqPodC1FM vvrw== X-Gm-Message-State: ALQs6tDB6+GzshQJFnvaqWF9oe2XGFWioUaf/211oYPZDHl8uadYA9eL zAVm7vLWliBD4nYvwh9WI1n8iQ== X-Google-Smtp-Source: AIpwx4+asZP4pTnbZZJzCwVAbGpTgws6AOTyLElh79mYpY/zdZ30GM8wfcLk3/t3pbKPcWVreUaAqw== X-Received: by 2002:a17:902:684c:: with SMTP id f12-v6mr29711859pln.139.1524666960497; Wed, 25 Apr 2018 07:36:00 -0700 (PDT) Received: from VM_127_91_centos.localdomain ([119.28.195.137]) by smtp.gmail.com with ESMTPSA id y29sm18244004pff.42.2018.04.25.07.35.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 07:36:00 -0700 (PDT) From: Lidong Chen X-Google-Original-From: Lidong Chen To: quintela@redhat.com, dgilbert@redhat.com Date: Wed, 25 Apr 2018 22:35:30 +0800 Message-Id: <1524666934-8064-2-git-send-email-lidongchen@tencent.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1524666934-8064-1-git-send-email-lidongchen@tencent.com> References: <1524666934-8064-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:c00::242 Subject: [Qemu-devel] [PATCH v2 1/5] 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: galsha@mellanox.com, adido@mellanox.com, aviadye@mellanox.com, qemu-devel@nongnu.org, licq@mellanox.com, Lidong Chen Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 bb63c77..add8c3a 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 da474fc..a22be43 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -2927,6 +2927,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) { @@ -3482,6 +3486,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); @@ -3504,6 +3512,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);