From nobody Sun Feb 23 10:52:54 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail header.i=@fujitsu.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1740119803; cv=none; d=zohomail.com; s=zohoarc; b=BP3YKDgSIAmlqTU1AGGXgIOV+iA1tbD0TKos8dZnBF11OGD9aOyHNoKY2dq4dukyzmYnOUsxJ6iVAg7zv5IWw/w2B9EZazjXbqrrfcPVRszpmr3SncNBmNCtW7BqojW7cm9dp9MQGQ/r7Fv/cI/wSN8GGJ85RUAOPW74So/hEhA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1740119803; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=kuD3u33aWoHTXab2WrawxTM5wIZBVCvo/hMWctDErQQ=; b=a9VL5X3b9mxE+XoCNGSOYuLOQWo9ybglJAhLKtHS/vVIgbaBUN91ZE/aOBJd/GzrRzaDHW3QTZ5Lk+w5qsy0DmABQMutYpMDH3LxBZnlfH7qy5/PNR+d4coLvYET7OgFxNzJ+O8pNdOl3Et5NtGuDOVHI/E87rLtpQux05+IJQg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail header.i=@fujitsu.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1740119803730770.3387242748026; Thu, 20 Feb 2025 22:36:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tlMd3-0001R9-RZ; Fri, 21 Feb 2025 01:35:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tlMd0-0001P9-Pu for qemu-devel@nongnu.org; Fri, 21 Feb 2025 01:35:14 -0500 Received: from esa5.hc1455-7.c3s2.iphmx.com ([68.232.139.130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tlMcx-0003k0-Pp for qemu-devel@nongnu.org; Fri, 21 Feb 2025 01:35:14 -0500 Received: from unknown (HELO oym-r2.gw.nic.fujitsu.com) ([210.162.30.90]) by esa5.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2025 15:35:07 +0900 Received: from oym-m3.gw.nic.fujitsu.com (oym-nat-oym-m3.gw.nic.fujitsu.com [192.168.87.60]) by oym-r2.gw.nic.fujitsu.com (Postfix) with ESMTP id 68287E60B6 for ; Fri, 21 Feb 2025 15:35:04 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by oym-m3.gw.nic.fujitsu.com (Postfix) with ESMTP id 2DE87D562E for ; Fri, 21 Feb 2025 15:35:04 +0900 (JST) Received: from iaas-rdma.. (unknown [10.167.135.44]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 909151A006C; Fri, 21 Feb 2025 14:35:03 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1740119712; x=1771655712; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OGaTqxGXEo1MTajaJFuUlh9b3n9a82sHYYsh9iM782A=; b=HLTtzCdw9WtKr6zWZ2ePM/lRFLjz6SuoA9DqrK/zKjqJrm0SBtBz9poL J8qvmpq0PW4atHt8dG2qPrPqoKjX//V/uPxEciMzKfUukP+czZne1FRwa IzBMlZ9L/pvhPXqLXgpWiH7cI8iE0ObBPLSfE7tCxqLK6R6GBUHUshpbX 75gURFw8Jtfqc3pHLfB5EHGPVSZz0V+ZDvnnsC1dpYtA5EzGdVMi1H0L9 dh0tbCp3amiXa9w8IIy4fBLKm4n57LF5dA8MkBXUYVwdpBIVAQNgydK2x 0K82TcEtJdWnA01jItJmhHHgKlGYOvX72tnCWk889kBTh5RBEV1H4798j A==; X-CSE-ConnectionGUID: W9uhMt+SScef71MLSZCSIg== X-CSE-MsgGUID: jgc6Xo+NRk2YR84MuLdvWg== X-IronPort-AV: E=McAfee;i="6700,10204,11351"; a="189940639" X-IronPort-AV: E=Sophos;i="6.13,303,1732546800"; d="scan'208";a="189940639" To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Li Zhijian Subject: [PATCH v2 1/8] migration: Prioritize RDMA in ram_save_target_page() Date: Fri, 21 Feb 2025 14:36:05 +0800 Message-ID: <20250221063612.695909-2-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250221063612.695909-1-lizhijian@fujitsu.com> References: <20250221063612.695909-1-lizhijian@fujitsu.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=68.232.139.130; envelope-from=lizhijian@fujitsu.com; helo=esa5.hc1455-7.c3s2.iphmx.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Li Zhijian From: Li Zhijian via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1740119804168019000 Content-Type: text/plain; charset="utf-8" Address an error in RDMA-based migration by ensuring RDMA is prioritized when saving pages in `ram_save_target_page()`. Previously, the RDMA protocol's page-saving step was placed after other protocols due to a refactoring in commit bc38dc2f5f3. This led to migration failures characterized by unknown control messages and state loading errors destination: (qemu) qemu-system-x86_64: Unknown control message QEMU FILE qemu-system-x86_64: error while loading state section id 1(ram) qemu-system-x86_64: load of migration failed: Operation not permitted source: (qemu) qemu-system-x86_64: RDMA is in an error state waiting migration to a= bort! qemu-system-x86_64: failed to save SaveStateEntry with id(name): 1(ram): -1 qemu-system-x86_64: rdma migration: recv polling control error! qemu-system-x86_64: warning: Early error. Sending error. qemu-system-x86_64: warning: rdma migration: send polling control error RDMA migration implemented its own protocol/method to send pages to destination side, hand over to RDMA first to prevent pages being saved by other protocol. Fixes: bc38dc2f5f3 ("migration: refactor ram_save_target_page functions") Signed-off-by: Li Zhijian --- migration/ram.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 589b6505eb2..424df6d9f13 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1964,6 +1964,11 @@ static int ram_save_target_page(RAMState *rs, PageSe= archStatus *pss) ram_addr_t offset =3D ((ram_addr_t)pss->page) << TARGET_PAGE_BITS; int res; =20 + /* Hand over to RDMA first */ + if (control_save_page(pss, offset, &res)) { + return res; + } + if (!migrate_multifd() || migrate_zero_page_detection() =3D=3D ZERO_PAGE_DETECTION_LEGACY= ) { if (save_zero_page(rs, pss, offset)) { @@ -1976,10 +1981,6 @@ static int ram_save_target_page(RAMState *rs, PageSe= archStatus *pss) return ram_save_multifd_page(block, offset); } =20 - if (control_save_page(pss, offset, &res)) { - return res; - } - return ram_save_page(rs, pss); } =20 --=20 2.44.0