From nobody Wed Apr 2 14:41:25 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=1741156110; cv=none; d=zohomail.com; s=zohoarc; b=R6pP4dGZ7Q0iOp1fLCxARjzPw49T77okHk+48hPV4WzAjrK7EYnXVNsMRMYmyfaptufMUfNLLojvLhNnlkcu4F3Wxohe9QKPvyPBmsKBuR0Ay369aaGvTAwIT3x5snEn4Qbpd3PGu2jZFf4Nv5tPmSS0GcuuQZhV9k0xfn43imk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741156110; 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=M68swcb6plgjgJ/ut8x/1BswpnOp6eN7kL0IjFahTXHnKyqCbIRPWdnS5WG9nHIikLaIpHZnTfxaWjlRoA8o6Rt3U5hh+Z6om2ZDbL4dgDBZmYEYYucOAzcD9dzYU6g+Pn9VY2NxyAsh2R5/aThUS/K8RUYChV8VvyVdy8xnbos= 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 1741156110865887.1552856830738; Tue, 4 Mar 2025 22:28:30 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tpiDs-0002H3-Uo; Wed, 05 Mar 2025 01:27:16 -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 1tpiDe-0002EL-El for qemu-devel@nongnu.org; Wed, 05 Mar 2025 01:27:04 -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 1tpiDb-0007eh-N5 for qemu-devel@nongnu.org; Wed, 05 Mar 2025 01:27:02 -0500 Received: from unknown (HELO yto-r4.gw.nic.fujitsu.com) ([218.44.52.220]) by esa5.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Mar 2025 15:26:53 +0900 Received: from yto-m2.gw.nic.fujitsu.com (yto-nat-yto-m2.gw.nic.fujitsu.com [192.168.83.65]) by yto-r4.gw.nic.fujitsu.com (Postfix) with ESMTP id 9CE0AE076B for ; Wed, 5 Mar 2025 15:26:51 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by yto-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id 4F286D5037 for ; Wed, 5 Mar 2025 15:26:51 +0900 (JST) Received: from iaas-rdma.. (unknown [10.167.135.44]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 9BDD11A00AE; Wed, 5 Mar 2025 14:26:50 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1741156019; x=1772692019; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+CR7mMv1ubPow4V3VojBzeRtfH/4mt0zSZmZJSzhgAQ=; b=V049X8BJBb6iHNJvSYQKzmbOTq8gHg7l2BbH1AEnW4qVbWAuxkimUW6D 2n+PKp9gGsekCDFexuXNXrEyBnjxFnWE87d1U9+sIA35rKC48/WX2fCax z5yaS+otqwQI+CVOA9IXsQUUU92rcx2vKhTkaOi+HNZ+Uzv/EGbY2DQWq 8lmqX1/OuTQ6BJP2T+nPk6zKmoljc6LZzOtkSelNGdQr9pSEREZC5FT4+ OVrQ9/y33Jo9P0imQYF4lQrKmz9QOI6FApQN7h8lThVn5NZfMDXKgBiUR tp40Q9aXi1DlLerB6xjajODiWPwOfk8CP/kjEfcGCguyn6u6vhc2v7j6I Q==; X-CSE-ConnectionGUID: pxRF47CDRP2/aB3/eLHP6g== X-CSE-MsgGUID: M929AnRWSoGi3ingVL2n5Q== X-IronPort-AV: E=McAfee;i="6700,10204,11363"; a="191183347" X-IronPort-AV: E=Sophos;i="6.14,222,1736780400"; d="scan'208";a="191183347" To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Li Zhijian Subject: [PATCH v5 1/6] migration: Prioritize RDMA in ram_save_target_page() Date: Wed, 5 Mar 2025 14:28:20 +0800 Message-ID: <20250305062825.772629-2-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250305062825.772629-1-lizhijian@fujitsu.com> References: <20250305062825.772629-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1741156112668019100 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 Wed Apr 2 14:41:25 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=1741156065; cv=none; d=zohomail.com; s=zohoarc; b=Kplo4R5XMyFODPcRC9U1ICIrOITuR87s4tpqa1S18f9PKM8K6WZwJEAOD2e9+gjfAmjcgRVzGpLNW3Rd0s8K8Lvt/3iJcip+j0C5AMBmkuU3VLnpKF8yNIePlUX/1uP9THqel3CuupwB7v2eLu+xCcNWEVXrUVqAj08IIiFLOE0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741156065; 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=q9Ac5MDNEThYyzPUyh8cFDhr05WIKqsIc1+y08l0LmY=; b=U/6WHJia9tu9BNNqpOtCdCLGOgQKP3myHVM9N0EVk5/1nDLiO7f/vBQokHh1hYgPvURogbpmhSpc4ZpDDKtJWiX+IAZyLf5EK80lQ3Inj4bsry/VKaA4v+8VxB1uoc+6S/U2CB3e9GxWwTN6LRy9yCrAjo8MTVpwUChsqSd+gw4= 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 1741156065404453.4735710492913; Tue, 4 Mar 2025 22:27:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tpiDo-0002Fr-AS; Wed, 05 Mar 2025 01:27:12 -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 1tpiDd-0002E9-KH for qemu-devel@nongnu.org; Wed, 05 Mar 2025 01:27:04 -0500 Received: from esa4.hc1455-7.c3s2.iphmx.com ([68.232.139.117]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tpiDa-0007es-VH for qemu-devel@nongnu.org; Wed, 05 Mar 2025 01:27:00 -0500 Received: from unknown (HELO oym-r2.gw.nic.fujitsu.com) ([210.162.30.90]) by esa4.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Mar 2025 15:26:54 +0900 Received: from oym-m2.gw.nic.fujitsu.com (oym-nat-oym-m2.gw.nic.fujitsu.com [192.168.87.59]) by oym-r2.gw.nic.fujitsu.com (Postfix) with ESMTP id 065B8D4C39 for ; Wed, 5 Mar 2025 15:26:52 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by oym-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id BA8D9BDB65 for ; Wed, 5 Mar 2025 15:26:51 +0900 (JST) Received: from iaas-rdma.. (unknown [10.167.135.44]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 186A61A00A0; Wed, 5 Mar 2025 14:26:51 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1741156018; x=1772692018; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Kf7nUzx6bCEoflN6wH/5kN4a9SJ7oJCr6a8XCP/ryZQ=; b=KFRYd/AnNPYsZSOl2ZScphO92Htx+raxGTQfFz3+knMvI43xrS3R4ESV Xa7obXXsAgBT8XZav7d+4NvQ/NV0RpqcrYd5XSFCDp720epxzdk6hgRkU z7DQVNS6uiXekQcGsvE0kkpQ+0eK0BHe94bBqEkPHzKTg+ZT4D/BZKfxp 3YfA0fiNPJyl7vrTupO7oAEPj8OEoq+IbPxt8lhSMXrzcVeNZiB0Aq5d/ wCn5ODQk9sSuVxThRwdFDJRyH7cLzBue3Gcvjs9En2HLOa3V7YcvPdAeM ju90q1K0/I3WfkJuQXRUZr7RyqIk+u7kjNSYzB6RAkqlXHMur0cyuVwDO Q==; X-CSE-ConnectionGUID: CoscqJ2BRgybZGaWcVAZ0w== X-CSE-MsgGUID: /eRXmp2JSKezmJ275wcmOA== X-IronPort-AV: E=McAfee;i="6700,10204,11363"; a="192279487" X-IronPort-AV: E=Sophos;i="6.14,222,1736780400"; d="scan'208";a="192279487" To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Li Zhijian Subject: [PATCH v5 2/6] migration: check RDMA and capabilities are compatible on both sides Date: Wed, 5 Mar 2025 14:28:21 +0800 Message-ID: <20250305062825.772629-3-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250305062825.772629-1-lizhijian@fujitsu.com> References: <20250305062825.772629-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.117; envelope-from=lizhijian@fujitsu.com; helo=esa4.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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1741156068557019100 Content-Type: text/plain; charset="utf-8" Depending on the order of starting RDMA and setting capability, they 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(). Reviewed-by: Peter Xu Signed-off-by: Li Zhijian --- 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 Wed Apr 2 14:41:25 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=1741156064; cv=none; d=zohomail.com; s=zohoarc; b=WflYdRne2kk+pvNdpQ84QnTn6XDkwTUZyxC1vAWo7N/TmaIMsr7KJaG8/hgN0rxj0q7PceUpK2eTW9hTxAgTunSW1RUOOB7H258403qIkz0qiq6SIpAwCMlGKQ4iTiSQgKLT/J6IX5NHCIn9aE32UoGg3cNismdE1ZMfD9315gI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741156064; 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=TmjCpULIWk0c2r+V2XHq2c6u6x8P+u2zjUG9G3pbg5P4YneCbMcu4nRdsez1c8H2PpuP3Ek9fWmLSpb/SKRXixwagHov83n9cXEeuhYxbkRyZGRcDgwOTzEGyO68LyCccuGhkbj2A99BPIGZRgvihjQKXj5l3TMcQfPv7aRXO9g= 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 1741156064386118.87313838152204; Tue, 4 Mar 2025 22:27:44 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tpiDo-0002Ft-A2; Wed, 05 Mar 2025 01:27:12 -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 1tpiDd-0002E8-JX for qemu-devel@nongnu.org; Wed, 05 Mar 2025 01:27:04 -0500 Received: from esa10.hc1455-7.c3s2.iphmx.com ([139.138.36.225]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tpiDa-0007eu-VR for qemu-devel@nongnu.org; Wed, 05 Mar 2025 01:27:00 -0500 Received: from unknown (HELO oym-r1.gw.nic.fujitsu.com) ([210.162.30.89]) by esa10.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Mar 2025 15:26:54 +0900 Received: from oym-m2.gw.nic.fujitsu.com (oym-nat-oym-m2.gw.nic.fujitsu.com [192.168.87.59]) by oym-r1.gw.nic.fujitsu.com (Postfix) with ESMTP id 7E25CD4809 for ; Wed, 5 Mar 2025 15:26:52 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by oym-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id 40C65BDB65 for ; Wed, 5 Mar 2025 15:26:52 +0900 (JST) Received: from iaas-rdma.. (unknown [10.167.135.44]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 890741A009A; Wed, 5 Mar 2025 14:26:51 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1741156019; x=1772692019; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pkZwIs9/cYDv5hTZNoRRBNEigCZj1TZSZF90ccJyt/Q=; b=MGUHimjW/vRbOdLkqk7p/f1X5sf/XdBV74THI6ScZQfiA7ueO3tVrpd2 VHTQsq4RbqVvwHoaCEFULTGhqz6Frg4wQQIujtZB89B9CjXVXaFy2gBRe JS3MCkog0aCl4OdjaxpiU7GvbCUAnkYApHagsSvRCynmOSypFt56ppWJC w7zTUCbBf+7izcgyz2IWqGrThwer911zojKmK7MImVozlqVH9J56VnLRg v6t08sI0cCYpwhJzXN8s+zYzJM4AmfmTPzsPcmCSjfl1zwhszx5+mTpaJ YQbC0BEtX6ItfBs7C8xopqyKOftPpqR4EWUp9sPthwSCz2i2Zz6TENHFR Q==; X-CSE-ConnectionGUID: iQ9hm4bXRLips5PQdYqqyA== X-CSE-MsgGUID: YRMDLhg8TzGEF/XPg6BWLw== X-IronPort-AV: E=McAfee;i="6700,10204,11363"; a="179366760" X-IronPort-AV: E=Sophos;i="6.14,222,1736780400"; d="scan'208";a="179366760" To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Li Zhijian Subject: [PATCH v5 3/6] migration: disable RDMA + postcopy-ram Date: Wed, 5 Mar 2025 14:28:22 +0800 Message-ID: <20250305062825.772629-4-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250305062825.772629-1-lizhijian@fujitsu.com> References: <20250305062825.772629-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.36.225; envelope-from=lizhijian@fujitsu.com; helo=esa10.hc1455-7.c3s2.iphmx.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1741156068490019100 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 Wed Apr 2 14:41:25 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=1741156114; cv=none; d=zohomail.com; s=zohoarc; b=nYI5Hcq8JWhYM0jIMtUZEbGZbUOSz0EFWm1A3TuzE2CtJirU5cvEwaKVXuInYdNkIn+xz0wx9EYHyE0UZopKf7XmREGGw6AXQgvSEdDik0kN2CSwgGw5uonLYl26MshHfXeyxL4wABIb3j1mlX4QhrtPCr+IyAfVeKiY7yI8Luc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741156114; 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=6MWPim21PKWh0T7afBFt8hkvxvfXcOzH+PM4tTbXpBs=; b=c3nGtdBaIq3YrsJgeYmnbkX78J7KeFBA4geAArEol5A7YJDqZCkDeBvWzoNPpeZxogGqadmtT8eE4NW3dlUkUTiGNy3s367WssSfE6O9Q+MbbN7u8DZQJmk3kfG8yXC+MaB+OqrX0Xv7sn+YKmwNdwVvM3S2im/WUm1wV9DnCB4= 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 1741156114199958.684639422055; Tue, 4 Mar 2025 22:28:34 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tpiDq-0002Gm-Tb; Wed, 05 Mar 2025 01:27:15 -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 1tpiDe-0002EK-D2 for qemu-devel@nongnu.org; Wed, 05 Mar 2025 01:27:04 -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 1tpiDb-0007fN-5K for qemu-devel@nongnu.org; Wed, 05 Mar 2025 01:27:02 -0500 Received: from unknown (HELO yto-r3.gw.nic.fujitsu.com) ([218.44.52.219]) by esa8.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Mar 2025 15:26:55 +0900 Received: from yto-m2.gw.nic.fujitsu.com (yto-nat-yto-m2.gw.nic.fujitsu.com [192.168.83.65]) by yto-r3.gw.nic.fujitsu.com (Postfix) with ESMTP id 138DCD5076 for ; Wed, 5 Mar 2025 15:26:53 +0900 (JST) Received: from edo.cn.fujitsu.com (edo.cn.fujitsu.com [10.167.33.5]) by yto-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id BFCD3D50F5 for ; Wed, 5 Mar 2025 15:26:52 +0900 (JST) Received: from iaas-rdma.. (unknown [10.167.135.44]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 104E21A0078; Wed, 5 Mar 2025 14:26:52 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1741156019; x=1772692019; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PCrT7a0aKAT8MdJt36hLMtVWWawydwVKMLiaVadqYkM=; b=HMLev96S2Zut2YOyFo6B76lQOBF3HtW/GZZgee8G6CJ4/HqsEDmi01Gc OMI2tUNpjiHGc9pp9glemiiEou7JObQ0CLtb0xiGkXa7r9xGAA/IkMhHX oM9HZGp7+cEJcyxxP6hoNLPdIOvUkG44eJhmIQfx58mWhmvyTWWr3lKs1 n4Rc02EvUzqWo8xGM5R26dO8ttmw2XCz2PW/gmDM8axKcWHH6stv7kLlj NXBZTaazY6ZrPRznB/Jzsd0UTb4nkNwUJanoEJfF4/I6b4aCeZvTlICOa QZCPNSlr3MMb8RweKafWznx51xJj0Ew+pCeMqKxFbBwym2haOnKdng+Ur A==; X-CSE-ConnectionGUID: 7iUKXKTdSLG6j2VWTNV0nQ== X-CSE-MsgGUID: uDB9uZ0STvijhCXs/sPSww== X-IronPort-AV: E=McAfee;i="6700,10204,11363"; a="179998160" X-IronPort-AV: E=Sophos;i="6.14,222,1736780400"; d="scan'208";a="179998160" To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Li Zhijian Subject: [PATCH v5 4/6] migration/rdma: Remove redundant migration_in_postcopy checks Date: Wed, 5 Mar 2025 14:28:23 +0800 Message-ID: <20250305062825.772629-5-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250305062825.772629-1-lizhijian@fujitsu.com> References: <20250305062825.772629-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1741156114589019000 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(). Reviewed-by: Peter Xu Signed-off-by: Li Zhijian --- 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 Wed Apr 2 14:41:25 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=1741156116; cv=none; d=zohomail.com; s=zohoarc; b=H/gX4MCs05nRLsQqeCiFxJGw+kyB9XfKmLDmlxw37WApLjV/vliXyvypEFVaZGMRCf1gVKfy4yF4qxhlBtCpJHSEsgFN+/8ZYAi0jGlMaONYinY83vPhA69ADsI4mqPlSq0/UmMRk35vlJJFkp+VuONGajPYJSyNvC97Qm4UuL4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741156116; 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=S8Awr+59svLw+QjcHAYUl5eN14qbWCTX92ZF5P4vBPY=; b=d0N8DY/1/mUMaarHg4v8ckPEShyWsQAZxvlxGpYxmKdcRR/Po+uRtZJc6pG6PqGpay3D+RsM7kSlcf604vJ9Fyuf3dNs5+bVArR1e/iWwmQHVbaub+1UDVZyM7Zy+JWZgywZC4nr1qWWDcOSiAWrfCP1CsPr0KFIh2bQ+ILQrxY= 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 1741156116902872.2551833543325; Tue, 4 Mar 2025 22:28:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tpiDq-0002Gn-UN; Wed, 05 Mar 2025 01:27:15 -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 1tpiDe-0002EM-Gl for qemu-devel@nongnu.org; Wed, 05 Mar 2025 01:27:04 -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 1tpiDb-0007fR-N4 for qemu-devel@nongnu.org; Wed, 05 Mar 2025 01:27:02 -0500 Received: from unknown (HELO oym-r3.gw.nic.fujitsu.com) ([210.162.30.91]) by esa7.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Mar 2025 15:26:55 +0900 Received: from oym-m4.gw.nic.fujitsu.com (oym-nat-oym-m4.gw.nic.fujitsu.com [192.168.87.61]) by oym-r3.gw.nic.fujitsu.com (Postfix) with ESMTP id 6F0B3C2264 for ; Wed, 5 Mar 2025 15:26:53 +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 364D3D5B4E for ; Wed, 5 Mar 2025 15:26:53 +0900 (JST) Received: from iaas-rdma.. (unknown [10.167.135.44]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 89C551A00A1; Wed, 5 Mar 2025 14:26:52 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1741156019; x=1772692019; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aGMfL9Y4ZguUCaGuBijWVIIjX8bazUzbs1q0hk1VKy0=; b=Guz6iE6DB4IhMHRGuSFs/YBlA/ekXW0TdsfczKg5WyqYSgzk3yF2pJS9 C03/pUsgYLeXkZlTCUO/xM2DoEHVZIKBWKnX4KK6Tt18FPpQoYnGnByEh ZU4uSxucTZW3jZL27OGnIOW06jqe9/kYvWSReMcEr7aERZPr5bCw9W9Gv VtgvBiAVh0+yhdA02n3CunFffi9fzNFzf/fnIcZ72CYlQWjBwomQytaR+ /iRLr5kSEyssWj98x1xQp0GUtDWrrmkr3qK7Ng/0Q5BSNfM6aiSLdj653 dg33jaOamxWeYVSibLBnc2HrN+AzTc8bfryBxXgK7MGiSaAa3q5gr/zzp w==; X-CSE-ConnectionGUID: CBN4qQoRSs+DdSw46W+70g== X-CSE-MsgGUID: hR0ih6rYR/WBeP+taP9PlA== X-IronPort-AV: E=McAfee;i="6700,10204,11363"; a="170889611" X-IronPort-AV: E=Sophos;i="6.14,222,1736780400"; d="scan'208";a="170889611" To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Li Zhijian Subject: [PATCH v5 5/6] migration: Unfold control_save_page() Date: Wed, 5 Mar 2025 14:28:24 +0800 Message-ID: <20250305062825.772629-6-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250305062825.772629-1-lizhijian@fujitsu.com> References: <20250305062825.772629-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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1741156118758019000 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. Reviewed-by: Peter Xu Signed-off-by: Li Zhijian --- 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 Wed Apr 2 14:41:26 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=1741156079; cv=none; d=zohomail.com; s=zohoarc; b=cdiZopD16//rCWqQDsKB/IxI2M+AHixQdlXaqdsxH1g1AuzUIg/mEeny+Vf/J+RRuIVN1dB9es1Up73/BqvYsv5SpCIEU2QzapWBCbncRr4C5ANT1OsnkrAv6q9NtLIKAHG91z7Jiuw76BwhkPsIP8VT2xhI4nv1J0QistxnbOc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741156079; 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=WjSmtMiOarWMJp2RTq2DO0H+U97d39dSrKirYt+GPaA=; b=kLit9XLhakSv3M4XS7Bjgjm8rVY9GL1Kyxy+6pAgW1VaUgzRb5rAczKyOyb4pcwQam7unI+LTN7eknqeJO21ta20+xlkme6d7hVG7n0aarPU0HpGrbzncOdrYyqaNGQeQXVNOS4tk/cjwn+1QFY9hoYiLURNAHw0NCc28dlcPJs= 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 1741156078821770.9287894602877; Tue, 4 Mar 2025 22:27:58 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tpiDx-0002Ix-Km; Wed, 05 Mar 2025 01:27:21 -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 1tpiDg-0002Eb-BV for qemu-devel@nongnu.org; Wed, 05 Mar 2025 01:27:04 -0500 Received: from esa10.hc1455-7.c3s2.iphmx.com ([139.138.36.225]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tpiDd-0007eu-W0 for qemu-devel@nongnu.org; Wed, 05 Mar 2025 01:27:03 -0500 Received: from unknown (HELO yto-r2.gw.nic.fujitsu.com) ([218.44.52.218]) by esa10.hc1455-7.c3s2.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Mar 2025 15:26:56 +0900 Received: from yto-m4.gw.nic.fujitsu.com (yto-nat-yto-m4.gw.nic.fujitsu.com [192.168.83.67]) by yto-r2.gw.nic.fujitsu.com (Postfix) with ESMTP id E7EC0106F5 for ; Wed, 5 Mar 2025 15:26:53 +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 AA0ADE6475 for ; Wed, 5 Mar 2025 15:26:53 +0900 (JST) Received: from iaas-rdma.. (unknown [10.167.135.44]) by edo.cn.fujitsu.com (Postfix) with ESMTP id 057DE1A0078; Wed, 5 Mar 2025 14:26:52 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=fujitsu.com; i=@fujitsu.com; q=dns/txt; s=fj2; t=1741156022; x=1772692022; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tDscS2j+O+Z0q86HAll9GMNNktJSP/0M29iwN+Knsv4=; b=gT6fwKDGzPOQjiYwZACazFU3HHE0Z98eJsI2FzVS/zncA9FNxMQeUU53 l2xQrfIe+7UT5HwrModB0k0YfbiaubJdQeoh9kIjbSsua4YbJdSc8mjPx XTuA4Aprs+K18Z4xgsOxmbFqo9fRIZ2prGa7jwZz1FjhJgKS/jYlfPEaI ajwUD+cpaU30BqzXKL6npx/2Pr2SxnvkZdhRaDHzGqWmSrlqE2muck2Wm oLelfaTsEVmnJFVwBqnxNg6/ol8fZ6cUvMgetMMZI/pjTNVd2kEDFfbCC 4rq5BDcdyjEMAFZmFYnndKjxnnEJDcZ1Cl6DnJEJgHm4LB4JD1wEoYI3k A==; X-CSE-ConnectionGUID: 3LS0HFDkQPihESYWbd36aQ== X-CSE-MsgGUID: xSkw5YyPQS6rNEfS0WBYNQ== X-IronPort-AV: E=McAfee;i="6700,10204,11363"; a="179366766" X-IronPort-AV: E=Sophos;i="6.14,222,1736780400"; d="scan'208";a="179366766" To: qemu-devel@nongnu.org Cc: Peter Xu , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Li Zhijian Subject: [PATCH v5 6/6] migration: Add qtest for migration over RDMA Date: Wed, 5 Mar 2025 14:28:25 +0800 Message-ID: <20250305062825.772629-7-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250305062825.772629-1-lizhijian@fujitsu.com> References: <20250305062825.772629-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.36.225; envelope-from=lizhijian@fujitsu.com; helo=esa10.hc1455-7.c3s2.iphmx.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1741156082547019000 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 Command 'rdma' is not available, please install it first. # To enable the test: # (1) Run 'scripts/rdma-migration-helper.sh setup' with root and rerun the= test # or # (2) Run the test with root privilege # ok 1 /x86_64/migration/precopy/rdma/plain # SKIP No rdma link available # End of rdma tests Note: Remove the newly added RXE link by executing 'modprobe -r rdma_rxe' or by specifying 'clean' within this script. Reviewed-by: Peter Xu Signed-off-by: Li Zhijian --- V5: check command 'rdma' in script Add clean option for the script report details only if QTEST_LOG=3D1 --- MAINTAINERS | 1 + scripts/rdma-migration-helper.sh | 48 +++++++++++++++++++ tests/qtest/migration/precopy-tests.c | 67 +++++++++++++++++++++++++++ 3 files changed, 116 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..08e29a52eb8 --- /dev/null +++ b/scripts/rdma-migration-helper.sh @@ -0,0 +1,48 @@ +#!/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} + +command -v rdma >/dev/null || { + echo "Command 'rdma' is not available, please install it first." >&2 + exit 1 +} + +if [ "$operation" =3D=3D "setup" ] || [ "$operation" =3D=3D "detect" ]; th= en + rdma_rxe_setup_detect +elif [ "$operation" =3D=3D "clean" ]; then + modprobe -r rdma_rxe +else + echo "Usage: $0 [setup | detect | clean]" +fi diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/= precopy-tests.c index ba273d10b9a..9a4638481b4 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -99,6 +99,69 @@ 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, bool verbose) +{ + const char *argument =3D (geteuid() =3D=3D 0) ? "setup" : "detect"; + char cmd[1024]; + + snprintf(cmd, sizeof(cmd), "%s %s %s", RDMA_MIGRATION_HELPER, argument, + verbose ? "" : "2>/dev/null"); + + 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 {}; + bool verbose =3D g_getenv("QTEST_LOG"); + + if (new_rdma_link(buffer, verbose)) { + g_test_skip("No rdma link available"); + if (verbose) { + g_test_message("To enable the test:\n" + "(1) Run \'" RDMA_MIGRATION_HELPER " setup\' wi= th 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 +1187,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