Files
cloud-hypervisor/vmm
Saravanan D 5a14d0e2e0 vmm: clear VFIO MMIO regions in DeviceManager::drop
DeviceManager and VfioPciDevice both hold Arc<MmapRegion> for
each VFIO BAR mmap window. During VM shutdown, VfioPciDevice
drops after DeviceManager::Drop::drop (via device_tree
field drop). Without clearing DeviceManager's clones first,
VfioPciDevice::unmap_mmio_regions decrements the Arc but
does not reach zero, munmap never fires, the VFIO device
file VMAs survive, and VFIO_GROUP_UNSET_CONTAINER returns
EBUSY.

Clear DeviceManager's mmio_regions in Drop::drop so
VfioPciDevice is the sole Arc owner at drop time and ensure
VFIO_GROUP_UNSET_CONTAINER ioctl success.

Remove redundant .clone() on the mmio_regions() return value
in the eject_device() hot-unplug path.

Add detail comments

Signed-off-by: Saravanan D <saravanand@crusoe.ai>
2026-04-20 18:10:17 +00:00
..