From nobody Wed Sep 23 10:35:47 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1778012913; cv=none; d=zohomail.com; s=zohoarc; b=NnyX6un1kgWv+e+nSnv8Jt9sG5fw3iy0CiWyayRHAbSY7GKLYAEeTTSWM5MAg6hyYmA6TNQbI0PbeTQF/HMumtiBatfUntj0bt9HBKEVd45mLcRLh3B/Pa8mJvBnIg4JywFOQPBeF23powNeYD5cHnQ0tmcgVHvMkp7uFlSx+8M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1778012913; 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:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ebiyZAuHPg80vY31UF8UVr2ykPbfE9ba9kbGfZ1Nazg=; b=fxgzSHoI1wyXIcV0U0Uhu6IynkbZ0sqayT5T/ed33Ql8LUhDrkiTTM+3yy9HxC4eBceQaemejDYXSch7+6viXOT6QudaafG8zULKSNDJ05stDhg05YnVxgCjCIpfpE7KaDRtSjnlqoc3atyxFehz1Vlisd726Qlb2Fq7cd/FFxA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=quarantine dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17780129132285.61878734674508; Tue, 5 May 2026 13:28:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wKMM4-0004PT-R7; Tue, 05 May 2026 16:26:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wKMM1-0004Mr-OZ for qemu-devel@nongnu.org; Tue, 05 May 2026 16:26:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wKMLz-0002aC-9m for qemu-devel@nongnu.org; Tue, 05 May 2026 16:26:53 -0400 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-614-8H0zrU3yOfu0u8sEeOm6vg-1; Tue, 05 May 2026 16:26:49 -0400 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-8b597b14a22so10660946d6.0 for ; Tue, 05 May 2026 13:26:49 -0700 (PDT) Received: from x1.com ([142.189.10.167]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8b53c6b8123sm155283806d6.35.2026.05.05.13.26.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2026 13:26:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778012810; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ebiyZAuHPg80vY31UF8UVr2ykPbfE9ba9kbGfZ1Nazg=; b=JWTAGjxS1ToXoQvpui3Dupgaj2hyo1Si2cXTz7OEDv03A3VK0cY7YK3zWTWgtNkDEheUmD Q/A6TYXsMsVhMVjvdoN/u66wlKnKPRBWEE980yGZaMxh1dYmFxmUPLyeh2M19RPsKJJ5ks H4uCztQNhhQSaE2rcLLZivpPfhmbl8g= X-MC-Unique: 8H0zrU3yOfu0u8sEeOm6vg-1 X-Mimecast-MFC-AGG-ID: 8H0zrU3yOfu0u8sEeOm6vg_1778012809 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1778012808; x=1778617608; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ebiyZAuHPg80vY31UF8UVr2ykPbfE9ba9kbGfZ1Nazg=; b=N81xyfGaCY6GEF5Iazf6zunBof6FYYZ2GOl5Z2JCBDzb/Ge2lcFSMY3OVdSVmzXzTX +EcLFTzgDJ40DYLwUbXLes7jTP/hm+ECfTFiu8/iJHoER9fzMixmr1hBpBiGFOhcyU7+ pEQqBiLaHvkXIA2sYK6UW/gWDnynL5oY/CDoccUSi2w7ahY/VCSjciy5Wt36B4X7UTY1 vpFzJty//3NFcJvibe7Y5FLmkfSazyhRBLEsaab3x33q0Laexo1ZZaPF3FsxSzTTs+3r WdYmhV9NcAAa39ZTTirqJjDwgsynRi7aZfshl+UTjoDl2G79C0XB+L9APtJbmz0DQQuN ZADA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778012808; x=1778617608; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ebiyZAuHPg80vY31UF8UVr2ykPbfE9ba9kbGfZ1Nazg=; b=KiB69Y+saiVpLxhaGAELl3LpBsJN3ngnDkYU2xMomZau8+p83MYYtnk74md2fwV9YV sockiZydswhFnmfy1rVUepdAiq4yTA3cWYx3OUCZ5GNM55eXxT1v+G+WIbQFx0+1+JAt HxdMVhXnQzn8z7MQQPx4IIS8oAwB45eo3oD+zG3Q1hQeX5Rk7Oz5Z+WESyrFh4lF9xEE 2Re09L7KB1XPZcRnk4+PeUEi2zbiP+98nwHm8RuVkg0wFDlJw9o0s1Opbq54ga1ETbN9 loTuKYXNcjBcU+B0l+gaSdFnBxZKqfp8y67Iy4jOVFkN9pl7iGEJSgdPz//uSko/O2ys Cp8Q== X-Gm-Message-State: AOJu0YxefgB32wrP+OuE7JupyPhUCyc89xAESYQa3+A0TozH+7F2EGF7 bTyzIdzxTZ8NxHHDoc8Yb3uB5iM7EsMbch8wLYv9z8PGx7MBhVVPB+CE5oeZtZGliXGWdJWyi4k Q0b+v/RHoIXwwSFzyfaG8vbv29gPwOE0964Bzwu6Jtc+nXmq4LxSf5QeVKpKv2oKd4yqb6F1qPJ I34L5gfK9yRYXTSKPWWIK0hS05mO/FzFbq7nFHWw== X-Gm-Gg: AeBDieskUnQpXVrCwEoSKtp2b1NcfnbujzK2w5kBcASGndsm84eAuwfEsZTqqu4gNIJ RmQSx+tiWb9H1by4UrSNcKiezFFznIYn0DNNEc1E6rS2W4uQ/XcR6hEDz7Tphjqx64kszatnQ8G vYfloAa2uhw0lCa+cLRezBb2eJvZNAbWiNdlCcxPlTNstjBxIqsNbPCC1P37r0AlWADxR6Jkczz s+1nPVSiLx4ErYHmupKqU3bU3cc5LJj2adyLtH50WvZwMfyScIzxOhkrMW/0DufH9kLmw0RUxad RjShk/wZbJbVoINcyHYM6IpKZsZi3MVUr82VU20gA0FWYAyKD17QGFyQdUUwONKoO2yPrLqDnEu 373yNFoIjzI5l7TD9BLeewAoIvctsDiMenGc0eV2XdxG7rDplgPaPClQ= X-Received: by 2002:a05:6214:e86:b0:89c:3f06:537a with SMTP id 6a1803df08f44-8baa05bda05mr77133536d6.21.1778012808182; Tue, 05 May 2026 13:26:48 -0700 (PDT) X-Received: by 2002:a05:6214:e86:b0:89c:3f06:537a with SMTP id 6a1803df08f44-8baa05bda05mr77133006d6.21.1778012807498; Tue, 05 May 2026 13:26:47 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Fabiano Rosas , Paolo Bonzini , Peter Xu , Samuel Zhang , Markus Armbruster , Li Zhijian Subject: [PULL 03/23] migration/rdma: add x-rdma-chunk-size parameter Date: Tue, 5 May 2026 16:26:20 -0400 Message-ID: <20260505202640.1011006-4-peterx@redhat.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260505202640.1011006-1-peterx@redhat.com> References: <20260505202640.1011006-1-peterx@redhat.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=lists1p.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.443, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1778012915040154100 Content-Type: text/plain; charset="utf-8" From: Samuel Zhang The default 1MB RDMA chunk size causes slow live migration because each chunk triggers a write_flush (ibv_post_send). For 8GB RAM, 1MB chunk size produces ~15000 flushes vs ~3700 with 1024MB chunk size. Add x-rdma-chunk-size parameter to configure the RDMA chunk size for faster migration. Usage: `migrate_set_parameter x-rdma-chunk-size 1024M` Performance with RDMA live migration of 8GB RAM VM: | x-rdma-chunk-size (B) | time (s) | throughput (MB/s) | |-----------------------|----------|-------------------| | 1M (default) | 37.915 | 1,007 | | 32M | 17.880 | 2,260 | | 1024M | 4.368 | 17,529 | Signed-off-by: Samuel Zhang Acked-by: Markus Armbruster Acked-by: Li Zhijian Tested-by: Li Zhijian Acked-by: Fabiano Rosas Acked-by: Peter Xu Link: https://lore.kernel.org/r/20260427031401.3895523-1-guoqing.zhang@amd.= com Signed-off-by: Peter Xu --- qapi/migration.json | 13 +++++++++++-- migration/options.h | 1 + migration/migration-hmp-cmds.c | 11 +++++++++++ migration/options.c | 33 ++++++++++++++++++++++++++++++++- migration/rdma.c | 30 ++++++++++++++++-------------- 5 files changed, 71 insertions(+), 17 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index 7134d4ce47..0db115ec5e 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -806,7 +806,7 @@ # # Features: # -# @unstable: Members @x-checkpoint-delay and +# @unstable: Members @x-checkpoint-delay, @x-rdma-chunk-size, and # @x-vcpu-dirty-limit-period are experimental. # # Since: 2.4 @@ -831,6 +831,7 @@ 'mode', 'zero-page-detection', 'direct-io', + { 'name': 'x-rdma-chunk-size', 'features': [ 'unstable' ] }, 'cpr-exec-command'] } =20 ## @@ -1007,9 +1008,15 @@ # is @cpr-exec. The first list element is the program's filename, # the remainder its arguments. (Since 10.2) # +# @x-rdma-chunk-size: RDMA memory registration chunk size in bytes. +# Default is 1MiB. Must be a power of 2 in the range +# [1MiB, 1024MiB]. Only applies when migrating via RDMA. +# Must be set to the same value on both source and destination +# before migration starts. (Since 11.1) +# # Features: # -# @unstable: Members @x-checkpoint-delay and +# @unstable: Members @x-checkpoint-delay, @x-rdma-chunk-size, and # @x-vcpu-dirty-limit-period are experimental. # # Since: 2.4 @@ -1046,6 +1053,8 @@ '*mode': 'MigMode', '*zero-page-detection': 'ZeroPageDetection', '*direct-io': 'bool', + '*x-rdma-chunk-size': { 'type': 'uint64', + 'features': [ 'unstable' ] }, '*cpr-exec-command': [ 'str' ]} } =20 ## diff --git a/migration/options.h b/migration/options.h index b502871097..b46221998a 100644 --- a/migration/options.h +++ b/migration/options.h @@ -87,6 +87,7 @@ const char *migrate_tls_creds(void); const char *migrate_tls_hostname(void); uint64_t migrate_xbzrle_cache_size(void); ZeroPageDetection migrate_zero_page_detection(void); +uint64_t migrate_rdma_chunk_size(void); =20 /* parameters helpers */ =20 diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c index 0a193b8f54..4f6c1dbf89 100644 --- a/migration/migration-hmp-cmds.c +++ b/migration/migration-hmp-cmds.c @@ -451,6 +451,13 @@ void hmp_info_migrate_parameters(Monitor *mon, const Q= Dict *qdict) params->direct_io ? "on" : "off"); } =20 + if (params->has_x_rdma_chunk_size) { + monitor_printf(mon, "%s: %" PRIu64 " bytes\n", + MigrationParameter_str( + MIGRATION_PARAMETER_X_RDMA_CHUNK_SIZE), + params->x_rdma_chunk_size); + } + assert(params->has_cpr_exec_command); monitor_print_cpr_exec_command(mon, params->cpr_exec_command); } @@ -734,6 +741,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDi= ct *qdict) p->has_direct_io =3D true; visit_type_bool(v, param, &p->direct_io, &err); break; + case MIGRATION_PARAMETER_X_RDMA_CHUNK_SIZE: + p->has_x_rdma_chunk_size =3D true; + visit_type_size(v, param, &p->x_rdma_chunk_size, &err); + break; case MIGRATION_PARAMETER_CPR_EXEC_COMMAND: { /* * NOTE: g_autofree will only auto g_free() the strv array when diff --git a/migration/options.c b/migration/options.c index 68441f0276..5cbfd29099 100644 --- a/migration/options.c +++ b/migration/options.c @@ -13,6 +13,7 @@ =20 #include "qemu/osdep.h" #include "qemu/error-report.h" +#include "qemu/units.h" #include "exec/target_page.h" #include "qapi/clone-visitor.h" #include "qapi/error.h" @@ -90,6 +91,7 @@ const PropertyInfo qdev_prop_StrOrNull; =20 #define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD 1000 /* millisecond= s */ #define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT 1 /* MB/s */ +#define DEFAULT_MIGRATE_X_RDMA_CHUNK_SIZE MiB =20 const Property migration_properties[] =3D { DEFINE_PROP_BOOL("store-global-state", MigrationState, @@ -183,6 +185,9 @@ const Property migration_properties[] =3D { DEFINE_PROP_ZERO_PAGE_DETECTION("zero-page-detection", MigrationState, parameters.zero_page_detection, ZERO_PAGE_DETECTION_MULTIFD), + DEFINE_PROP_UINT64("x-rdma-chunk-size", MigrationState, + parameters.x_rdma_chunk_size, + DEFAULT_MIGRATE_X_RDMA_CHUNK_SIZE), =20 /* Migration capabilities */ DEFINE_PROP_MIG_CAP("x-xbzrle", MIGRATION_CAPABILITY_XBZRLE), @@ -1000,6 +1005,15 @@ ZeroPageDetection migrate_zero_page_detection(void) return s->parameters.zero_page_detection; } =20 +uint64_t migrate_rdma_chunk_size(void) +{ + MigrationState *s =3D migrate_get_current(); + uint64_t size =3D s->parameters.x_rdma_chunk_size; + + assert(MiB <=3D size && size <=3D GiB && is_power_of_2(size)); + return size; +} + /* parameters helpers */ =20 AnnounceParameters *migrate_announce_params(void) @@ -1062,7 +1076,7 @@ static void migrate_mark_all_params_present(Migration= Parameters *p) &p->has_announce_step, &p->has_block_bitmap_mapping, &p->has_x_vcpu_dirty_limit_period, &p->has_vcpu_dirty_limit, &p->has_mode, &p->has_zero_page_detection, &p->has_direct_io, - &p->has_cpr_exec_command, + &p->has_x_rdma_chunk_size, &p->has_cpr_exec_command, }; =20 len =3D ARRAY_SIZE(has_fields); @@ -1273,6 +1287,15 @@ bool migrate_params_check(MigrationParameters *param= s, Error **errp) return false; } =20 + if (params->has_x_rdma_chunk_size && + (params->x_rdma_chunk_size < MiB || + params->x_rdma_chunk_size > GiB || + !is_power_of_2(params->x_rdma_chunk_size))) { + error_setg(errp, "Option x_rdma_chunk_size expects " + "a power of 2 in the range 1MiB to 1024MiB"); + return false; + } + return true; } =20 @@ -1393,6 +1416,10 @@ static void migrate_params_test_apply(MigrationParam= eters *params, dest->direct_io =3D params->direct_io; } =20 + if (params->has_x_rdma_chunk_size) { + dest->x_rdma_chunk_size =3D params->x_rdma_chunk_size; + } + if (params->has_cpr_exec_command) { qapi_free_strList(dest->cpr_exec_command); dest->cpr_exec_command =3D QAPI_CLONE(strList, params->cpr_exec_co= mmand); @@ -1520,6 +1547,10 @@ static void migrate_params_apply(MigrationParameters= *params) s->parameters.direct_io =3D params->direct_io; } =20 + if (params->has_x_rdma_chunk_size) { + s->parameters.x_rdma_chunk_size =3D params->x_rdma_chunk_size; + } + if (params->has_cpr_exec_command) { qapi_free_strList(s->parameters.cpr_exec_command); s->parameters.cpr_exec_command =3D diff --git a/migration/rdma.c b/migration/rdma.c index 55ab85650a..3e37a1d440 100644 --- a/migration/rdma.c +++ b/migration/rdma.c @@ -45,10 +45,12 @@ #define RDMA_RESOLVE_TIMEOUT_MS 10000 =20 /* Do not merge data if larger than this. */ -#define RDMA_MERGE_MAX (2 * 1024 * 1024) -#define RDMA_SIGNALED_SEND_MAX (RDMA_MERGE_MAX / 4096) +static inline uint64_t rdma_merge_max(void) +{ + return migrate_rdma_chunk_size() * 2; +} =20 -#define RDMA_REG_CHUNK_SHIFT 20 /* 1 MB */ +#define RDMA_SIGNALED_SEND_MAX 512 =20 /* * This is only for non-live state being migrated. @@ -527,21 +529,21 @@ static int qemu_rdma_exchange_send(RDMAContext *rdma,= RDMAControlHeader *head, static inline uint64_t ram_chunk_index(const uint8_t *start, const uint8_t *host) { - return ((uintptr_t) host - (uintptr_t) start) >> RDMA_REG_CHUNK_SHIFT; + return ((uintptr_t) host - (uintptr_t) start) / migrate_rdma_chunk_siz= e(); } =20 static inline uint8_t *ram_chunk_start(const RDMALocalBlock *rdma_ram_bloc= k, uint64_t i) { return (uint8_t *)(uintptr_t)(rdma_ram_block->local_host_addr + - (i << RDMA_REG_CHUNK_SHIFT)); + (i * migrate_rdma_chunk_size())); } =20 static inline uint8_t *ram_chunk_end(const RDMALocalBlock *rdma_ram_block, uint64_t i) { uint8_t *result =3D ram_chunk_start(rdma_ram_block, i) + - (1UL << RDMA_REG_CHUNK_SHIFT); + migrate_rdma_chunk_size(); =20 if (result > (rdma_ram_block->local_host_addr + rdma_ram_block->length= )) { result =3D rdma_ram_block->local_host_addr + rdma_ram_block->lengt= h; @@ -1841,6 +1843,7 @@ static int qemu_rdma_write_one(RDMAContext *rdma, struct ibv_send_wr *bad_wr; int reg_result_idx, ret, count =3D 0; uint64_t chunk, chunks; + uint64_t chunk_size =3D migrate_rdma_chunk_size(); uint8_t *chunk_start, *chunk_end; RDMALocalBlock *block =3D &(rdma->local_ram_blocks.block[current_index= ]); RDMARegister reg; @@ -1861,22 +1864,21 @@ retry: chunk_start =3D ram_chunk_start(block, chunk); =20 if (block->is_ram_block) { - chunks =3D length / (1UL << RDMA_REG_CHUNK_SHIFT); + chunks =3D length / chunk_size; =20 - if (chunks && ((length % (1UL << RDMA_REG_CHUNK_SHIFT)) =3D=3D 0))= { + if (chunks && ((length % chunk_size) =3D=3D 0)) { chunks--; } } else { - chunks =3D block->length / (1UL << RDMA_REG_CHUNK_SHIFT); + chunks =3D block->length / chunk_size; =20 - if (chunks && ((block->length % (1UL << RDMA_REG_CHUNK_SHIFT)) =3D= =3D 0)) { + if (chunks && ((block->length % chunk_size) =3D=3D 0)) { chunks--; } } =20 trace_qemu_rdma_write_one_top(chunks + 1, - (chunks + 1) * - (1UL << RDMA_REG_CHUNK_SHIFT) / 1024 / 1= 024); + (chunks + 1) * chunk_size / 1024 / 1024); =20 chunk_end =3D ram_chunk_end(block, chunk + chunks); =20 @@ -2176,7 +2178,7 @@ static int qemu_rdma_write(RDMAContext *rdma, rdma->current_length +=3D len; =20 /* flush it if buffer is too large */ - if (rdma->current_length >=3D RDMA_MERGE_MAX) { + if (rdma->current_length >=3D rdma_merge_max()) { return qemu_rdma_write_flush(rdma, errp); } =20 @@ -3522,7 +3524,7 @@ int rdma_registration_handle(QEMUFile *f) } else { chunk =3D reg->key.chunk; host_addr =3D block->local_host_addr + - (reg->key.chunk * (1UL << RDMA_REG_CHUNK_SHIFT)); + (reg->key.chunk * migrate_rdma_chunk_size()); /* Check for particularly bad chunk value */ if (host_addr < (void *)block->local_host_addr) { error_report("rdma: bad chunk for block %s" --=20 2.53.0