Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.0/patches/2175435/?format=api
{ "id": 2175435, "url": "http://patchwork.ozlabs.org/api/1.0/patches/2175435/?format=api", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.0/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": "" }, "msgid": "<20251218062643.624796-3-zhenzhong.duan@intel.com>", "date": "2025-12-18T06:26:23", "name": "[v6,2/9] vfio/iommufd: Query dirty bitmap before DMA unmap", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "3b34a9a608c457303848bcaa6deda60e83d1c7a3", "submitter": { "id": 81636, "url": "http://patchwork.ozlabs.org/api/1.0/people/81636/?format=api", "name": "Duan, Zhenzhong", "email": "zhenzhong.duan@intel.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20251218062643.624796-3-zhenzhong.duan@intel.com/mbox/", "series": [ { "id": 485789, "url": "http://patchwork.ozlabs.org/api/1.0/series/485789/?format=api", "date": "2025-12-18T06:26:21", "name": "vfio: relax the vIOMMU check", "version": 6, "mbox": "http://patchwork.ozlabs.org/series/485789/mbox/" } ], "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2175435/checks/", "tags": {}, "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 (2048-bit key;\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=fP8HEZvw;\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=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists.gnu.org (lists.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 4dX13P4mqHz1xty\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 18 Dec 2025 17:29:21 +1100 (AEDT)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1vW7U1-0003LQ-32; Thu, 18 Dec 2025 01:27:29 -0500", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <zhenzhong.duan@intel.com>)\n id 1vW7Ty-0003Kt-EO\n for qemu-devel@nongnu.org; Thu, 18 Dec 2025 01:27:26 -0500", "from mgamail.intel.com ([198.175.65.18])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <zhenzhong.duan@intel.com>)\n id 1vW7Tw-00014o-I7\n for qemu-devel@nongnu.org; Thu, 18 Dec 2025 01:27:26 -0500", "from orviesa005.jf.intel.com ([10.64.159.145])\n by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 17 Dec 2025 22:27:23 -0800", "from unknown (HELO gnr-sp-2s-612.sh.intel.com) ([10.112.230.229])\n by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 17 Dec 2025 22:27:20 -0800" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1766039244; x=1797575244;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=2RmlAOwmak+jh/vEC9lQi7dmQiq57S7kEx9cPD7O4Y4=;\n b=fP8HEZvw4m1DCU41woRtdgv7/e5MSbJwTtBGEoZ+MtpoV0FkB+7daiW1\n LmDlCh4IiA3wXSCCm7io63OkxbvjPGHHQWA4FtyzUX9y+vE6SP1totg64\n EyxwXokJ91xVrkNdWtSoBYZOhwAcVq9JsmRZXxshO1X+ei9apCmrlZm+K\n sxWCrfxyKDHYnC2ggtl5bO/Klor7/EgzGVgtKCXF7db42b8zyPKhzYSpH\n LAzf9tRxMwcepA1jrud+/+pQhB8NlZdGaDTQ7S7qh7NTeQ8WSZd1PmpY7\n dszB/ctciU1ZuZMTlUa1vkhpfpNO0yA0q6z2jeW/QmowhKUk/Cq6TmSf/ Q==;", "X-CSE-ConnectionGUID": [ "JfOxL8HHQTWs9hoE9UN3Aw==", "iwyPK4GtRXyityKfcGC8rA==" ], "X-CSE-MsgGUID": [ "GK0LWO6rQxKWCoZBmrkCgg==", "mlbfKuN/Q7enNesuARylYA==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6800,10657,11645\"; a=\"68028506\"", "E=Sophos;i=\"6.21,156,1763452800\"; d=\"scan'208\";a=\"68028506\"", "E=Sophos;i=\"6.21,156,1763452800\"; d=\"scan'208\";a=\"203569851\"" ], "X-ExtLoop1": "1", "From": "Zhenzhong Duan <zhenzhong.duan@intel.com>", "To": "qemu-devel@nongnu.org", "Cc": "alex@shazbot.org, clg@redhat.com, mst@redhat.com, jasowang@redhat.com,\n yi.l.liu@intel.com, clement.mathieu--drif@eviden.com,\n eric.auger@redhat.com, joao.m.martins@oracle.com, avihaih@nvidia.com,\n xudong.hao@intel.com, giovanni.cabiddu@intel.com, rohith.s.r@intel.com,\n mark.gross@intel.com, arjan.van.de.ven@intel.com,\n Zhenzhong Duan <zhenzhong.duan@intel.com>", "Subject": "[PATCH v6 2/9] vfio/iommufd: Query dirty bitmap before DMA unmap", "Date": "Thu, 18 Dec 2025 01:26:23 -0500", "Message-ID": "<20251218062643.624796-3-zhenzhong.duan@intel.com>", "X-Mailer": "git-send-email 2.47.1", "In-Reply-To": "<20251218062643.624796-1-zhenzhong.duan@intel.com>", "References": "<20251218062643.624796-1-zhenzhong.duan@intel.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Received-SPF": "pass client-ip=198.175.65.18;\n envelope-from=zhenzhong.duan@intel.com; helo=mgamail.intel.com", "X-Spam_score_int": "-43", "X-Spam_score": "-4.4", "X-Spam_bar": "----", "X-Spam_report": "(-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,\n RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001,\n 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-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": "When an existing mapping is unmapped, there could already be dirty bits\nwhich need to be recorded before unmap.\n\nIf query dirty bitmap fails, we still need to do unmapping or else there\nis stale mapping and it's risky to guest.\n\nCo-developed-by: Joao Martins <joao.m.martins@oracle.com>\nSigned-off-by: Joao Martins <joao.m.martins@oracle.com>\nSigned-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>\nReviewed-by: Cédric Le Goater <clg@redhat.com>\nReviewed-by: Yi Liu <yi.l.liu@intel.com>\nTested-by: Xudong Hao <xudong.hao@intel.com>\nTested-by: Giovannio Cabiddu <giovanni.cabiddu@intel.com>\nTested-by: Rohith S R <rohith.s.r@intel.com>\n---\n hw/vfio/iommufd.c | 19 ++++++++++++++++---\n 1 file changed, 16 insertions(+), 3 deletions(-)", "diff": "diff --git a/hw/vfio/iommufd.c b/hw/vfio/iommufd.c\nindex b527c7d1eb..75e1bde2dd 100644\n--- a/hw/vfio/iommufd.c\n+++ b/hw/vfio/iommufd.c\n@@ -65,7 +65,7 @@ static int iommufd_cdev_unmap(const VFIOContainer *bcontainer,\n uint32_t ioas_id = container->ioas_id;\n bool need_dirty_sync = false;\n Error *local_err = NULL;\n- int ret;\n+ int ret, unmap_ret;\n \n if (unmap_all) {\n size = UINT64_MAX;\n@@ -74,8 +74,21 @@ static int iommufd_cdev_unmap(const VFIOContainer *bcontainer,\n if (iotlb && vfio_container_dirty_tracking_is_started(bcontainer)) {\n if (!vfio_container_devices_dirty_tracking_is_supported(bcontainer) &&\n bcontainer->dirty_pages_supported) {\n- /* TODO: query dirty bitmap before DMA unmap */\n- return iommufd_backend_unmap_dma(be, ioas_id, iova, size);\n+ ret = vfio_container_query_dirty_bitmap(bcontainer, iova, size,\n+ iotlb->translated_addr,\n+ &local_err);\n+ if (ret) {\n+ error_report_err(local_err);\n+ }\n+ /* Unmap stale mapping even if query dirty bitmap fails */\n+ unmap_ret = iommufd_backend_unmap_dma(be, ioas_id, iova, size);\n+\n+ /*\n+ * If dirty tracking fails, return the failure to VFIO core to\n+ * fail the migration, or else there will be dirty pages missed\n+ * to be migrated.\n+ */\n+ return unmap_ret ? : ret;\n }\n \n need_dirty_sync = true;\n", "prefixes": [ "v6", "2/9" ] }