get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/2222581/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2222581,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/2222581/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260413035703.2602065-1-guoqing.zhang@amd.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260413035703.2602065-1-guoqing.zhang@amd.com>",
    "list_archive_url": null,
    "date": "2026-04-13T03:57:03",
    "name": "[v5] migration/rdma: add x-rdma-chunk-size parameter",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "afb411c5d33bfa7edca8fab86431dacc1a27c4b2",
    "submitter": {
        "id": 92875,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/92875/?format=api",
        "name": "Samuel Zhang",
        "email": "guoqing.zhang@amd.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260413035703.2602065-1-guoqing.zhang@amd.com/mbox/",
    "series": [
        {
            "id": 499641,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/499641/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=499641",
            "date": "2026-04-13T03:57:03",
            "name": "[v5] migration/rdma: add x-rdma-chunk-size parameter",
            "version": 5,
            "mbox": "http://patchwork.ozlabs.org/series/499641/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2222581/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2222581/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256\n header.s=selector1 header.b=Z4i23cXW;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"
        ],
        "Received": [
            "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fvDMJ2rb3z1yDF\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 13 Apr 2026 14:04:58 +1000 (AEST)",
            "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wC8XP-0004Sw-Lw; Mon, 13 Apr 2026 00:04:39 -0400",
            "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <GuoQing.Zhang@amd.com>)\n id 1wC8XJ-0004Sd-FX\n for qemu-devel@nongnu.org; Mon, 13 Apr 2026 00:04:34 -0400",
            "from mail-eastus2azon11011051.outbound.protection.outlook.com\n ([52.101.57.51] helo=BN8PR05CU002.outbound.protection.outlook.com)\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <GuoQing.Zhang@amd.com>)\n id 1wC8XG-0003Ly-TB\n for qemu-devel@nongnu.org; Mon, 13 Apr 2026 00:04:33 -0400",
            "from MN0PR03CA0005.namprd03.prod.outlook.com (2603:10b6:208:52f::12)\n by MW4PR12MB6681.namprd12.prod.outlook.com (2603:10b6:303:1e1::6)\n with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.46; Mon, 13 Apr\n 2026 03:59:21 +0000",
            "from BN3PEPF0000B06B.namprd21.prod.outlook.com\n (2603:10b6:208:52f:cafe::5f) by MN0PR03CA0005.outlook.office365.com\n (2603:10b6:208:52f::12) with Microsoft SMTP Server (version=TLS1_3,\n cipher=TLS_AES_256_GCM_SHA384) id 15.20.9769.48 via Frontend Transport; Mon,\n 13 Apr 2026 03:59:20 +0000",
            "from satlexmb07.amd.com (165.204.84.17) by\n BN3PEPF0000B06B.mail.protection.outlook.com (10.167.243.70) with Microsoft\n SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.20.9846.0 via Frontend Transport; Mon, 13 Apr 2026 03:59:20 +0000",
            "from hjbog-srdc-36.amd.com (10.180.168.240) by satlexmb07.amd.com\n (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Sun, 12 Apr\n 2026 22:59:17 -0500"
        ],
        "ARC-Seal": "i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n b=ENFZ/qQ+CI92g76eSVkrIcAqnEQZ8Yc4W1Nk7PfrkmReH5Ljpd1pHoAB12ADpvVDVWpRL5jVrY6PxhHZdAyIeiAgNWj3LPGaafndpLK7y1uoVso7H47qqImg1uDWmS1+jPeBOwd0ENd4HWFiLsnCDmnkKAlmIyg2tzfBM8XPsw/C7YJ8HOUhVy1OYWKIk3LOYcH5Pv83z+Ux7WsJ3kG1WiW0CBh4Y4RyfzldohSTwjoojn/D1H8UYv6XzG1is9XRQufDRZNpSwUi7L/FPMty9JHIMsm3xD3uWu9ZhUn3LlAWHS8nkJLZPcy3L1kaAJ/VMdnsMifbFMS2ZVqLAccj4Q==",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector10001;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n bh=FHHsw3oSSF1Yhxk3MroG1RBNWUtJghj0HKZM38JEpLk=;\n b=NV3OvV8K8oQAzNRRaiFVq/TcDtKh3hJthGHMDuidGj5g5BRv8NqKVPxwaNgR1iHAaGIHa/r0PE/ffCbxcMOl02vFMyDLpG8Xb+qO8CwZh7JaEPs/77mJYWzyxtB/y9fvtdssVsKHF5c4/wi+9wGu5R5vS3XUzoFCyYNZ+PO9C5h/jIL4TNgqfjaoDaoc4if08++IDPEHImHJ1wIMRnXPEXWiQgWdFlembtMQ/YkKiqbh5jpsow4O0Rh2mHiRSj33IJR+/DNA1MvhZ5qVxnogWBf0YeyKI/EeWofNDNdnptpuvDgBfKwGtNUYWaCFJquBAU/QhfL6rwDxEGi0a11UUQ==",
        "ARC-Authentication-Results": "i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 165.204.84.17) smtp.rcpttodomain=nongnu.org smtp.mailfrom=amd.com; dmarc=pass\n (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com;\n dkim=none (message not signed); arc=none (0)",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=FHHsw3oSSF1Yhxk3MroG1RBNWUtJghj0HKZM38JEpLk=;\n b=Z4i23cXWRW0QkeUYQ2XUqTDcGslvdWGTKYghB+uKamiow3oF6ErVOYbFY2xIrY4h5ay//gql8EHvqJLeFHciVv4XzC55YH1me8x26W95qwernZ/KYE5u1B+mt2Sn3pH7+jsYosnIRP9ClEjhq1m68FWBhriVvASW0mf6gMFV/A4=",
        "X-MS-Exchange-Authentication-Results": "spf=pass (sender IP is 165.204.84.17)\n smtp.mailfrom=amd.com; dkim=none (message not signed)\n header.d=none;dmarc=pass action=none header.from=amd.com;",
        "Received-SPF": [
            "Pass (protection.outlook.com: domain of amd.com designates\n 165.204.84.17 as permitted sender) receiver=protection.outlook.com;\n client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C",
            "permerror client-ip=52.101.57.51;\n envelope-from=GuoQing.Zhang@amd.com;\n helo=BN8PR05CU002.outbound.protection.outlook.com"
        ],
        "From": "Samuel Zhang <guoqing.zhang@amd.com>",
        "To": "<qemu-devel@nongnu.org>",
        "CC": "<peterx@redhat.com>, <farosas@suse.de>, <lizhijian@fujitsu.com>,\n <eblake@redhat.com>, <armbru@redhat.com>, <Emily.Deng@amd.com>,\n <Victor.Zhao@amd.com>, <PengJu.Zhou@amd.com>, <Qing.Ma@amd.com>, Samuel Zhang\n <guoqing.zhang@amd.com>",
        "Subject": "[PATCH v5] migration/rdma: add x-rdma-chunk-size parameter",
        "Date": "Mon, 13 Apr 2026 11:57:03 +0800",
        "Message-ID": "<20260413035703.2602065-1-guoqing.zhang@amd.com>",
        "X-Mailer": "git-send-email 2.43.7",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.180.168.240]",
        "X-ClientProxiedBy": "satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com\n (10.181.42.216)",
        "X-EOPAttributedMessage": "0",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-TrafficTypeDiagnostic": "BN3PEPF0000B06B:EE_|MW4PR12MB6681:EE_",
        "X-MS-Office365-Filtering-Correlation-Id": "958d2796-f243-409a-4c38-08de99110a8f",
        "X-MS-Exchange-SenderADCheck": "1",
        "X-MS-Exchange-AntiSpam-Relay": "0",
        "X-Microsoft-Antispam": "BCL:0;\n ARA:13230040|36860700016|82310400026|1800799024|376014|56012099003|18002099003;",
        "X-Microsoft-Antispam-Message-Info": "\n 1OMTBkq4FTXEaXhnYLflnI+4LE0z6S12LlhD+SvhEm34OF5IMWIgtqDNTAr8dn/1/wiJw+AA69nCUsftUtQ51GsgSBl+E3NJPOaXtcElYX/TrIn5yS3GM7yuktLIJ3EkWuqERO0cZxKdWvcan2sOr6m+6uy6UIlmkXZ/iLXyq3PxP3H5jK3XQeB9jn1czSbjOARafKxy1l0w4p00KHNppPR6HQSmSU++9SA1j9h3R6O2WxNAigghSw+Tdjq1S3N3iM//m592L1U4Gov8nbuy/O13uAncKwlfgJqatgbKuDB8+ix47MSKtow+RY2zdoWxYIpvaodM8SxHRbgQ3n9jO0Xig2jyA6DiJM4pLmPajDzHatNJHNGkGjv47sHpCSq6ZhdHx+13SXIdIWMrCxskC5NtWikXhn11rcmU99fVMj5IKtGyTAOPyQmSXN7zfYSkDcToOMGrjUSNE5Mn6AYG4mbA2XDMdjBWIbKEJwYk//8FVfWOAp+3WYCxiHJOB0tcaMLk9Bq03S626tyR2+eMcs8uV/z0x4gf6yejXkAd8dWnE4Shgqym/MHtdi0KMRbnru+4EGmmpPMJlMwZUClJ0vneL/t3FAEhp9PWgZ4TD7F5PmFpjSgRDs5rWsOxsSblUSZCB16HbJkyaadFEF0QPCVS7eziwSNCSc7JNJ1h2EQ+ohjw26EGacOC37ZeWSxuy2fgznTlKCB+EZJwxQ/P58cY1llgV4m8OwfTAakzgY3+x4g6GkjGQxK0wkYERNlqLDEQEn7G8u3PI6e7IKClbg==",
        "X-Forefront-Antispam-Report": "CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:;\n IPV:NLI; SFV:NSPM; H:satlexmb07.amd.com; PTR:InfoDomainNonexistent; CAT:NONE;\n SFS:(13230040)(36860700016)(82310400026)(1800799024)(376014)(56012099003)(18002099003);\n DIR:OUT; SFP:1101;",
        "X-MS-Exchange-AntiSpam-MessageData-ChunkCount": "1",
        "X-MS-Exchange-AntiSpam-MessageData-0": "\n HWm4U6q4B4Q8DwebXXLqIK6BZYIvo6yNDtpPnJZTO8zpcHnyxDCQfGm+SSRWB9CqFQXfW4ILWXyO5voDDdlJS49wNtdyv7d9IufRzgewYSyJGio5/Vlf6iKfdTFH9Eq3BOo7H7JWAn0OTSWsgUG9xfQpzQoRGCU3Bm9m8RdURPxDCjYs4b4/chsjqONCR3/e5wY6tX4bZ/FmN+eDJwTXThIf1TaKaNh1JcxaAJyLVBwSONamLcgDPbMVWlGHqJjRTkvZNy6Hh3IvOcZfENHuGwJnu6IWeCshDso0oE9Z9etoEOnLJbFPSzB8t1k6H6pI+bn5iWZ05cAgt3qS6kZBD92B1agLJrVtd/KIcveCOqIAEq0d8n1Tk8gvp0/nmp0PC+PrInH5pC8pScy/EE0ede1hEKC0l2+sNiyZgEua5Cq2s212nwknXtT3T22nuIzu",
        "X-OriginatorOrg": "amd.com",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "13 Apr 2026 03:59:20.3430 (UTC)",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n 958d2796-f243-409a-4c38-08de99110a8f",
        "X-MS-Exchange-CrossTenant-Id": "3dd8961f-e488-4e60-8e11-a82d994e183d",
        "X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp": "\n TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17];\n Helo=[satlexmb07.amd.com]",
        "X-MS-Exchange-CrossTenant-AuthSource": "\n BN3PEPF0000B06B.namprd21.prod.outlook.com",
        "X-MS-Exchange-CrossTenant-AuthAs": "Anonymous",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "MW4PR12MB6681",
        "X-Spam_score_int": "-25",
        "X-Spam_score": "-2.6",
        "X-Spam_bar": "--",
        "X-Spam_report": "(-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n 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 <qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"
    },
    "content": "The default 1MB RDMA chunk size causes slow live migration because\neach chunk triggers a write_flush (ibv_post_send). For 8GB RAM,\n1MB chunk size produces ~15000 flushes vs ~3700 with 1024MB chunk size.\n\nAdd x-rdma-chunk-size parameter to configure the RDMA chunk size for\nfaster migration.\nUsage: `migrate_set_parameter x-rdma-chunk-size 1024M`\n\nPerformance with RDMA live migration of 8GB RAM VM:\n\n| x-rdma-chunk-size (B) | time (s) | throughput (MB/s) |\n|-----------------------|----------|-------------------|\n| 1M (default)          | 37.915   |  1,007            |\n| 32M                   | 17.880   |  2,260            |\n| 1024M                 |  4.368   | 17,529            |\n\nSigned-off-by: Samuel Zhang <guoqing.zhang@amd.com>\nAcked-by: Markus Armbruster <armbru@redhat.com>\nAcked-by: Li Zhijian <lizhijian@fujitsu.com>\nTested-by: Li Zhijian <lizhijian@fujitsu.com>\n---\nv2:\n- Renamed x-rdma-chunk-shift to x-rdma-chunk-size (byte count)\n- Added validation in migrate_params_check()\n- Added hmp_migrate_set_parameter() support\n- Added hmp_info_migrate_parameters() support\n- Added migrate_mark_all_params_present()\n- Use qemu_strtosz() for size suffix support\nv3: [Markus]\n- Use visit_type_size() in HMP set parameter\n- Use MiB/GiB constants\nv4: [Markus]\n- Remove superfluous comment on DEFAULT_MIGRATE_X_RDMA_CHUNK_SIZE\n- Use \"Only applies when migrating via RDMA\" in QAPI doc\nv5:\n- Document that x-rdma-chunk-size must be set to the same value on both\n    source and destination before migration starts.\n- Add Acked-by and Tested-by from Li Zhijian.\n\n migration/migration-hmp-cmds.c | 11 +++++++++++\n migration/options.c            | 33 ++++++++++++++++++++++++++++++++-\n migration/options.h            |  1 +\n migration/rdma.c               | 30 ++++++++++++++++--------------\n qapi/migration.json            | 13 +++++++++++--\n 5 files changed, 71 insertions(+), 17 deletions(-)",
    "diff": "diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c\nindex 0a193b8f54..4f6c1dbf89 100644\n--- a/migration/migration-hmp-cmds.c\n+++ b/migration/migration-hmp-cmds.c\n@@ -451,6 +451,13 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)\n                            params->direct_io ? \"on\" : \"off\");\n         }\n \n+        if (params->has_x_rdma_chunk_size) {\n+            monitor_printf(mon, \"%s: %\" PRIu64 \" bytes\\n\",\n+                           MigrationParameter_str(\n+                               MIGRATION_PARAMETER_X_RDMA_CHUNK_SIZE),\n+                           params->x_rdma_chunk_size);\n+        }\n+\n         assert(params->has_cpr_exec_command);\n         monitor_print_cpr_exec_command(mon, params->cpr_exec_command);\n     }\n@@ -734,6 +741,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)\n         p->has_direct_io = true;\n         visit_type_bool(v, param, &p->direct_io, &err);\n         break;\n+    case MIGRATION_PARAMETER_X_RDMA_CHUNK_SIZE:\n+        p->has_x_rdma_chunk_size = true;\n+        visit_type_size(v, param, &p->x_rdma_chunk_size, &err);\n+        break;\n     case MIGRATION_PARAMETER_CPR_EXEC_COMMAND: {\n         /*\n          * NOTE: g_autofree will only auto g_free() the strv array when\ndiff --git a/migration/options.c b/migration/options.c\nindex 7556fbc06b..2b5158200b 100644\n--- a/migration/options.c\n+++ b/migration/options.c\n@@ -13,6 +13,7 @@\n \n #include \"qemu/osdep.h\"\n #include \"qemu/error-report.h\"\n+#include \"qemu/units.h\"\n #include \"exec/target_page.h\"\n #include \"qapi/clone-visitor.h\"\n #include \"qapi/error.h\"\n@@ -90,6 +91,7 @@ const PropertyInfo qdev_prop_StrOrNull;\n \n #define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT_PERIOD     1000    /* milliseconds */\n #define DEFAULT_MIGRATE_VCPU_DIRTY_LIMIT            1       /* MB/s */\n+#define DEFAULT_MIGRATE_X_RDMA_CHUNK_SIZE           MiB\n \n const Property migration_properties[] = {\n     DEFINE_PROP_BOOL(\"store-global-state\", MigrationState,\n@@ -183,6 +185,9 @@ const Property migration_properties[] = {\n     DEFINE_PROP_ZERO_PAGE_DETECTION(\"zero-page-detection\", MigrationState,\n                        parameters.zero_page_detection,\n                        ZERO_PAGE_DETECTION_MULTIFD),\n+    DEFINE_PROP_UINT64(\"x-rdma-chunk-size\", MigrationState,\n+                      parameters.x_rdma_chunk_size,\n+                      DEFAULT_MIGRATE_X_RDMA_CHUNK_SIZE),\n \n     /* Migration capabilities */\n     DEFINE_PROP_MIG_CAP(\"x-xbzrle\", MIGRATION_CAPABILITY_XBZRLE),\n@@ -1000,6 +1005,15 @@ ZeroPageDetection migrate_zero_page_detection(void)\n     return s->parameters.zero_page_detection;\n }\n \n+uint64_t migrate_rdma_chunk_size(void)\n+{\n+    MigrationState *s = migrate_get_current();\n+    uint64_t size = s->parameters.x_rdma_chunk_size;\n+\n+    assert(MiB <= size && size <= GiB && is_power_of_2(size));\n+    return size;\n+}\n+\n /* parameters helpers */\n \n AnnounceParameters *migrate_announce_params(void)\n@@ -1062,7 +1076,7 @@ static void migrate_mark_all_params_present(MigrationParameters *p)\n         &p->has_announce_step, &p->has_block_bitmap_mapping,\n         &p->has_x_vcpu_dirty_limit_period, &p->has_vcpu_dirty_limit,\n         &p->has_mode, &p->has_zero_page_detection, &p->has_direct_io,\n-        &p->has_cpr_exec_command,\n+        &p->has_x_rdma_chunk_size, &p->has_cpr_exec_command,\n     };\n \n     len = ARRAY_SIZE(has_fields);\n@@ -1273,6 +1287,15 @@ bool migrate_params_check(MigrationParameters *params, Error **errp)\n         return false;\n     }\n \n+    if (params->has_x_rdma_chunk_size &&\n+        (params->x_rdma_chunk_size < MiB ||\n+         params->x_rdma_chunk_size > GiB ||\n+         !is_power_of_2(params->x_rdma_chunk_size))) {\n+        error_setg(errp, \"Option x_rdma_chunk_size expects \"\n+                   \"a power of 2 in the range 1MiB to 1024MiB\");\n+        return false;\n+    }\n+\n     return true;\n }\n \n@@ -1398,6 +1421,10 @@ static void migrate_params_test_apply(MigrationParameters *params,\n         dest->direct_io = params->direct_io;\n     }\n \n+    if (params->has_x_rdma_chunk_size) {\n+        dest->x_rdma_chunk_size = params->x_rdma_chunk_size;\n+    }\n+\n     if (params->has_cpr_exec_command) {\n         dest->cpr_exec_command = params->cpr_exec_command;\n     }\n@@ -1524,6 +1551,10 @@ static void migrate_params_apply(MigrationParameters *params)\n         s->parameters.direct_io = params->direct_io;\n     }\n \n+    if (params->has_x_rdma_chunk_size) {\n+        s->parameters.x_rdma_chunk_size = params->x_rdma_chunk_size;\n+    }\n+\n     if (params->has_cpr_exec_command) {\n         qapi_free_strList(s->parameters.cpr_exec_command);\n         s->parameters.cpr_exec_command =\ndiff --git a/migration/options.h b/migration/options.h\nindex b502871097..b46221998a 100644\n--- a/migration/options.h\n+++ b/migration/options.h\n@@ -87,6 +87,7 @@ const char *migrate_tls_creds(void);\n const char *migrate_tls_hostname(void);\n uint64_t migrate_xbzrle_cache_size(void);\n ZeroPageDetection migrate_zero_page_detection(void);\n+uint64_t migrate_rdma_chunk_size(void);\n \n /* parameters helpers */\n \ndiff --git a/migration/rdma.c b/migration/rdma.c\nindex 55ab85650a..3e37a1d440 100644\n--- a/migration/rdma.c\n+++ b/migration/rdma.c\n@@ -45,10 +45,12 @@\n #define RDMA_RESOLVE_TIMEOUT_MS 10000\n \n /* Do not merge data if larger than this. */\n-#define RDMA_MERGE_MAX (2 * 1024 * 1024)\n-#define RDMA_SIGNALED_SEND_MAX (RDMA_MERGE_MAX / 4096)\n+static inline uint64_t rdma_merge_max(void)\n+{\n+    return migrate_rdma_chunk_size() * 2;\n+}\n \n-#define RDMA_REG_CHUNK_SHIFT 20 /* 1 MB */\n+#define RDMA_SIGNALED_SEND_MAX 512\n \n /*\n  * This is only for non-live state being migrated.\n@@ -527,21 +529,21 @@ static int qemu_rdma_exchange_send(RDMAContext *rdma, RDMAControlHeader *head,\n static inline uint64_t ram_chunk_index(const uint8_t *start,\n                                        const uint8_t *host)\n {\n-    return ((uintptr_t) host - (uintptr_t) start) >> RDMA_REG_CHUNK_SHIFT;\n+    return ((uintptr_t) host - (uintptr_t) start) / migrate_rdma_chunk_size();\n }\n \n static inline uint8_t *ram_chunk_start(const RDMALocalBlock *rdma_ram_block,\n                                        uint64_t i)\n {\n     return (uint8_t *)(uintptr_t)(rdma_ram_block->local_host_addr +\n-                                  (i << RDMA_REG_CHUNK_SHIFT));\n+                                  (i * migrate_rdma_chunk_size()));\n }\n \n static inline uint8_t *ram_chunk_end(const RDMALocalBlock *rdma_ram_block,\n                                      uint64_t i)\n {\n     uint8_t *result = ram_chunk_start(rdma_ram_block, i) +\n-                                         (1UL << RDMA_REG_CHUNK_SHIFT);\n+                                         migrate_rdma_chunk_size();\n \n     if (result > (rdma_ram_block->local_host_addr + rdma_ram_block->length)) {\n         result = rdma_ram_block->local_host_addr + rdma_ram_block->length;\n@@ -1841,6 +1843,7 @@ static int qemu_rdma_write_one(RDMAContext *rdma,\n     struct ibv_send_wr *bad_wr;\n     int reg_result_idx, ret, count = 0;\n     uint64_t chunk, chunks;\n+    uint64_t chunk_size = migrate_rdma_chunk_size();\n     uint8_t *chunk_start, *chunk_end;\n     RDMALocalBlock *block = &(rdma->local_ram_blocks.block[current_index]);\n     RDMARegister reg;\n@@ -1861,22 +1864,21 @@ retry:\n     chunk_start = ram_chunk_start(block, chunk);\n \n     if (block->is_ram_block) {\n-        chunks = length / (1UL << RDMA_REG_CHUNK_SHIFT);\n+        chunks = length / chunk_size;\n \n-        if (chunks && ((length % (1UL << RDMA_REG_CHUNK_SHIFT)) == 0)) {\n+        if (chunks && ((length % chunk_size) == 0)) {\n             chunks--;\n         }\n     } else {\n-        chunks = block->length / (1UL << RDMA_REG_CHUNK_SHIFT);\n+        chunks = block->length / chunk_size;\n \n-        if (chunks && ((block->length % (1UL << RDMA_REG_CHUNK_SHIFT)) == 0)) {\n+        if (chunks && ((block->length % chunk_size) == 0)) {\n             chunks--;\n         }\n     }\n \n     trace_qemu_rdma_write_one_top(chunks + 1,\n-                                  (chunks + 1) *\n-                                  (1UL << RDMA_REG_CHUNK_SHIFT) / 1024 / 1024);\n+                                  (chunks + 1) * chunk_size / 1024 / 1024);\n \n     chunk_end = ram_chunk_end(block, chunk + chunks);\n \n@@ -2176,7 +2178,7 @@ static int qemu_rdma_write(RDMAContext *rdma,\n     rdma->current_length += len;\n \n     /* flush it if buffer is too large */\n-    if (rdma->current_length >= RDMA_MERGE_MAX) {\n+    if (rdma->current_length >= rdma_merge_max()) {\n         return qemu_rdma_write_flush(rdma, errp);\n     }\n \n@@ -3522,7 +3524,7 @@ int rdma_registration_handle(QEMUFile *f)\n                 } else {\n                     chunk = reg->key.chunk;\n                     host_addr = block->local_host_addr +\n-                        (reg->key.chunk * (1UL << RDMA_REG_CHUNK_SHIFT));\n+                        (reg->key.chunk * migrate_rdma_chunk_size());\n                     /* Check for particularly bad chunk value */\n                     if (host_addr < (void *)block->local_host_addr) {\n                         error_report(\"rdma: bad chunk for block %s\"\ndiff --git a/qapi/migration.json b/qapi/migration.json\nindex 7134d4ce47..0db115ec5e 100644\n--- a/qapi/migration.json\n+++ b/qapi/migration.json\n@@ -806,7 +806,7 @@\n #\n # Features:\n #\n-# @unstable: Members @x-checkpoint-delay and\n+# @unstable: Members @x-checkpoint-delay, @x-rdma-chunk-size, and\n #     @x-vcpu-dirty-limit-period are experimental.\n #\n # Since: 2.4\n@@ -831,6 +831,7 @@\n            'mode',\n            'zero-page-detection',\n            'direct-io',\n+           { 'name': 'x-rdma-chunk-size', 'features': [ 'unstable' ] },\n            'cpr-exec-command'] }\n \n ##\n@@ -1007,9 +1008,15 @@\n #     is @cpr-exec.  The first list element is the program's filename,\n #     the remainder its arguments.  (Since 10.2)\n #\n+# @x-rdma-chunk-size: RDMA memory registration chunk size in bytes.\n+#     Default is 1MiB.  Must be a power of 2 in the range\n+#     [1MiB, 1024MiB].  Only applies when migrating via RDMA.\n+#     Must be set to the same value on both source and destination\n+#     before migration starts.  (Since 11.1)\n+#\n # Features:\n #\n-# @unstable: Members @x-checkpoint-delay and\n+# @unstable: Members @x-checkpoint-delay, @x-rdma-chunk-size, and\n #     @x-vcpu-dirty-limit-period are experimental.\n #\n # Since: 2.4\n@@ -1046,6 +1053,8 @@\n             '*mode': 'MigMode',\n             '*zero-page-detection': 'ZeroPageDetection',\n             '*direct-io': 'bool',\n+            '*x-rdma-chunk-size': { 'type': 'uint64',\n+                                    'features': [ 'unstable' ] },\n             '*cpr-exec-command': [ 'str' ]} }\n \n ##\n",
    "prefixes": [
        "v5"
    ]
}