From nobody Wed Aug 26 07:25:35 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=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1786577627; cv=none; d=zohomail.com; s=zohoarc; b=ipGN9d2NTxUyPTjksFOkFtlNV5PWNSrgy1LGc0VcJ1erf0cgjLz/+OAqO+bNYApLUmYGnYRNcE8xFWH6vtHFfjgIxWKxYFB/Rd1//+VKlqjpMxAcLK5cgnTTWHAv8EYc5VP7MuXqOUz2HSs922mFR8H42ebWxhG1eNI2eZnmZWQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786577627; 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=yoriNxgu4uYyO7npXNIdPtll23yt1XBkmmKih2lxoik=; b=fQwDpWA61jr24a68qxx1j6sHGl77SPr0Bl2DJ/8JfjErzCx52hu1x+pFtrCyeNXwImoA+5+hJDaCQrxnP3HX4JfcRZ4wsXs+6JevKEJ2ZSbzdw7rMemKemgo6cyITueRtbnTJ87sE2oGygw4WP1qAOlgideVRAr9sQNRS5Sw3Y4= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17865776268081021.6098691240799; Wed, 12 Aug 2026 16:33:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wuIRJ-0004Qy-G0; Wed, 12 Aug 2026 19:32:53 -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 1wuIRF-0004Pa-Ky for qemu-devel@nongnu.org; Wed, 12 Aug 2026 19:32:50 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wuIRC-0001Rp-Fo for qemu-devel@nongnu.org; Wed, 12 Aug 2026 19:32:49 -0400 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67CEoluL882232; Wed, 12 Aug 2026 23:32:40 GMT Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4fwvfxynch-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Aug 2026 23:32:40 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 67CNTxUB017332; Wed, 12 Aug 2026 23:32:39 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4fwtwfngrg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Aug 2026 23:32:39 +0000 (GMT) Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 67CNWbHY025569; Wed, 12 Aug 2026 23:32:38 GMT Received: from localhost.localdomain (ca-dev80.us.oracle.com [10.211.9.80]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 4fwtwfngqu-2; Wed, 12 Aug 2026 23:32:38 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=yoriN xgu4uYyO7npXNIdPtll23yt1XBkmmKih2lxoik=; b=eWwAQpPZWBchgDXLFjnCZ XUTp+hh3h5Gi5NJYD2rfcabPxaYXFqGVkDqVItGScEVgRoIHCFYUbbw6iPG+oiCv EpwyFh4UadF+zXC8EDXFuVO9g+bYZA7V10NK2YI4Jq2j26WDy9xRPj7CIW4FIsCS R/5s8Zn7R+iHlCbAaIWvo9mrKvnZtDjfAI+7GPQGW61C7mrwnI9djLVOtynh56d7 oc/0svxQU13AMqv2/3x/6yR9FWLQMIEWb6kyzqvfwEuztVGtipsXR0CHHC3Tg1rc AIfdbiO+JPWlt4FwJwvHTEh7X7Bt2PC/Wf1/wmZdmK+RcfrKWe8AsHvmPq85DNLp Q== From: Dongli Zhang To: qemu-devel@nongnu.org Cc: peterx@redhat.com, farosas@suse.de, eblake@redhat.com, armbru@redhat.com, maciej.szmigiero@oracle.com, mark.kanda@oracle.com, bchaney@akamai.com, pierrick.bouvier@oss.qualcomm.com, joe.jin@oracle.com Subject: [PATCH 1/5] migration/qapi: Add memfd migration transport Date: Wed, 12 Aug 2026 16:27:46 -0700 Message-ID: <20260812232842.470225-2-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260812232842.470225-1-dongli.zhang@oracle.com> References: <20260812232842.470225-1-dongli.zhang@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-12_07,2026-08-12_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 spamscore=0 phishscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2606160000 definitions=main-2608120190 X-Proofpoint-GUID: Bl8_auSw0km3xOSWrG-yqzD31DiB8Aos X-Authority-Analysis: v=2.4 cv=K/sS2SWI c=1 sm=1 tr=0 ts=6a7d0298 cx=c_pps a=OOZaFjgC48PWsiFpTAqLcw==:117 a=OOZaFjgC48PWsiFpTAqLcw==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=3I1J8UUJPc9JN9BFgKH3:22 a=yPCof4ZbAAAA:8 a=1HexDGPBlmFBiWrkqnYA:9 X-Proofpoint-ORIG-GUID: Bl8_auSw0km3xOSWrG-yqzD31DiB8Aos X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODEyMDE5MCBTYWx0ZWRfX0R0lyVpqImkj FW3A8qkShGyo5Pp3x1GP9PppfPLxSEPXzAqy0VcNcUiKiR7sxqUHm6bFPyzlKT4gkLUbVmJB5dV R25AwNvpVC8F2PJ5k8dGlAjQ+Xh7uHTBK9essSVae8iZqTz4j/l5ogk6k5MbaJ/kcAisYxgNEtW /FEUBvjtqk0btAqvLLP0JpeyJpNOBjpV8051U+GBD1ie0lE3V/7ampG2ZEzNIvOOZ4bwAn2O/yF vhzGAfjjGwpl6IS1f3p/+jBJQ8ors0GY2FGLVZKkfpMP2zxcf+xEz3AI/ouCV1EkU/LpYSA1CMQ GTem0m2hkf+1hw12L55ArqItPrCogmdpl42BJoCGV/nL3UfzQi+GKOu3eepKM8y7oTBRPDE4D4Q LhC1HXfEdqmUtG2IQy8LRqxemnkqzGYaKK2Q2OMfo+0EMa5lvz4tEkqTK3jcnRXtUj0ZfBtQxCS XWKHeoEn/x/wNcjEPHA== X-Proofpoint-Spam-Info: AW1haW4tMjYwODEyMDE5MCBTYWx0ZWRfX5I/EWFTUgTM/ snywxXZ8WknYJQTat7Qf/UiaqMKCVdZ6dy4mWcjNHG5RkNcgbYBENHEwGN+s3lbohegLc/1y75Q k9aR6JKBuagu7y9rbVZjDKw27H7MngiG2B4sT9uSx7XpSKmf4GPn 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=205.220.177.32; envelope-from=dongli.zhang@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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 @oracle.com) X-ZM-MESSAGEID: 1786577628292158500 Content-Type: text/plain; charset="utf-8" Add a memfd migration transport to the MigrationAddress QAPI schema. The new transport has no user-supplied arguments because QEMU creates and passes the backing memfd internally. The initial user is cpr-exec, where the main VM/device migration stream can be stored in an inherited memfd instead of an external file. Signed-off-by: Dongli Zhang --- qapi/migration.json | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/qapi/migration.json b/qapi/migration.json index b1eaf7b054..1505c201ca 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -702,9 +702,11 @@ # @cpr-exec: The migrate command stops the VM, saves state to the # migration channel, directly exec's a new version of QEMU on the # same host, replacing the original process while retaining its -# PID, and loads state from the channel. Guest RAM is preserved -# in place. Devices and their pinned pages are also preserved for -# VFIO and IOMMUFD. +# PID, and loads state from the channel. With the @memfd +# migration transport, QEMU saves VM/device state to an internal +# memfd instead of an external main migration channel. Guest RAM +# is preserved in place. Devices and their pinned pages are also +# preserved for VFIO and IOMMUFD. # # Old QEMU starts new QEMU by exec'ing the command specified by # the @cpr-exec-command parameter. The command may be a direct @@ -716,6 +718,13 @@ # as a file, that accepts all data before old QEMU exits. # Otherwise, old QEMU may quietly block writing to the channel. # +# Alternatively, use the @memfd migration transport to save +# VM/device state to an internal memfd inherited by new QEMU. +# +# With @memfd, the new QEMU command may include '-incoming memfd:' +# to load the migration stream automatically, or '-incoming defer' +# to load it later with `migrate-incoming`. +# # Memory-backend objects must have the share=3Don attribute, but # memory-backend-epc is not supported. The VM must be started # with the '-machine aux-ram-share=3Don' option. @@ -1309,10 +1318,14 @@ # # @file: Direct the migration stream to a file. # +# @memfd: Direct the migration stream to an internal memfd. This +# transport is currently only valid with cpr-exec migration mode. +# (Since 11.2) +# # Since: 8.2 ## { 'enum': 'MigrationAddressType', - 'data': [ 'socket', 'exec', 'rdma', 'file' ] } + 'data': [ 'socket', 'exec', 'rdma', 'file', 'memfd' ] } =20 ## # @FileMigrationArgs: @@ -1337,6 +1350,14 @@ { 'struct': 'MigrationExecCommand', 'data': {'args': [ 'str' ] } } =20 +## +# @MemfdMigrationArgs: +# +# Since: 11.2 +## +{ 'struct': 'MemfdMigrationArgs', + 'data': { } } + ## # @MigrationAddress: # @@ -1353,7 +1374,8 @@ 'socket': 'SocketAddress', 'exec': 'MigrationExecCommand', 'rdma': 'InetSocketAddress', - 'file': 'FileMigrationArgs' } } + 'file': 'FileMigrationArgs', + 'memfd': 'MemfdMigrationArgs' } } =20 ## # @MigrationChannelType: --=20 2.43.5 From nobody Wed Aug 26 07:25:35 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=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1786577626; cv=none; d=zohomail.com; s=zohoarc; b=m07zCyvwcHQuDi86FHi4f8JkTrG1jgOjQ8Z70D2NQ4C/80hYOPAIa4a3N6/YHbebyNKWW1sKlrHtraUdeWbiA5rIWqqwEfdkhZTNbMs1rHKXgwLpbSfPhgjh+E56KqWjlRYOlN23fDtERU3ArmqrCwzqIyVxCfRlcHMZ3PkJSJQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786577626; 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=xBJSteVHeVjPgQPJGO+lEqSC736TcxpesbTTLQrXF/I=; b=KSlSMLoIQnM/70tanjT87irw4bbcAETKUEpZHqwf6GcN0mQjxxatLtjYN0m3cRylUnSdVOpDziFTunMmdjfWYldl1zjz6s2CXwJ8O6UxztTPbFz5xvHuiXXXKE0eD8/sRX1NUJWFeXT4uLkOsOwSOiM/3Vv/GcNrtU1KNO+OmSo= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786577626743497.5223046695148; Wed, 12 Aug 2026 16:33:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wuIRJ-0004Rm-RR; Wed, 12 Aug 2026 19:32:54 -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 1wuIRF-0004PZ-Fo for qemu-devel@nongnu.org; Wed, 12 Aug 2026 19:32:50 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wuIRC-0001Ry-Bl for qemu-devel@nongnu.org; Wed, 12 Aug 2026 19:32:49 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67CEp8Bu881332; Wed, 12 Aug 2026 23:32:41 GMT Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4fwvh2fk8n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Aug 2026 23:32:40 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 67CNTxOj017347; Wed, 12 Aug 2026 23:32:39 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4fwtwfngru-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Aug 2026 23:32:39 +0000 (GMT) Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 67CNWbHa025569; Wed, 12 Aug 2026 23:32:39 GMT Received: from localhost.localdomain (ca-dev80.us.oracle.com [10.211.9.80]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 4fwtwfngqu-3; Wed, 12 Aug 2026 23:32:39 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=xBJSt eVHeVjPgQPJGO+lEqSC736TcxpesbTTLQrXF/I=; b=DLktV+hUygPeuEByTYMp3 Hyl/y6UJmeDyu/DvQNWPPFFMQTi7su5nAz1Y5cC4Lg1Gi51F7tQJxdpt/oFACNMG dUadnm7jCIt2kwu7694sWaCygzWIi+Id0aHurjA2rzDzhAmObwyfXyXPYqJ9ivUY x7t2L2792tS2rAGnrbTW8hmZYx4C6rzHmMldp2DyDAtyvjZ5cwV6mLJd8s/Exf3M e2MKFesqWg8LwEJhXiE8POrViPmC7m50upE4YZZEzVQzX3jvc0oBUtKcocw+VWxw DYmsPN/KOD0YOaj8idNfNSmqfUztlpUdrrE5Vfl4XopwhEV9CiNsOfyDxTgaohDD A== From: Dongli Zhang To: qemu-devel@nongnu.org Cc: peterx@redhat.com, farosas@suse.de, eblake@redhat.com, armbru@redhat.com, maciej.szmigiero@oracle.com, mark.kanda@oracle.com, bchaney@akamai.com, pierrick.bouvier@oss.qualcomm.com, joe.jin@oracle.com Subject: [PATCH 2/5] migration: Add generic memfd channel helpers Date: Wed, 12 Aug 2026 16:27:47 -0700 Message-ID: <20260812232842.470225-3-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260812232842.470225-1-dongli.zhang@oracle.com> References: <20260812232842.470225-1-dongli.zhang@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-12_07,2026-08-12_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 spamscore=0 phishscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2606160000 definitions=main-2608120190 X-Authority-Analysis: v=2.4 cv=M6V97Sws c=1 sm=1 tr=0 ts=6a7d0298 cx=c_pps a=OOZaFjgC48PWsiFpTAqLcw==:117 a=OOZaFjgC48PWsiFpTAqLcw==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=o5oIOnhZENCTenyL_yNV:22 a=yPCof4ZbAAAA:8 a=tdSjP6V1gMc4Ygz-QPUA:9 a=O8hF6Hzn-FEA:10 X-Proofpoint-GUID: kqyyHZ67ULOhhOd5EAlxMbz0L4Oan2K0 X-Proofpoint-ORIG-GUID: kqyyHZ67ULOhhOd5EAlxMbz0L4Oan2K0 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODEyMDE5MCBTYWx0ZWRfX3lwyeYBRi2Xa V2eb2rjLz6wBKTh3LRXZIvBB/6LNaru0iaua2vSqRjF6k9BtJ5lQXZPefmcUwAO4hFCRsswDQzZ hV7rZhIt5T7+FzQkFX98iy6SvUKstmwf39JXkabWEuheuqNuh6B6vVsgEVNuiR/BRBrLH76qLb+ Zp1XmgjkLOeRSkgbCfaI3NphXgWF5miMIZWAykGnNaXk0PDeql09///9l+gqACCbAiPMww6LmLE sQ7U7zTpQwNURfpyED2bS1j5KYlWpEAKx9YYkGZQ1LNjLsEnaPC3lZdBg5x6ilWgddFX8GNJ3UP PD+/XYnVJFPvoJmf8dUDkl0QglInB0f4RggOCQLlsVOFlNLLulaWUOZcRwlljtXO+I73g+9joZT mtlepBKxMNAIPkfiB3Ff6tqrTYRn328wqonjuCUiJxEMLC5o0tZBnucjlVrucUB5L98/Z9yyoOX Bxg2aQcjFcDxibjOUlw== X-Proofpoint-Spam-Info: AW1haW4tMjYwODEyMDE5MCBTYWx0ZWRfX1V4xD4uAWM92 8zERj6Zo/If4XLCPP8pEnyndqf0PVgEpa4NzvEWsrhpUa1m3iHXRgi95Q8SLjOVqsjavvKmE1JG jdzNKqhSirTxnU7QMCz6LHMHxKecaogyovURLAIGg7fpSnBy324I 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=205.220.177.32; envelope-from=dongli.zhang@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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 @oracle.com) X-ZM-MESSAGEID: 1786577628294158500 Content-Type: text/plain; charset="utf-8" Add helpers for creating an outgoing memfd-backed migration channel and for wrapping an existing memfd fd as an incoming migration channel. The outgoing helper can optionally duplicate the memfd fd for the caller. Signed-off-by: Dongli Zhang --- migration/memfd.c | 67 +++++++++++++++++++++++++++++++++++++++++++ migration/memfd.h | 17 +++++++++++ migration/meson.build | 1 + 3 files changed, 85 insertions(+) create mode 100644 migration/memfd.c create mode 100644 migration/memfd.h diff --git a/migration/memfd.c b/migration/memfd.c new file mode 100644 index 0000000000..0b5ef0234f --- /dev/null +++ b/migration/memfd.c @@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * QEMU live migration via memfd + * + * Copyright (c) 2026 Oracle and/or its affiliates. + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu/cutils.h" +#include "qemu/memfd.h" +#include "memfd.h" + +QIOChannel *memfd_create_outgoing(const char *name, int *dup_fdp, + Error **errp) +{ + QIOChannelFile *fioc; + QIOChannel *ioc; + int fd; + +#ifdef CONFIG_LINUX + fd =3D qemu_memfd_create(name, 0, false, 0, 0, errp); +#else + fd =3D -1; + error_setg(errp, "memfd migration is only supported on Linux"); +#endif + + if (fd < 0) { + return NULL; + } + + if (dup_fdp) { + int dup_fd =3D dup(fd); + + if (dup_fd < 0) { + error_setg_errno(errp, errno, + "failed to duplicate memfd migration fd"); + close(fd); + return NULL; + } + + qemu_set_cloexec(dup_fd); + *dup_fdp =3D dup_fd; + } + + fioc =3D qio_channel_file_new_fd(fd); + ioc =3D QIO_CHANNEL(fioc); + qio_channel_set_name(ioc, name); + return ioc; +} + +QIOChannel *memfd_open_incoming(int fd, const char *name, Error **errp) +{ + QIOChannelFile *fioc; + QIOChannel *ioc; + + if (lseek(fd, 0, SEEK_SET) < 0) { + error_setg_errno(errp, errno, "failed to rewind memfd migration fd= "); + close(fd); + return NULL; + } + + fioc =3D qio_channel_file_new_fd(fd); + ioc =3D QIO_CHANNEL(fioc); + qio_channel_set_name(ioc, name); + return ioc; +} diff --git a/migration/memfd.h b/migration/memfd.h new file mode 100644 index 0000000000..cb6afe3eeb --- /dev/null +++ b/migration/memfd.h @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * QEMU live migration via memfd + * + * Copyright (c) 2026 Oracle and/or its affiliates. + */ + +#ifndef QEMU_MIGRATION_MEMFD_H +#define QEMU_MIGRATION_MEMFD_H + +#include "io/channel-file.h" + +QIOChannel *memfd_create_outgoing(const char *name, int *dup_fdp, + Error **errp); +QIOChannel *memfd_open_incoming(int fd, const char *name, Error **errp); + +#endif diff --git a/migration/meson.build b/migration/meson.build index 0a9a5d0d37..1d852b8c6d 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -23,6 +23,7 @@ system_ss.add(files( 'fd.c', 'file.c', 'global_state.c', + 'memfd.c', 'migration.c', 'multifd.c', 'multifd-device-state.c', --=20 2.43.5 From nobody Wed Aug 26 07:25:35 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=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1786577627; cv=none; d=zohomail.com; s=zohoarc; b=aMQh2N2KHXg27eA9nE5P4HtmEOM9ZQ4AuBwW2W7RIhSIphrhx3f/YPKDg884+XLjweIsMd9EzFZwZV5dUY87xdccOSNfeJSYyRBbi4Pb7bqg4QNIx4FymC/hP0t4sf/JQALTPhQBFqanQjZLAr6xp4wHbgcyEdQ6qREWacz0ask= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786577627; 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=NHGL6gqgzgo4eylSEkzkqCivtUSlItAo/tb0HO7TG5E=; b=FVP9cWNAYPPElIPQgIjBad1hK8aYdt7zZF+sCzSGGftsSPtlM4Udh4sCOZKkwA8nHcsPUXeOTwVZ/1l6PZmLwvYhc+zciLAi6qm4daCWy1PIdrFlvsqh13PvcH68J76IR7gv7XMkeOJY7N1UQe5nj25TS4bb2HuwQjQWVJHjkZw= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786577627967152.45048688851955; Wed, 12 Aug 2026 16:33:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wuIRL-0004SI-QY; Wed, 12 Aug 2026 19:32:55 -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 1wuIRF-0004Pb-NP for qemu-devel@nongnu.org; Wed, 12 Aug 2026 19:32:50 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wuIRB-0001S8-VI for qemu-devel@nongnu.org; Wed, 12 Aug 2026 19:32:49 -0400 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67CEolwK882217; Wed, 12 Aug 2026 23:32:42 GMT Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4fwvfxyncj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Aug 2026 23:32:41 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 67CNTxLW017409; Wed, 12 Aug 2026 23:32:40 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4fwtwfngs4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Aug 2026 23:32:40 +0000 (GMT) Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 67CNWbHc025569; Wed, 12 Aug 2026 23:32:39 GMT Received: from localhost.localdomain (ca-dev80.us.oracle.com [10.211.9.80]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 4fwtwfngqu-4; Wed, 12 Aug 2026 23:32:39 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=NHGL6 gqgzgo4eylSEkzkqCivtUSlItAo/tb0HO7TG5E=; b=BB08GFGD4wiOIe2Q1Z0yr R7S/3NEhHFU7thDzdI6aH43RE5mgNwC8LTtnBVm/T1odf+bYn81OmOKZq7Us93mt 3mpaAxOBGv1HQCDziwsSm0rSKLhlXBPkrkkTbtTsQ+4Yz4P6a+67ysYo+CdHnDE9 HV0SPT2ZElEiXEFcuhaiMU7tYeQOJA2v8KAWaSK8DkiRbA7XpuAEERKif+NRPKMW A97I9KB2CBTVkM84I6Z8KpzLEydZtA26KZ8bjtx8a0qou1fp6iZ+luaFkuBsRmHv xpQsmGcAg+R7xPJ6dCBDQNQ7W6u/l8e790DpwRmuqKb3KZL/leirsoV6mOOz642i Q== From: Dongli Zhang To: qemu-devel@nongnu.org Cc: peterx@redhat.com, farosas@suse.de, eblake@redhat.com, armbru@redhat.com, maciej.szmigiero@oracle.com, mark.kanda@oracle.com, bchaney@akamai.com, pierrick.bouvier@oss.qualcomm.com, joe.jin@oracle.com Subject: [PATCH 3/5] migration/cpr-exec: Add memfd helpers Date: Wed, 12 Aug 2026 16:27:48 -0700 Message-ID: <20260812232842.470225-4-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260812232842.470225-1-dongli.zhang@oracle.com> References: <20260812232842.470225-1-dongli.zhang@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-12_07,2026-08-12_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 spamscore=0 phishscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2606160000 definitions=main-2608120190 X-Proofpoint-GUID: bJHAlme1hr80meaLcwBwka_lhBVZYZ8o X-Authority-Analysis: v=2.4 cv=K/sS2SWI c=1 sm=1 tr=0 ts=6a7d0299 cx=c_pps a=OOZaFjgC48PWsiFpTAqLcw==:117 a=OOZaFjgC48PWsiFpTAqLcw==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=3I1J8UUJPc9JN9BFgKH3:22 a=yPCof4ZbAAAA:8 a=JsEZA-e_2lCJjq3I3kcA:9 a=O8hF6Hzn-FEA:10 X-Proofpoint-ORIG-GUID: bJHAlme1hr80meaLcwBwka_lhBVZYZ8o X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODEyMDE5MCBTYWx0ZWRfX46KF9TlN3FgR ViLFyZIDa1adrIeyjA4PXlhv30EhRsX26OusRpG1rueOpvcM+OVs7V0ipQjwP3goQIFxBgUz+yt QPyuB+jfoyj4COhzt0DsjBnfRjX40LA56aN/Hzk6lbEnxyTgX4NWjJ9V84M5oljEgr9KWoyRxWn rost/eoBJrGtuwv/vJMwuR8FWACughIIWdno8kd6BiyPw/JzhopZQK6q7XUoVmi/5UByAHStpdd CWH+36mauoVcJ3EN3Pcxr2WE/eKGv4wWb8Vx9NvTiJTkm0qENntZx3dFV3vIArX1+eVRaFUDl/4 +M2se+uBjOhgXUMk2gQYT4CjetyZwuTjeuyP3bL8siYHWS6YpImXsHfuvWNvoAKlz83seebHnVC ujgFkYKblS2rs18rc/jVm/szfAc64YwwupT4UKEIjHLnt34sfOPG7do0CAg+FGGhJOQqRXG/+cA E8GsyCHRrEvavNzgYCw== X-Proofpoint-Spam-Info: AW1haW4tMjYwODEyMDE5MCBTYWx0ZWRfX+RKdDkCV9BIZ Y8ICK6K0ljCiPIa3A7Wwut8Y1EY/BeeP1CV+9M18u3O+eHhFjGR7ucznpOrx9+I5GigZL3PbKOw dKWSWFxlYVP5PRRP0Ca9KYaQjdC36nYr3+7MuYd7mXn1EE6H4Z+2 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=205.220.177.32; envelope-from=dongli.zhang@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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 @oracle.com) X-ZM-MESSAGEID: 1786577628245158500 Content-Type: text/plain; charset="utf-8" Add cpr-exec specific helpers for using a memfd as the main migration state channel. The helpers create the outgoing memfd channel, preserve the duplicated fd across exec via an environment variable, claim the fd on the incoming side, and clean up the saved fd on failure paths. The generic memfd helper remains unchanged. The cpr-exec specific helpers use it for channel creation and keep exec inheritance local to cpr-exec. Signed-off-by: Dongli Zhang --- migration/cpr-exec-memfd.c | 90 ++++++++++++++++++++++++++++++++++++++ migration/cpr-exec-memfd.h | 18 ++++++++ migration/meson.build | 1 + 3 files changed, 109 insertions(+) create mode 100644 migration/cpr-exec-memfd.c create mode 100644 migration/cpr-exec-memfd.h diff --git a/migration/cpr-exec-memfd.c b/migration/cpr-exec-memfd.c new file mode 100644 index 0000000000..2bc15f644e --- /dev/null +++ b/migration/cpr-exec-memfd.c @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * CPR exec migration via memfd + * + * Copyright (c) 2026 Oracle and/or its affiliates. + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu/cutils.h" +#include "channel.h" +#include "cpr-exec-memfd.h" +#include "memfd.h" + +#define CPR_EXEC_MEMFD_NAME "qemu-cpr-exec-migration" +#define CPR_EXEC_MEMFD_ENV "QEMU_CPR_EXEC_MIGRATION_FD" + +static int cpr_exec_memfd_fd =3D -1; + +static int cpr_exec_memfd_claim_fd(Error **errp) +{ + const char *val =3D g_getenv(CPR_EXEC_MEMFD_ENV); + int fd; + + if (!val) { + error_setg(errp, "missing %s environment variable", + CPR_EXEC_MEMFD_ENV); + return -1; + } + + if (qemu_strtoi(val, NULL, 10, &fd) < 0) { + error_setg(errp, "bad %s value %s", CPR_EXEC_MEMFD_ENV, val); + return -1; + } + + g_unsetenv(CPR_EXEC_MEMFD_ENV); + return fd; +} + +QIOChannel *cpr_exec_memfd_connect_outgoing(Error **errp) +{ + return memfd_create_outgoing(CPR_EXEC_MEMFD_NAME, &cpr_exec_memfd_fd, + errp); +} + +void cpr_exec_memfd_connect_incoming(Error **errp) +{ + g_autoptr(QIOChannel) ioc =3D NULL; + int fd =3D cpr_exec_memfd_claim_fd(errp); + + if (fd < 0) { + return; + } + + ioc =3D memfd_open_incoming(fd, CPR_EXEC_MEMFD_NAME, errp); + if (!ioc) { + return; + } + + migration_channel_process_incoming(ioc); +} + +bool cpr_exec_memfd_preserve_fd(Error **errp) +{ + char val[16]; + + if (cpr_exec_memfd_fd < 0) { + return true; + } + + qemu_clear_cloexec(cpr_exec_memfd_fd); + snprintf(val, sizeof(val), "%d", cpr_exec_memfd_fd); + if (!g_setenv(CPR_EXEC_MEMFD_ENV, val, 1)) { + error_setg(errp, "Setting env %s =3D %s failed", + CPR_EXEC_MEMFD_ENV, val); + return false; + } + + return true; +} + +void cpr_exec_memfd_cleanup(void) +{ + g_unsetenv(CPR_EXEC_MEMFD_ENV); + + if (cpr_exec_memfd_fd >=3D 0) { + close(cpr_exec_memfd_fd); + cpr_exec_memfd_fd =3D -1; + } +} diff --git a/migration/cpr-exec-memfd.h b/migration/cpr-exec-memfd.h new file mode 100644 index 0000000000..1c74c7bfde --- /dev/null +++ b/migration/cpr-exec-memfd.h @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * CPR exec migration via memfd + * + * Copyright (c) 2026 Oracle and/or its affiliates. + */ + +#ifndef QEMU_MIGRATION_CPR_EXEC_MEMFD_H +#define QEMU_MIGRATION_CPR_EXEC_MEMFD_H + +#include "io/channel-file.h" + +QIOChannel *cpr_exec_memfd_connect_outgoing(Error **errp); +void cpr_exec_memfd_connect_incoming(Error **errp); +bool cpr_exec_memfd_preserve_fd(Error **errp); +void cpr_exec_memfd_cleanup(void); + +#endif diff --git a/migration/meson.build b/migration/meson.build index 1d852b8c6d..2e8a89637e 100644 --- a/migration/meson.build +++ b/migration/meson.build @@ -17,6 +17,7 @@ system_ss.add(files( 'cpr.c', 'cpr-transfer.c', 'cpr-exec.c', + 'cpr-exec-memfd.c', 'cpu-throttle.c', 'dirtyrate.c', 'exec.c', --=20 2.43.5 From nobody Wed Aug 26 07:25:35 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=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1786577626; cv=none; d=zohomail.com; s=zohoarc; b=mpjKXSa33Qfu3IfUH81iqBR74+Wn4s1PYGdF0SVPdtAnIda5AMyp1pzyrba8j0msixDQSSMWHsvvJ1drwRm+3lGQDA37MsWlBJVE6YmCWBuiyWK45mxjfh7JL3rSzcmZady7PBizoGJRKMeT5IwcZ4BztMsGxDl2jVhQNRUc68c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786577626; 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=2iAAHzkxxl+aTx1UHB5srahyUI/g4UfINfpnU9fcf7E=; b=CocvPDeVAVUGYIjiMvCMvywR/VY+To4MvHoxLVWkFQOevLfDT6mgwAHFXMbYQofGlVpn7A+2TZfxD/4CIhFhqLktDj+pHiJQUQebX5v8gSYlk7qRbcJUhVgaBvi81Z567T5eP3x92fU8CMTLljkUcg7sWAx3puC0OMh5ZHIecnw= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786577626246268.37597648117446; Wed, 12 Aug 2026 16:33:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wuIRI-0004Qw-Vg; Wed, 12 Aug 2026 19:32:53 -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 1wuIRE-0004PT-Jo for qemu-devel@nongnu.org; Wed, 12 Aug 2026 19:32:50 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wuIRC-0001S2-Dd for qemu-devel@nongnu.org; Wed, 12 Aug 2026 19:32:48 -0400 Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67CEq3uG2061644; Wed, 12 Aug 2026 23:32:42 GMT Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4fwvhdyssv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Aug 2026 23:32:42 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 67CNU0Ed017432; Wed, 12 Aug 2026 23:32:41 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4fwtwfngsa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Aug 2026 23:32:41 +0000 (GMT) Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 67CNWbHe025569; Wed, 12 Aug 2026 23:32:40 GMT Received: from localhost.localdomain (ca-dev80.us.oracle.com [10.211.9.80]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 4fwtwfngqu-5; Wed, 12 Aug 2026 23:32:40 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=2iAAH zkxxl+aTx1UHB5srahyUI/g4UfINfpnU9fcf7E=; b=aMOqq4t38D9GbN7IEhR9V VkFzgcvRJngcAB7coGawmSaOMXO82b6PKsqDOBiILff5V987f3GYWvisOEsmqL1r xKU20WXEtZb8wxaGsuVYwlGjy4DDJ6lZlc/yNqMfQmIHPyC2vW7b8q7PeE7Qmxea WUfBinyrLaiKp/kI1Tmc6g1VNHX+d9SIvwCDTXnlJ8meHyuvU2rhp6+lAZHGEIrq PPqgJNPAGuOY5zz1rS+2Zu7q04GjQWK9frkbnbpf0jrY5Iw+3PKwS9Q59r/mhVbz Y3QgwHSvHhYE3ktbQl+wvFk+wpPEAPLBM8ORT62ZrmwtYY/+K/6zCoe1CJS9i/yW Q== From: Dongli Zhang To: qemu-devel@nongnu.org Cc: peterx@redhat.com, farosas@suse.de, eblake@redhat.com, armbru@redhat.com, maciej.szmigiero@oracle.com, mark.kanda@oracle.com, bchaney@akamai.com, pierrick.bouvier@oss.qualcomm.com, joe.jin@oracle.com Subject: [PATCH 4/5] migration/cpr-exec: Support diskless memfd transport Date: Wed, 12 Aug 2026 16:27:49 -0700 Message-ID: <20260812232842.470225-5-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260812232842.470225-1-dongli.zhang@oracle.com> References: <20260812232842.470225-1-dongli.zhang@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-12_07,2026-08-12_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 spamscore=0 phishscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2606160000 definitions=main-2608120190 X-Proofpoint-ORIG-GUID: 0gTV_cw7ZAN7CAdaNDjOPpguoMShJKCn X-Proofpoint-GUID: 0gTV_cw7ZAN7CAdaNDjOPpguoMShJKCn X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODEyMDE5MCBTYWx0ZWRfX6Xv4AvkeS9F5 djqLTLhPeeLt7MpTjQ2SvIOjc+Xf8+K8S6ah79u5sw5ty1VmpBdr8777NLPXWiUNRVDA5qqVCTD 1/HVxq4LAWBG5d6285H5yZVBWLpfNh87moSoCOSm3XQkFwofZT2USxulVQjPmf2Za7M4IhM38Uw honLT8OzfDHV6hvSxYRuZlSQtXyeFFMyegWZo23m9p3EAJvbExdGkp476jSFiBJOSr6YIi9KutT BoTJm9TXujXJ4oPshWFXDNrWth5rweb1EdB4h+ZoHyHVPleyjdvDTKOwgcxqoepwjOZ7VYR56SV sk5PLbGWVoty8wBtCWJXbVc6snNxH922+6aTtiXUFoZxlcCTyZpXGG9Mb8uMiLfCTyQMDLIjyoz c/lfAIycW9u5WQCisrFHhnm2PKiLGK8Bkv7CBXTJi1+LfQharQ6u+J1WZktjeoOwfeppO6hPNTT ZgZDeB9OlnhKm3e1LKA== X-Proofpoint-Spam-Info: AW1haW4tMjYwODEyMDE5MCBTYWx0ZWRfX6zNIFKu6tTfn wpp7R3xB+d+yZ22mGyHiu9aprctaDIlHgO/JPC6EP1EQDq232nShi9nLDGv+8EeUzmVwDRHKpYM P4ak6+UqFfx5PpAtC32TDEAiOS/G8HwysyD6rMxQBKbnQPJ/6u10 X-Authority-Analysis: v=2.4 cv=L/YtheT8 c=1 sm=1 tr=0 ts=6a7d029a cx=c_pps a=OOZaFjgC48PWsiFpTAqLcw==:117 a=OOZaFjgC48PWsiFpTAqLcw==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=BqU2WV_vvsyTyxaotp0D:22 a=yPCof4ZbAAAA:8 a=l6aH6V--89kVnUN-eIUA:9 a=O8hF6Hzn-FEA:10 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=205.220.177.32; envelope-from=dongli.zhang@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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 @oracle.com) X-ZM-MESSAGEID: 1786577628313158500 Content-Type: text/plain; charset="utf-8" Currently cpr-exec uses a file to pass the VM and device state between the old and new QEMU processes. Support using memfd as a migration transport so this state can be passed without creating a state file. Here is an example of using the new memfd transport with cpr-exec. (qemu) migrate_set_parameter mode cpr-exec (qemu) migrate_set_parameter cpr-exec-command qemu-kvm ... -incoming defer (qemu) migrate -d memfd: QEMU 11.1.50 monitor - type 'help' for more information (qemu) info status VM status: paused (inmigrate) (qemu) migrate_incoming memfd: (qemu) info status VM status: running Signed-off-by: Dongli Zhang --- migration/channel.c | 7 +++++++ migration/cpr-exec.c | 9 +++++++++ migration/memfd.c | 23 +++++++++++++++++++++++ migration/memfd.h | 2 ++ migration/migration.c | 9 +++++++++ 5 files changed, 50 insertions(+) diff --git a/migration/channel.c b/migration/channel.c index 1e2935f926..96de40c108 100644 --- a/migration/channel.c +++ b/migration/channel.c @@ -18,6 +18,7 @@ #include "file.h" #include "io/channel-socket.h" #include "io/channel-tls.h" +#include "memfd.h" #include "migration.h" #include "multifd.h" #include "options.h" @@ -62,6 +63,8 @@ void migration_connect_outgoing(MigrationState *s, Migrat= ionAddress *addr, ioc =3D exec_connect_outgoing(s, addr->u.exec.args, errp); } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { ioc =3D file_connect_outgoing(s, &addr->u.file, errp); + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_MEMFD) { + ioc =3D memfd_connect_outgoing(errp); } else { error_setg(errp, "uri is not a valid migration protocol"); } @@ -92,6 +95,8 @@ void migration_connect_incoming(MigrationAddress *addr, E= rror **errp) exec_connect_incoming(addr->u.exec.args, errp); } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_FILE) { file_connect_incoming(&addr->u.file, errp); + } else if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_MEMFD) { + memfd_connect_incoming(errp); } else { error_setg(errp, "unknown migration protocol"); } @@ -394,6 +399,8 @@ bool migrate_uri_parse(const char *uri, MigrationChanne= l **channel, errp)) { return false; } + } else if (g_str_equal(uri, "memfd:")) { + addr->transport =3D MIGRATION_ADDRESS_TYPE_MEMFD; } else { error_setg(errp, "unknown migration protocol: %s", uri); return false; diff --git a/migration/cpr-exec.c b/migration/cpr-exec.c index daa50916d2..388cfba80d 100644 --- a/migration/cpr-exec.c +++ b/migration/cpr-exec.c @@ -21,6 +21,7 @@ #include "migration/vmstate.h" #include "system/runstate.h" #include "trace.h" +#include "cpr-exec-memfd.h" =20 #define CPR_EXEC_STATE_NAME "QEMU_CPR_EXEC_STATE" =20 @@ -143,6 +144,11 @@ static void cpr_exec_cb(void *opaque) * earlier because they should not persist across miscellaneous fork a= nd * exec calls that are performed during normal operation. */ + if (!cpr_exec_memfd_preserve_fd(&err)) { + g_clear_pointer(&argv, g_strfreev); + cpr_exec_memfd_cleanup(); + goto fail; + } cpr_exec_preserve_fds(); =20 trace_cpr_exec(); @@ -155,7 +161,9 @@ static void cpr_exec_cb(void *opaque) error_setg_errno(&err, errno, "execvp %s failed", argv[0]); g_clear_pointer(&argv, g_strfreev); cpr_exec_unpreserve_fds(); + cpr_exec_memfd_cleanup(); =20 +fail: error_report_err(error_copy(err)); migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED); =20 @@ -189,6 +197,7 @@ static int cpr_exec_notifier(NotifierWithReturn *notifi= er, MigrationEvent *e, qemu_notify_event(); } else if (e->type =3D=3D MIG_EVENT_FAILED) { cpr_exec_unpersist_state(); + cpr_exec_memfd_cleanup(); } return 0; } diff --git a/migration/memfd.c b/migration/memfd.c index 0b5ef0234f..4ed185d844 100644 --- a/migration/memfd.c +++ b/migration/memfd.c @@ -10,6 +10,9 @@ #include "qemu/cutils.h" #include "qemu/memfd.h" #include "memfd.h" +#include "cpr-exec-memfd.h" +#include "migration/cpr.h" +#include "options.h" =20 QIOChannel *memfd_create_outgoing(const char *name, int *dup_fdp, Error **errp) @@ -65,3 +68,23 @@ QIOChannel *memfd_open_incoming(int fd, const char *name= , Error **errp) qio_channel_set_name(ioc, name); return ioc; } + +QIOChannel *memfd_connect_outgoing(Error **errp) +{ + if (migrate_mode() =3D=3D MIG_MODE_CPR_EXEC) { + return cpr_exec_memfd_connect_outgoing(errp); + } + + error_setg(errp, "memfd transport is only supported with cpr-exec"); + return NULL; +} + +void memfd_connect_incoming(Error **errp) +{ + if (cpr_get_incoming_mode() =3D=3D MIG_MODE_CPR_EXEC) { + cpr_exec_memfd_connect_incoming(errp); + return; + } + + error_setg(errp, "memfd transport is only supported with cpr-exec"); +} diff --git a/migration/memfd.h b/migration/memfd.h index cb6afe3eeb..9c50c84ad5 100644 --- a/migration/memfd.h +++ b/migration/memfd.h @@ -13,5 +13,7 @@ QIOChannel *memfd_create_outgoing(const char *name, int *dup_fdp, Error **errp); QIOChannel *memfd_open_incoming(int fd, const char *name, Error **errp); +QIOChannel *memfd_connect_outgoing(Error **errp); +void memfd_connect_incoming(Error **errp); =20 #endif diff --git a/migration/migration.c b/migration/migration.c index 9df6da131c..9f3afe5a3a 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -248,6 +248,15 @@ migration_channels_and_transport_compatible(MigrationA= ddress *addr, return false; } =20 + if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_MEMFD) { + if (migrate_mode() !=3D MIG_MODE_CPR_EXEC && + cpr_get_incoming_mode() !=3D MIG_MODE_CPR_EXEC) { + error_setg(errp, + "memfd transport is only supported with cpr-exec"); + return false; + } + } + return true; } =20 --=20 2.43.5 From nobody Wed Aug 26 07:25:35 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=reject dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1786577596; cv=none; d=zohomail.com; s=zohoarc; b=MOF6MvLl0bQD+chodf1fJyDjZfpU/XGv6CIEALclKUgna9/IS1OjzDT7luXQwztCF++tuCN6rYHpFfBRafL/JyDb78pFO7UySkMNKclm3dXkCM7qUgDTn52u0Jvx8gdQ8Y8L4LWQkiIyjPQBAuXZj9KXu8AIABKAfrZjAQjua+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1786577596; 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=gqf4bjSNLm08jyB0dCIC6aS4VvZmDL+FUiWRJ5AFlbI=; b=NADw4pnZFRB34UtRvy1fj40g0Xso70fT3jZG0/hz4TsJCa1L689NJ250NzHssmq3Kr0hz7/sX3D+sQqSkRzx0s5FCS8/zrdasf9NMXVIBmvvpiwMn1dNTU3mYohL3QXY2jSa2fcegLKoYGkvETFDV4KUVVuD2Zk6c5be5B0jEJs= 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=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1786577596486300.03702456146834; Wed, 12 Aug 2026 16:33:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wuIRR-0004TF-Un; Wed, 12 Aug 2026 19:33:01 -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 1wuIRF-0004PY-EK for qemu-devel@nongnu.org; Wed, 12 Aug 2026 19:32:50 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wuIRC-0001SC-Kf for qemu-devel@nongnu.org; Wed, 12 Aug 2026 19:32:49 -0400 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67CEp9FM881381; Wed, 12 Aug 2026 23:32:43 GMT Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4fwvh2fk8p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Aug 2026 23:32:42 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.7/8.18.1.7) with ESMTP id 67CNTx4F017385; Wed, 12 Aug 2026 23:32:41 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4fwtwfngsj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Aug 2026 23:32:41 +0000 (GMT) Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.1.12) with ESMTP id 67CNWbHg025569; Wed, 12 Aug 2026 23:32:41 GMT Received: from localhost.localdomain (ca-dev80.us.oracle.com [10.211.9.80]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 4fwtwfngqu-6; Wed, 12 Aug 2026 23:32:41 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=corp-2025-04-25; bh=gqf4b jSNLm08jyB0dCIC6aS4VvZmDL+FUiWRJ5AFlbI=; b=SNk3F4LNR29DxDFyKGCnS 1HE6NEzsfHX/oY6ECA4+K8jyGPs+zAmNADEWMkaurEBR4JS9SduKTOtvHodFYCf6 QNznq6mDUF7aLyq12F1yM4kpac0Pmg4HNOASwjyPzTBQV7nMVitqItIUUMP5a4g3 Fv+N6z/qgRK2xXnpUGs95w8roIkdZFET2+KUnbvPACZWK/CZT9rirsv2nyd6BJ7b gg110sN4Clh2lofGSzRXGW7zTKsuPOhJbR3hIGtTST+iZhhMFg0kGhe6ai+EVJWS BpVoXDNwhe1/fZ8HM/ZM+ojg+k1r63c70Gq9isokpcxmYthh4n9qsB4UAMekYqlZ w== From: Dongli Zhang To: qemu-devel@nongnu.org Cc: peterx@redhat.com, farosas@suse.de, eblake@redhat.com, armbru@redhat.com, maciej.szmigiero@oracle.com, mark.kanda@oracle.com, bchaney@akamai.com, pierrick.bouvier@oss.qualcomm.com, joe.jin@oracle.com Subject: [PATCH 5/5] migration: cpr-exec memfd transport documentation Date: Wed, 12 Aug 2026 16:27:50 -0700 Message-ID: <20260812232842.470225-6-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20260812232842.470225-1-dongli.zhang@oracle.com> References: <20260812232842.470225-1-dongli.zhang@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-12_07,2026-08-12_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 spamscore=0 phishscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2606160000 definitions=main-2608120190 X-Authority-Analysis: v=2.4 cv=M6V97Sws c=1 sm=1 tr=0 ts=6a7d029a cx=c_pps a=OOZaFjgC48PWsiFpTAqLcw==:117 a=OOZaFjgC48PWsiFpTAqLcw==:17 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=jiCTI4zE5U7BLdzWsZGv:22 a=o5oIOnhZENCTenyL_yNV:22 a=yPCof4ZbAAAA:8 a=XpoGA2NoF1k9M7sJ63wA:9 X-Proofpoint-GUID: ZmMnRn94STqqxAJxUgESzewuLZU-r5FM X-Proofpoint-ORIG-GUID: ZmMnRn94STqqxAJxUgESzewuLZU-r5FM X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODEyMDE5MCBTYWx0ZWRfX2fSlle9IQhFV 2wGx1cCQFRTerlMPkfmfhAX3Abv62ZmikGGFLY/weAAyGr8J39vAgJ6Quc8SWVxFzq6rIllAHKp LOptC037atVqE9AQQa2Kfif0k/ItbEihdUloKUti1PBdlSkIx5T/1LzjB8uA2QvoDeHN8iGNEv7 1qQathPy7px2wThiZs+bfzo3xxojnEDZGrVchTmwdn44B/flfpjWw+aWKie7+Bl0GlrQrARyyI+ iD4wr4e21QMRRZagV3LykdO8T54L2EfYHPIuI22cdKgbVZSYmPazCkKpOuNzDHdZXrzzQ0M1Jn/ dT2KLj9j3iAJND70mI6IgUHKT9vrcBnfVML8uPAPzceG0hi2z1hl9BQRNGPLHwv/dLqtBtDn52+ K1jNfO+JNtGvUa/i8bibF+UISkUfhhw5VFaU6cFJC65zUOOigauEI7CZggKI/P6TtdKA+whxOTl 4GfNjrcC9mdL6SNFUIA== X-Proofpoint-Spam-Info: AW1haW4tMjYwODEyMDE5MCBTYWx0ZWRfXylJbFrz/84Yp 16aUD2nj9dRsMcvyPC5dIGL5jg9DBbF4jNMZKNAd3lPFF8rIa6KJ1E+Wp7y9/pAwF5K0Lm8rpor CqcjKtiwwTQOSCMVr6cZvITtoYwfE1Ves/F6zTwN3obsRbfnTqfJ 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=205.220.177.32; envelope-from=dongli.zhang@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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 @oracle.com) X-ZM-MESSAGEID: 1786577599038158500 Content-Type: text/plain; charset="utf-8" Document the cpr-exec flow using the memfd migration transport. The example keeps migrate_incoming explicit so the command sequence mirrors the existing deferred incoming flow. Signed-off-by: Dongli Zhang --- docs/devel/migration/CPR.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/devel/migration/CPR.rst b/docs/devel/migration/CPR.rst index b6178568a8..8afc83a08d 100644 --- a/docs/devel/migration/CPR.rst +++ b/docs/devel/migration/CPR.rst @@ -369,6 +369,10 @@ Outgoing: a ``file`` type, but one can use other types such as ``exec``, provided the command captures all the data from the outgoing side, and provides all the data to the incoming side. + * Alternatively, use the ``memfd:`` URI to save VM/device state + to an internal memfd inherited by the new QEMU. The new QEMU may + use ``-incoming memfd:`` to load it automatically, or ``-incoming + defer`` to load it later with ``migrate_incoming memfd:``. =20 Incoming: * You do not need to explicitly start new QEMU. It is started as @@ -424,6 +428,26 @@ Example 2: incoming defer (qemu) info status VM status: running =20 +Example 3: main state memfd +^^^^^^^^^^^^^^^^^^^^^^^^^^^ +:: + + # qemu-kvm -monitor stdio + -machine q35,memory-backend=3Dram0,aux-ram-share=3Don + -object memory-backend-memfd,id=3Dram0,size=3D8G,share=3Don + ... ... + + QEMU 11.1.50 monitor - type 'help' for more information + (qemu) migrate_set_parameter mode cpr-exec + (qemu) migrate_set_parameter cpr-exec-command qemu-kvm ... -incoming def= er + (qemu) migrate -d memfd: + QEMU 11.1.50 monitor - type 'help' for more information + (qemu) info status + VM status: paused (inmigrate) + (qemu) migrate_incoming memfd: + (qemu) info status + VM status: running + Caveats ^^^^^^^ =20 --=20 2.43.5