* [PATCH v1] vhost-vdpa: Avoid unbalanced IOMMU region unref
@ 2026-09-11 14:39 Yuho Choi
0 siblings, 0 replies; only message in thread
From: Yuho Choi @ 2026-09-11 14:39 UTC (permalink / raw)
To: qemu-devel; +Cc: Cindy Lu, Yuho Choi
vhost_vdpa_listener_region_add() handles IOMMU regions separately and
returns without calling memory_region_ref(). Its delete counterpart
removes the IOMMU notifier, continues through the shared DMA unmap path,
and then unconditionally drops an owner reference that was never acquired.
Limit memory_region_unref() to non-IOMMU regions. This keeps the existing
full-range DMA unmap for IOMMU teardown while balancing the references
acquired for RAM sections.
Fixes: bc7b0cac7bf4 ("vhost-vdpa: Add support for vIOMMU.")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
---
hw/virtio/vhost-vdpa.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 9e1aa4860a8..2a067afd0a5 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -487,7 +487,9 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener,
s, iova, int128_get64(llsize), ret);
}
- memory_region_unref(section->mr);
+ if (!memory_region_is_iommu(section->mr)) {
+ memory_region_unref(section->mr);
+ }
}
/*
* IOTLB API is used by vhost-vdpa which requires incremental updating
--
2.43.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-11 14:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-11 14:39 [PATCH v1] vhost-vdpa: Avoid unbalanced IOMMU region unref Yuho Choi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.