mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: device_manager: always tear down vfio_user DMA handlers on eject
The PciDeviceHandle::VfioUser arm in eject_device propagated dma_unmap failures with ?, which short-circuited the subsequent remove_dma_mapping_handler loop and left stale Arc<VfioUserDmaMapping> entries in every virtio-mem device's handler map. Log unmap errors with warn! and continue so the handler map cleanup always runs. This only happens if a vfio-user process crashes and the same device is later removed. However, given we've seen similar issues on vhost-user this is probably worth cleaning up. Signed-off-by: Dylan Reid <dgreid@fb.com>
This commit is contained in:
@@ -4832,8 +4832,11 @@ impl DeviceManager {
|
|||||||
let mut dev = vfio_user_pci_device.lock().unwrap();
|
let mut dev = vfio_user_pci_device.lock().unwrap();
|
||||||
for (_, zone) in self.memory_manager.lock().unwrap().memory_zones().iter() {
|
for (_, zone) in self.memory_manager.lock().unwrap().memory_zones().iter() {
|
||||||
for region in zone.regions() {
|
for region in zone.regions() {
|
||||||
dev.dma_unmap(region)
|
// On error, log, but continue so the loop below removing the mapping from
|
||||||
.map_err(DeviceManagerError::VfioUserDmaUnmap)?;
|
// the devices runs.
|
||||||
|
if let Err(e) = dev.dma_unmap(region) {
|
||||||
|
warn!("vfio-user dma_unmap failed during eject: {e}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user