From nobody Thu Apr 3 10:17:29 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=1740551399; cv=none; d=zohomail.com; s=zohoarc; b=bfzKQT07ynwgZWpS9mtI8ScsNrVk6QMWDjh+fNILHFaxm6IfVkWCz9wIIVk2rvOKU7yEPcLM7bxYMO3Va4CSouHN8W2BBSpLOzLjPbzeeriga2WAZKWVeo2G5wg6qUDCozSiC9G3z/faYaU2yTXJpVm/kHhpl65xb7rA0pvwTeM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1740551399; 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=d/g5oAYvOveN7vR8yTHxTXUrnrd+S65hWl47rDFmE2g=; b=cDt9tfEgtvbi+CXx3Z7qPtUXpyZ8X/432iADo1ODhF8xPTpIXfjliUPhYyRcvYt11ehVg62PiVI0Y8+b2/wXCeIiyMWutV41l9L70OlLw8Y7QdqoKiGwt7WJxc0YfJVcFK/kLIA/V00FnMzvmSUXppzG/OhKkFXsGPdVgnG0KI0= 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 1740551399710356.38715963190987; Tue, 25 Feb 2025 22:29:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tnAvC-0001jO-N2; Wed, 26 Feb 2025 01:29:30 -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 1tnAv8-0001iO-Oq for qemu-devel@nongnu.org; Wed, 26 Feb 2025 01:29:26 -0500 Received: from esa11.hc1455-7.c3s2.iphmx.com ([207.54.90.137]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tnAv5-0001vB-L0 for qemu-devel@nongnu.org; Wed, 26 Feb 2025 01:29:26 -0500 Received: from unknown (HELO oym-r3.gw.nic.fujitsu.com) ([210.162.30.91]) by esa11.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2025 15:29:17 +0900 Received: from oym-m3.gw.nic.fujitsu.com (oym-nat-oym-m3.gw.nic.fujitsu.com [192.168.87.60]) by oym-r3.gw.nic.fujitsu.com (Postfix) with ESMTP id B3747C2269 for ; Wed, 26 Feb 2025 15:29:14 +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 7CAC7D7283 for ; Wed, 26 Feb 2025 15:29:14 +0900 (JST) Received: from iaas-rdma.. (unknown [10.167.135.44]) by edo.cn.fujitsu.com (Postfix) with ESMTP id E05A21A006C; Wed, 26 Feb 2025 14:29:13 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1740551364; x=1772087364; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+CR7mMv1ubPow4V3VojBzeRtfH/4mt0zSZmZJSzhgAQ=; b=KMh/cAbjgUtKXTA4xREibAWdGxP+mGpSkuY2BMjWcMokHqmV9JnKMJGZ BjhGucZQlk7MaZH0ya9PXXJuJ67e4mfsJ25yEEnZIrYds3ZAFkD5+CENM IqiJe1sbhStivxpDNo790yiZZLJteXXmAZilh2bJ6L1xKnqHsJhHf0pzE A2mwBk/ui2z9nIAmIEHDTsNR3pusbXx9lf6/riF5I3/EsnuMq2DUF8PVd LvJWfCA6Uur1zPGXGM0x2QdM3PI8boCAenRY/BF0fkzmKUqPJt/TQz8rj zaE+Fl56PCLO6Hksr5Q9Ymg8AvhWSL/e/n3SfuCUfKecsQipamhK77LCD A==; X-CSE-ConnectionGUID: t/bBvNlvQG+mIDcxdGmKnQ== X-CSE-MsgGUID: TJSYT6JfSqC4vOgwz1PqxQ== X-IronPort-AV: E=McAfee;i="6700,10204,11356"; a="170688703" X-IronPort-AV: E=Sophos;i="6.13,316,1732546800"; d="scan'208";a="170688703" To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Li Zhijian Subject: [PATCH v4 1/6] migration: Prioritize RDMA in ram_save_target_page() Date: Wed, 26 Feb 2025 14:30:38 +0800 Message-ID: <20250226063043.732455-2-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250226063043.732455-1-lizhijian@fujitsu.com> References: <20250226063043.732455-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=207.54.90.137; envelope-from=lizhijian@fujitsu.com; helo=esa11.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: 1740551402127019100 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") Reviewed-by: Peter Xu Signed-off-by: Li Zhijian --- V3: collect Reviewed tags --- 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 From nobody Thu Apr 3 10:17:29 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=1740551399; cv=none; d=zohomail.com; s=zohoarc; b=GGCL7b2iu+34l+ok2Y4fHb4Cyge17zuIzLB2O5CmIMs2WmCIXMuzH7nGnYg/Xi7DcKFQhcxFEyIM7WrvvFWPtRUulzCkrGInxkrJAaP594a0USThEZ//Mw/dgg5rxsitovMqqkS6P4LQJrLOMyNXtoymNEKUhOHLdyz/Rkq63Gs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1740551399; 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=VIsslPvJD6lROjELLcZ6meGftTLDgthObpEzFJcGa3w=; b=VGeeShoX+NsqKc0wG/8TW1TaLodAOLesIZceZXTjgSzQfZrrDRya3pn0m1Wu+nqJgifnNvYAA2LoTCqyA6nr00civuj1YnZTqVvAEIkebrgQftWEMfuKwDxgkcM5qwIUvtDsnojlcNnRrKIQV1htveXWDr+Zkjc39Q6ZWZlvTp0= 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 1740551399711593.0991880582595; Tue, 25 Feb 2025 22:29:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tnAv9-0001iv-Nb; Wed, 26 Feb 2025 01:29:27 -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 1tnAv7-0001iA-IH for qemu-devel@nongnu.org; Wed, 26 Feb 2025 01:29:25 -0500 Received: from esa7.hc1455-7.c3s2.iphmx.com ([139.138.61.252]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tnAv5-0001vU-1D for qemu-devel@nongnu.org; Wed, 26 Feb 2025 01:29:24 -0500 Received: from unknown (HELO oym-r4.gw.nic.fujitsu.com) ([210.162.30.92]) by esa7.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2025 15:29:17 +0900 Received: from oym-m3.gw.nic.fujitsu.com (oym-nat-oym-m3.gw.nic.fujitsu.com [192.168.87.60]) by oym-r4.gw.nic.fujitsu.com (Postfix) with ESMTP id 2F3ADDBB8C for ; Wed, 26 Feb 2025 15:29:15 +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 EB262D7283 for ; Wed, 26 Feb 2025 15:29:14 +0900 (JST) Received: from iaas-rdma.. (unknown [10.167.135.44]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 59C081A000B; Wed, 26 Feb 2025 14:29:14 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1740551363; x=1772087363; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nj+mWTuUHzCDhtGmNKjDef/32YsFZSQpyRrGLNs711A=; b=VJDYaB9xeqcVaLDiHYLQjkc6V9Ik2FhqGjrZWbPMuxHL31xINtLURsLu DixG+gykdur/uNQzEHwrnUfe+1QKyHqArLL4gFIFHNb4Yl63770EPtq8H HQejIcvDl0U1ngM2M9RaoUQztW0CyOoxLuQkduCpoNalXYNQL8tpC2SyW Zp3HUjoCahcFHvHFm2hjcw9vblrdis+ecTQCJ/UUhZrWCTSnOFOserzf3 KfVxaNAKLw4YIWtUaiWUoygFV4RLbEv46M8PaFlYZkRbzj/UAhnIq12bY 5UGm8RPM+LDHK1SZdDFcdPm7KmV28+kc9OpclkclKoNTiNtyGL6ehHNwp A==; X-CSE-ConnectionGUID: WatrQSQmR0qUgFKztBJ8Eg== X-CSE-MsgGUID: 6IRBnTVPTJGQJfRvO6Huiw== X-IronPort-AV: E=McAfee;i="6700,10204,11356"; a="170097394" X-IronPort-AV: E=Sophos;i="6.13,316,1732546800"; d="scan'208";a="170097394" To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Li Zhijian Subject: [PATCH v4 2/6] migration: check RDMA and capabilities are compatible on both sides Date: Wed, 26 Feb 2025 14:30:39 +0800 Message-ID: <20250226063043.732455-3-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250226063043.732455-1-lizhijian@fujitsu.com> References: <20250226063043.732455-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=139.138.61.252; envelope-from=lizhijian@fujitsu.com; helo=esa7.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: 1740551402165019100 Content-Type: text/plain; charset="utf-8" Depending on the order of starting RDMA and setting capability, the following scenarios can be categorized into the following scenarios: Source: S1: [set capabilities] -> [Start RDMA outgoing] Destination: D1: [set capabilities] -> [Start RDMA incoming] D2: [Start RDMA incoming] -> [set capabilities] Previously, compatibility between RDMA and capabilities was verified only in scenario D1, potentially causing migration failures in other situations. For scenarios S1 and D1, we can seamlessly incorporate migration_transport_compatible() to address compatibility between channels and capabilities vs transport. For scenario D2, ensure compatibility within migrate_caps_check(). Signed-off-by: Li Zhijian Reviewed-by: Peter Xu --- V4: - Remove Reviewed-tag and cover above D2 scenario V3: - collect Reviewed tag - reorder: 5th -> 2nd --- migration/migration.c | 30 ++++++++++++++++++++---------- migration/options.c | 21 +++++++++++++++++++++ migration/options.h | 1 + 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index c597aa707e5..0736d3a6728 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -238,6 +238,24 @@ migration_channels_and_transport_compatible(MigrationA= ddress *addr, return true; } =20 +static bool +migration_capabilities_and_transport_compatible(MigrationAddress *addr, + Error **errp) +{ + if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { + return migrate_rdma_caps_check(migrate_get_current()->capabilities, + errp); + } + + return true; +} + +static bool migration_transport_compatible(MigrationAddress *addr, Error *= *errp) +{ + return migration_channels_and_transport_compatible(addr, errp) && + migration_capabilities_and_transport_compatible(addr, errp); +} + static gint page_request_addr_cmp(gconstpointer ap, gconstpointer bp) { uintptr_t a =3D (uintptr_t) ap, b =3D (uintptr_t) bp; @@ -716,7 +734,7 @@ static void qemu_start_incoming_migration(const char *u= ri, bool has_channels, } =20 /* transport mechanism not suitable for migration? */ - if (!migration_channels_and_transport_compatible(addr, errp)) { + if (!migration_transport_compatible(addr, errp)) { return; } =20 @@ -735,14 +753,6 @@ static void qemu_start_incoming_migration(const char *= uri, bool has_channels, } #ifdef CONFIG_RDMA } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_RDMA) { - if (migrate_xbzrle()) { - error_setg(errp, "RDMA and XBZRLE can't be used together"); - return; - } - if (migrate_multifd()) { - error_setg(errp, "RDMA and multifd can't be used together"); - return; - } rdma_start_incoming_migration(&addr->u.rdma, errp); #endif } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_EXEC) { @@ -2159,7 +2169,7 @@ void qmp_migrate(const char *uri, bool has_channels, } =20 /* transport mechanism not suitable for migration? */ - if (!migration_channels_and_transport_compatible(addr, errp)) { + if (!migration_transport_compatible(addr, errp)) { return; } =20 diff --git a/migration/options.c b/migration/options.c index bb259d192a9..c6f18df5864 100644 --- a/migration/options.c +++ b/migration/options.c @@ -439,6 +439,20 @@ static bool migrate_incoming_started(void) return !!migration_incoming_get_current()->transport_data; } =20 +bool migrate_rdma_caps_check(bool *caps, Error **errp) +{ + if (caps[MIGRATION_CAPABILITY_XBZRLE]) { + error_setg(errp, "RDMA and XBZRLE can't be used together"); + return false; + } + if (caps[MIGRATION_CAPABILITY_MULTIFD]) { + error_setg(errp, "RDMA and multifd can't be used together"); + return false; + } + + return true; +} + /** * @migration_caps_check - check capability compatibility * @@ -602,6 +616,13 @@ bool migrate_caps_check(bool *old_caps, bool *new_caps= , Error **errp) } } =20 + /* + * On destination side, check the cases that capability is being set + * after incoming thread has started. + */ + if (migrate_rdma() && !migrate_rdma_caps_check(new_caps, errp)) { + return false; + } return true; } =20 diff --git a/migration/options.h b/migration/options.h index 762be4e641a..82d839709e7 100644 --- a/migration/options.h +++ b/migration/options.h @@ -57,6 +57,7 @@ bool migrate_tls(void); =20 /* capabilities helpers */ =20 +bool migrate_rdma_caps_check(bool *caps, Error **errp); bool migrate_caps_check(bool *old_caps, bool *new_caps, Error **errp); =20 /* parameters */ --=20 2.44.0 From nobody Thu Apr 3 10:17:29 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=1740551466; cv=none; d=zohomail.com; s=zohoarc; b=UiyqiFkQb0YVMKlXAvLJS79i8yDIeqXwZYKhZ43qB5WT74/nn+3nak40EW4tMRTFwKGbihMeOYbv/qPsrSzyJl7Om2hTDp3oGpM3MzCNnTiMD9gbxL5SIECqqSJszxHpmddPRSwSS1VdJkqdd9068lVoi0W+rWEUROjooeTxMXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1740551466; 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=SiIMqhvqWJelK2UJFOlZb5PKPT4tvof2y/OrWyuk64U=; b=AfEaaUDjptKZeiL0UPwplFO+g+ZIVgBYbNfeWmpYNpN/tFSD4L3fNK9i9AZM2R6c2VIwBMF3Dmf3T3BxKlRC69EuX00gtE57RVXYkKimm0uKdxEzgTYbtUz0ERGRXKsWsFHnP6w7ZnhebggZhiSEwkOCqmIKoQTdoFwHm8E6Rhs= 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 1740551466272804.8541240151379; Tue, 25 Feb 2025 22:31:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tnAvA-0001jJ-8q; Wed, 26 Feb 2025 01:29:29 -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 1tnAv9-0001ih-3K for qemu-devel@nongnu.org; Wed, 26 Feb 2025 01:29:27 -0500 Received: from esa6.hc1455-7.c3s2.iphmx.com ([68.232.139.139]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tnAv6-0001vH-2a for qemu-devel@nongnu.org; Wed, 26 Feb 2025 01:29:26 -0500 Received: from unknown (HELO oym-r2.gw.nic.fujitsu.com) ([210.162.30.90]) by esa6.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2025 15:29:17 +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 A6E07E6146 for ; Wed, 26 Feb 2025 15:29:15 +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 70E80D6FE3 for ; Wed, 26 Feb 2025 15:29:15 +0900 (JST) Received: from iaas-rdma.. (unknown [10.167.135.44]) by edo.cn.fujitsu.com (Postfix) with ESMTP id C857E1A006C; Wed, 26 Feb 2025 14:29:14 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1740551364; x=1772087364; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pkZwIs9/cYDv5hTZNoRRBNEigCZj1TZSZF90ccJyt/Q=; b=hbXUs4nFfKspI5g3y4HVSJvAe5iac/532DvxZvKpJ3DB8xkVNFhtXIrj +DrV4VCOA9KjjIaia5wZrYaMAJFNES4eCA057HjbAPQAcdVH9jJimhfbV LRWoc+fFB7ga9QT5ZADCjLxWl8mjkftGQtsXBNBZI7DsXoaE4AsIgWeSN 4hbZNlaAOkvEyZGhijxVtiwg1gQiHgPKYiHI/5RGIVyXZAsG2+AMHU7Om 8p2QNvBZ7iTQ84JwHsdmoiATh6o6ve9sET1XJX4/pnrtIsfzow4wuGAH2 ti0MqpCdjTXcZw7ISuOpex4GjN5+Uluu1dkfUlL7RzPWN3XyTw6yas5+J A==; X-CSE-ConnectionGUID: xkZdEotmQZebUKJV1vBRuA== X-CSE-MsgGUID: 5zixxtj9TGGopJqKb1vHpg== X-IronPort-AV: E=McAfee;i="6700,10204,11356"; a="193851339" X-IronPort-AV: E=Sophos;i="6.13,316,1732546800"; d="scan'208";a="193851339" To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Li Zhijian Subject: [PATCH v4 3/6] migration: disable RDMA + postcopy-ram Date: Wed, 26 Feb 2025 14:30:40 +0800 Message-ID: <20250226063043.732455-4-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250226063043.732455-1-lizhijian@fujitsu.com> References: <20250226063043.732455-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.139; envelope-from=lizhijian@fujitsu.com; helo=esa6.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: 1740551467688019100 Content-Type: text/plain; charset="utf-8" It's believed that RDMA + postcopy-ram has been broken for a while. Rather than spending time re-enabling it, let's simply disable it as a trade-off. Reviewed-by: Peter Xu Signed-off-by: Li Zhijian --- V3: - collect Reviewed tag - reoder: 6th -> 3th --- migration/options.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/migration/options.c b/migration/options.c index c6f18df5864..527ba05d413 100644 --- a/migration/options.c +++ b/migration/options.c @@ -449,6 +449,10 @@ bool migrate_rdma_caps_check(bool *caps, Error **errp) error_setg(errp, "RDMA and multifd can't be used together"); return false; } + if (caps[MIGRATION_CAPABILITY_POSTCOPY_RAM]) { + error_setg(errp, "RDMA and postcopy-ram can't be used together"); + return false; + } =20 return true; } --=20 2.44.0 From nobody Thu Apr 3 10:17:29 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=1740551469; cv=none; d=zohomail.com; s=zohoarc; b=Ow447TOXGMedLpFfrEBxA3hVpaGnpb0+ipNxlEYdi/1+U0Q6HH81/N3nVE+HgZnO3k14wmKtfVPLTyFWi3p+xzxChq0wwGKJxw/VrjMgq1Dz1eQsQeD2HN+MZCLOOUErsKzizwoJrjkqVtKFcFRvzhTNvTGz/Wg/8guemd1xlZo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1740551469; 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=WL6GlU4NuFC1l8BNMFu9FJKExS2wfLJd6FX7G7FGuzs=; b=BQhXglJXuwLLVwgq8EnMnA2SDIlax+wHF6LSVAuS4bNiRf1V7KMmS4kLgVsWCj+03wCMQdVGrKdrcY1WmfJzO195K5h0dTV7zO7YoZ8AOrw3XnfYoCgRehzgBX3aL9WmtMXPwLT0h4MogQo2ytL85iBJS7yzNoeKuFGW84CKlGA= 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 1740551469394747.1978806366616; Tue, 25 Feb 2025 22:31:09 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tnAvG-0001kA-2y; Wed, 26 Feb 2025 01:29:34 -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 1tnAvB-0001jN-OZ for qemu-devel@nongnu.org; Wed, 26 Feb 2025 01:29:30 -0500 Received: from esa11.hc1455-7.c3s2.iphmx.com ([207.54.90.137]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tnAv9-0001vB-3Z for qemu-devel@nongnu.org; Wed, 26 Feb 2025 01:29:28 -0500 Received: from unknown (HELO oym-r1.gw.nic.fujitsu.com) ([210.162.30.89]) by esa11.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2025 15:29:19 +0900 Received: from oym-m4.gw.nic.fujitsu.com (oym-nat-oym-m4.gw.nic.fujitsu.com [192.168.87.61]) by oym-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id 35BAFD480F for ; Wed, 26 Feb 2025 15:29:16 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by oym-m4.gw.nic.fujitsu.com (Postfix) with ESMTP id E9059D4BF1 for ; Wed, 26 Feb 2025 15:29:15 +0900 (JST) Received: from iaas-rdma.. (unknown [10.167.135.44]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 4D1931A000B; Wed, 26 Feb 2025 14:29:15 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1740551368; x=1772087368; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7PBvoitHF7A+13zdpcsFHx6PTRDE0C2rhaDiyx486rU=; b=TTr7rsSSuv9/N2vc6Xl9UvirWqipxssH33RwvDDvLugM4Fl4ORCSHpN5 2nhCCdS5QPaA6CNJdN+S6BxSfxghrYPQ2Pn1FcDDHonOLZp33udic+4U8 v/K/Pkfb0czBm5dCJcCNQyv0fm99AELQGZT9pXeDfWW9CfNSWiVJZ+H6+ nQr6vFUql86jyNzF/772IK18Ac2VfuxKFjJwqjzCy5RhzaB4oQBSTF00q Rg5MI+3S8sfqBinu/jKLU1LhxvJ4ht9KvL8P8jatkDJWSoz441sTVHYDe tWQHDiMgcujdKhK3SEWjMo8Hs+bPFViDGHc4V9Zgn0kDt1b+4wNEvYBAL A==; X-CSE-ConnectionGUID: GGTiUeRDSJKA5uTrkwZOdQ== X-CSE-MsgGUID: HOMIfzaaSPS1LAk9GeV1MA== X-IronPort-AV: E=McAfee;i="6700,10204,11356"; a="170688705" X-IronPort-AV: E=Sophos;i="6.13,316,1732546800"; d="scan'208";a="170688705" To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Li Zhijian Subject: [PATCH v4 4/6] migration/rdma: Remove redundant migration_in_postcopy checks Date: Wed, 26 Feb 2025 14:30:41 +0800 Message-ID: <20250226063043.732455-5-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250226063043.732455-1-lizhijian@fujitsu.com> References: <20250226063043.732455-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=207.54.90.137; envelope-from=lizhijian@fujitsu.com; helo=esa11.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: 1740551471694019100 Content-Type: text/plain; charset="utf-8" Since we have disabled RDMA + postcopy, it's safe to remove the migration_in_postcopy() that follows the migrate_rdma(). Signed-off-by: Li Zhijian Reviewed-by: Peter Xu --- V3: reorder: 7th->4th --- migration/rdma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/rdma.c b/migration/rdma.c index 76fb0349238..e5b4ac599b1 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3284,7 +3284,7 @@ err: int rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size) { - if (!migrate_rdma() || migration_in_postcopy()) { + if (!migrate_rdma()) { return RAM_SAVE_CONTROL_NOT_SUPP; } =20 @@ -3829,7 +3829,7 @@ int rdma_block_notification_handle(QEMUFile *f, const= char *name) =20 int rdma_registration_start(QEMUFile *f, uint64_t flags) { - if (!migrate_rdma() || migration_in_postcopy()) { + if (!migrate_rdma()) { return 0; } =20 @@ -3861,7 +3861,7 @@ int rdma_registration_stop(QEMUFile *f, uint64_t flag= s) RDMAControlHeader head =3D { .len =3D 0, .repeat =3D 1 }; int ret; =20 - if (!migrate_rdma() || migration_in_postcopy()) { + if (!migrate_rdma()) { return 0; } =20 --=20 2.44.0 From nobody Thu Apr 3 10:17:29 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=1740551466; cv=none; d=zohomail.com; s=zohoarc; b=NnpEJWjSCdokk1MtqrHJnww2tljbZmP3EYSuPFHpwsRS9LxkFbQVRD8W5vS8tYdm2GMAss5ombiCwqCYa+1NC9PYE7xkFI3pEnLwQDTHSDLh9RSzc1RV9ZOGByDIVLhDyDS1prfQbAuDM35eTDhQSOOF1Dzuw2+3fxjZGeRf2sE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1740551466; 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=CgIITmGRFHU68ZcOtc3RkvbhDsQNrWM3QrmGAb/vFX4=; b=DmzokhDXUtVFKtwzC5lCuubLnNmA1BWwQJmdDQjncfTvdV7qFSd8YkW32LVaeEza9wyK+xAfBpE/YJN8iXf3VK0Kboj4Zq4721dYyJlMoQecjVrL55wFuLjETxEUgyOihN4DchQPMS2nFxpkdP6Fp+SXz1Wtla7OT41V4Jc8yUs= 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 1740551466031294.2315606958797; Tue, 25 Feb 2025 22:31:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tnAvJ-0001l7-G0; Wed, 26 Feb 2025 01:29:37 -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 1tnAv9-0001jB-UK for qemu-devel@nongnu.org; Wed, 26 Feb 2025 01:29:27 -0500 Received: from esa7.hc1455-7.c3s2.iphmx.com ([139.138.61.252]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tnAv7-0001vU-TN for qemu-devel@nongnu.org; Wed, 26 Feb 2025 01:29:27 -0500 Received: from unknown (HELO yto-r4.gw.nic.fujitsu.com) ([218.44.52.220]) by esa7.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2025 15:29:18 +0900 Received: from yto-m4.gw.nic.fujitsu.com (yto-nat-yto-m4.gw.nic.fujitsu.com [192.168.83.67]) by yto-r4.gw.nic.fujitsu.com (Postfix) with ESMTP id 9D24FD5011 for ; Wed, 26 Feb 2025 15:29:16 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by yto-m4.gw.nic.fujitsu.com (Postfix) with ESMTP id 6550AD5015 for ; Wed, 26 Feb 2025 15:29:16 +0900 (JST) Received: from iaas-rdma.. (unknown [10.167.135.44]) by edo.cn.fujitsu.com (Postfix) with ESMTP id C584F1A006C; Wed, 26 Feb 2025 14:29:15 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1740551365; x=1772087365; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jYuHGHFwJgUSZ8fd1FkvvadoSY3u79MwvRktdvNIgbY=; b=YkYALTnlHXvo0bdUs32MjfHB9CNzvDAeKtI76uPIg6ZxeaTXbfbRf4f4 9IhYvkyO0JGoKCjauz9CALv0965kmoB/9JhUpudizkAPbckIPx5O6jm3x y3fNZeoVRMk4NVu9iwpoZYSfl3639wv2ZEpPgq1Tv96DGQP7u27VhW+nU v7BmyegE/VdhEZYzbFbLtRkaMwhpqIhygggL3fFSgwkk2IxdjOmN5IKsG hxYqAJFr2cThsrMkA1r/NDAAPC0L3umULkZ8BfoXt1iYA/rXnB6I+2Oyb z4CHz1sQqd0S4vRdU7gy7Yov8zgUG1xun6teqmLzgmhEpPMCxb+BUwqwk w==; X-CSE-ConnectionGUID: BAKcwxM9S8O9ttPKI3albw== X-CSE-MsgGUID: lMPJ7L2mSMCITUFOJ87SKw== X-IronPort-AV: E=McAfee;i="6700,10204,11356"; a="170097395" X-IronPort-AV: E=Sophos;i="6.13,316,1732546800"; d="scan'208";a="170097395" To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Li Zhijian Subject: [PATCH v4 5/6] migration: Unfold control_save_page() Date: Wed, 26 Feb 2025 14:30:42 +0800 Message-ID: <20250226063043.732455-6-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250226063043.732455-1-lizhijian@fujitsu.com> References: <20250226063043.732455-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=139.138.61.252; envelope-from=lizhijian@fujitsu.com; helo=esa7.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: 1740551466561019000 Content-Type: text/plain; charset="utf-8" control_save_page() is for RDMA only, unfold it to make the code more clear. In addition: - Similar to other branches style in ram_save_target_page(), involve RDMA only if the condition 'migrate_rdma()' is true. - Further simplify the code by removing the RAM_SAVE_CONTROL_NOT_SUPP. Signed-off-by: Li Zhijian Reviewed-by: Peter Xu --- V3: squash previous 2nd, 3th, 4th into one patch --- migration/ram.c | 34 +++++++--------------------------- migration/rdma.c | 7 ++----- migration/rdma.h | 3 +-- 3 files changed, 10 insertions(+), 34 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 424df6d9f13..c363034c882 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1143,32 +1143,6 @@ static int save_zero_page(RAMState *rs, PageSearchSt= atus *pss, return len; } =20 -/* - * @pages: the number of pages written by the control path, - * < 0 - error - * > 0 - number of pages written - * - * Return true if the pages has been saved, otherwise false is returned. - */ -static bool control_save_page(PageSearchStatus *pss, - ram_addr_t offset, int *pages) -{ - int ret; - - ret =3D rdma_control_save_page(pss->pss_channel, pss->block->offset, o= ffset, - TARGET_PAGE_SIZE); - if (ret =3D=3D RAM_SAVE_CONTROL_NOT_SUPP) { - return false; - } - - if (ret =3D=3D RAM_SAVE_CONTROL_DELAYED) { - *pages =3D 1; - return true; - } - *pages =3D ret; - return true; -} - /* * directly send the page to the stream * @@ -1965,7 +1939,13 @@ static int ram_save_target_page(RAMState *rs, PageSe= archStatus *pss) int res; =20 /* Hand over to RDMA first */ - if (control_save_page(pss, offset, &res)) { + if (migrate_rdma()) { + res =3D rdma_control_save_page(pss->pss_channel, pss->block->offse= t, + offset, TARGET_PAGE_SIZE); + + if (res =3D=3D RAM_SAVE_CONTROL_DELAYED) { + res =3D 1; + } return res; } =20 diff --git a/migration/rdma.c b/migration/rdma.c index e5b4ac599b1..08eb924ffaa 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -3284,14 +3284,11 @@ err: int rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size) { - if (!migrate_rdma()) { - return RAM_SAVE_CONTROL_NOT_SUPP; - } + assert(migrate_rdma()); =20 int ret =3D qemu_rdma_save_page(f, block_offset, offset, size); =20 - if (ret !=3D RAM_SAVE_CONTROL_DELAYED && - ret !=3D RAM_SAVE_CONTROL_NOT_SUPP) { + if (ret !=3D RAM_SAVE_CONTROL_DELAYED) { if (ret < 0) { qemu_file_set_error(f, ret); } diff --git a/migration/rdma.h b/migration/rdma.h index f55f28bbed1..8eeb0117b91 100644 --- a/migration/rdma.h +++ b/migration/rdma.h @@ -33,7 +33,6 @@ void rdma_start_incoming_migration(InetSocketAddress *hos= t_port, Error **errp); #define RAM_CONTROL_ROUND 1 #define RAM_CONTROL_FINISH 3 =20 -#define RAM_SAVE_CONTROL_NOT_SUPP -1000 #define RAM_SAVE_CONTROL_DELAYED -2000 =20 #ifdef CONFIG_RDMA @@ -56,7 +55,7 @@ static inline int rdma_control_save_page(QEMUFile *f, ram_addr_t block_offset, ram_addr_t offset, size_t size) { - return RAM_SAVE_CONTROL_NOT_SUPP; + g_assert_not_reached(); } #endif #endif --=20 2.44.0 From nobody Thu Apr 3 10:17:29 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=1740551444; cv=none; d=zohomail.com; s=zohoarc; b=P6TxSmG2F6/A8gbY9LOHgi1aIcGEzbm1Z6Kj+HZHjvIeCf54PdaAYODkgJukJEDQqBu8OpyLWeHD3ean2nKtD6RziTBGgdJ0n1qjl1p69AmjGvL4XkVvc+s9uO8IhIXu5sMGsxxPjdcWJ/dDC88brkh1/SOzalu4VEdfZIDWn3E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1740551444; 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=fCWLsYDPYSVi1hWsjS4N0NBUY3RJvj5X/yTTQd9OOb4=; b=Mu406DSGVDOVHuABxyxFqCXJRdAmhDU3oyslxaNmxGSNZP+45l4iK1nhDfOA/FdZDcAUJHdQMGhauV4uq+mAlgEGm4Ozx7p5loFRdnaoBJqHSwxpG3N/PZpodY7XYpA9vuP8qcHQ5YiXsRu8z4YZ1rT4y8TRg9nqBRhCNSIyybU= 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 174055144480471.95599186416246; Tue, 25 Feb 2025 22:30:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tnAvE-0001jd-Tl; Wed, 26 Feb 2025 01:29:33 -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 1tnAv8-0001iU-Ue for qemu-devel@nongnu.org; Wed, 26 Feb 2025 01:29:26 -0500 Received: from esa8.hc1455-7.c3s2.iphmx.com ([139.138.61.253]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tnAv5-0001vs-Tr for qemu-devel@nongnu.org; Wed, 26 Feb 2025 01:29:26 -0500 Received: from unknown (HELO yto-r1.gw.nic.fujitsu.com) ([218.44.52.217]) by esa8.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2025 15:29:19 +0900 Received: from yto-m3.gw.nic.fujitsu.com (yto-nat-yto-m3.gw.nic.fujitsu.com [192.168.83.66]) by yto-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id 16DA2D6EAA for ; Wed, 26 Feb 2025 15:29:17 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by yto-m3.gw.nic.fujitsu.com (Postfix) with ESMTP id D163ED96C8 for ; Wed, 26 Feb 2025 15:29:16 +0900 (JST) Received: from iaas-rdma.. (unknown [10.167.135.44]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 3EC8D1A000B; Wed, 26 Feb 2025 14:29:16 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1740551363; x=1772087363; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jd+DdY5eY77B7kVpkL1NpFZ69YDj7OrP1FP6uOvMgB8=; b=YoroZip4iVizqATFX472dZG8U7YNuO16Vw2p7Pt6S4noSayCtWHm+nT0 hsYMEWnZkQV0XRTzEZzP3MMtI25bmlFzQjKgwPc8GUi3PZVy62F32IZ4O KCSZL9baZUZD3VP2UO17uXjCXbUD6e1K0+BkIgayjRwsJB8SWTy52m/Zr zJl6Xyl4wi11GF6N5G41SgzSsfNRg1dCvAif5oPmo1sMjdTqJuGCfwo7a AOeP0fuQot+SpNLWMCwd4wbvgGVXwVui220G0pHqYlzWyNzg2lL7vo75E GkL04/qGRGjkzBSAQzY+V+yT4OzkSezvt3sdZ16YkHXh3uhmYTNwmr+bB w==; X-CSE-ConnectionGUID: o2JTIcBbTuyigVhG35xlyA== X-CSE-MsgGUID: ITDscG5FTiWKNdQBWZzaBw== X-IronPort-AV: E=McAfee;i="6700,10204,11356"; a="179208534" X-IronPort-AV: E=Sophos;i="6.13,316,1732546800"; d="scan'208";a="179208534" To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Li Zhijian Subject: [PATCH v4 6/6] migration: Add qtest for migration over RDMA Date: Wed, 26 Feb 2025 14:30:43 +0800 Message-ID: <20250226063043.732455-7-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250226063043.732455-1-lizhijian@fujitsu.com> References: <20250226063043.732455-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=139.138.61.253; envelope-from=lizhijian@fujitsu.com; helo=esa8.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: 1740551445843019100 Content-Type: text/plain; charset="utf-8" This qtest requires there is a RDMA(RoCE) link in the host. In order to make the test work smoothly, introduce a scripts/rdma-migration-helper.sh to - setup a new Soft-RoCE(aka RXE) if it's root - detect existing RoCE link Test will be skipped if there is no available RoCE link. # Start of rdma tests # Running /x86_64/migration/precopy/rdma/plain ok 1 /x86_64/migration/precopy/rdma/plain # SKIP There is no available rdma link to run RDMA migration test. To enable the test: (1) Run 'scripts/rdma-migration-helper.sh setup' with root and rerun the t= est or (2) Run the test with root privilege # End of rdma tests Reviewed-by: Peter Xu Signed-off-by: Li Zhijian --- MAINTAINERS | 1 + scripts/rdma-migration-helper.sh | 41 +++++++++++++++++ tests/qtest/migration/precopy-tests.c | 64 +++++++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100755 scripts/rdma-migration-helper.sh diff --git a/MAINTAINERS b/MAINTAINERS index 3848d37a38d..15360fcdc4b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3480,6 +3480,7 @@ R: Li Zhijian R: Peter Xu S: Odd Fixes F: migration/rdma* +F: scripts/rdma-migration-helper.sh =20 Migration dirty limit and dirty page rate M: Hyman Huang diff --git a/scripts/rdma-migration-helper.sh b/scripts/rdma-migration-help= er.sh new file mode 100755 index 00000000000..66557d9e267 --- /dev/null +++ b/scripts/rdma-migration-helper.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# Copied from blktests +get_ipv4_addr() +{ + ip -4 -o addr show dev "$1" | + sed -n 's/.*[[:blank:]]inet[[:blank:]]*\([^[:blank:]/]*\).*/\1/p' | + tr -d '\n' +} + +has_soft_rdma() +{ + rdma link | grep -q " netdev $1[[:blank:]]*\$" +} + +rdma_rxe_setup_detect() +{ + ( + cd /sys/class/net && + for i in *; do + [ -e "$i" ] || continue + [ "$i" =3D "lo" ] && continue + [ "$(<"$i/addr_len")" =3D 6 ] || continue + [ "$(<"$i/carrier")" =3D 1 ] || continue + + has_soft_rdma "$i" && break + [ "$operation" =3D "setup" ] && + rdma link add "${i}_rxe" type rxe netdev "$i" && break + done + has_soft_rdma "$i" || return + get_ipv4_addr "$i" + ) +} + +operation=3D${1:-setup} + +if [ "$operation" =3D=3D "setup" ] || [ "$operation" =3D=3D "detect" ]; th= en + rdma_rxe_setup_detect +else + echo "Usage: $0 [setup | detect]" +fi diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index ba273d10b9a..bf97f4e9325 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -99,6 +99,66 @@ static void test_precopy_unix_dirty_ring(void) test_precopy_common(&args); } =20 +#ifdef CONFIG_RDMA + +#define RDMA_MIGRATION_HELPER "scripts/rdma-migration-helper.sh" +static int new_rdma_link(char *buffer) +{ + const char *argument =3D (geteuid() =3D=3D 0) ? "setup" : "detect"; + char cmd[1024]; + + snprintf(cmd, sizeof(cmd), "%s %s", RDMA_MIGRATION_HELPER, argument); + + FILE *pipe =3D popen(cmd, "r"); + if (pipe =3D=3D NULL) { + perror("Failed to run script"); + return -1; + } + + int idx =3D 0; + while (fgets(buffer + idx, 128 - idx, pipe) !=3D NULL) { + idx +=3D strlen(buffer); + } + + int status =3D pclose(pipe); + if (status =3D=3D -1) { + perror("Error reported by pclose()"); + return -1; + } else if (WIFEXITED(status)) { + return WEXITSTATUS(status); + } + + return -1; +} + +static void test_precopy_rdma_plain(void) +{ + char buffer[128] =3D {}; + + if (new_rdma_link(buffer)) { + g_test_skip("\nThere is no available rdma link to run RDMA migrati= on test.\n" + "To enable the test:\n" + "(1) Run \'" RDMA_MIGRATION_HELPER " setup\' with root= and rerun the test\n" + "or\n" + "(2) Run the test with root privilege\n"); + return; + } + + /* + * TODO: query a free port instead of hard code. + * 29200=3D('R'+'D'+'M'+'A')*100 + **/ + g_autofree char *uri =3D g_strdup_printf("rdma:%s:29200", buffer); + + MigrateCommon args =3D { + .listen_uri =3D uri, + .connect_uri =3D uri, + }; + + test_precopy_common(&args); +} +#endif + static void test_precopy_tcp_plain(void) { MigrateCommon args =3D { @@ -1124,6 +1184,10 @@ static void migration_test_add_precopy_smoke(Migrati= onTestEnv *env) test_multifd_tcp_uri_none); migration_test_add("/migration/multifd/tcp/plain/cancel", test_multifd_tcp_cancel); +#ifdef CONFIG_RDMA + migration_test_add("/migration/precopy/rdma/plain", + test_precopy_rdma_plain); +#endif } =20 void migration_test_add_precopy(MigrationTestEnv *env) --=20 2.44.0