svn commit: r255661 - projects/bhyve_npt_pmap/sys/amd64/vmm
Neel Natu
neel at FreeBSD.org
Wed Sep 18 03:51:50 UTC 2013
Author: neel
Date: Wed Sep 18 03:51:49 2013
New Revision: 255661
URL: http://svnweb.freebsd.org/changeset/base/255661
Log:
Destroy the iommu domain in vm_destroy() in preference to doing it when the
last passthru device is detached from the virtual machine.
There are code paths in vm_assign_pptdev() where we can return after creating
the iommu domain but before the first passthru device is successfully attached.
In this case there aren't any passthru devices attached to the virtual machine
and therefore vm_unassign_pptdev() will not be called and the iommu domain
is not destroyed.
This is very easy to reproduce by trying to attach a non-existent passthru
device to the virtual machine and then destroying the virtual machine.
Modified:
projects/bhyve_npt_pmap/sys/amd64/vmm/vmm.c
Modified: projects/bhyve_npt_pmap/sys/amd64/vmm/vmm.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/amd64/vmm/vmm.c Wed Sep 18 00:33:24 2013 (r255660)
+++ projects/bhyve_npt_pmap/sys/amd64/vmm/vmm.c Wed Sep 18 03:51:49 2013 (r255661)
@@ -331,7 +331,8 @@ vm_destroy(struct vm *vm)
ppt_unassign_all(vm);
- KASSERT(vm->iommu == NULL, ("vm_destroy: iommu should be NULL"));
+ if (vm->iommu != NULL)
+ iommu_destroy_domain(vm->iommu);
for (i = 0; i < vm->num_mem_segs; i++)
vm_free_mem_seg(vm, &vm->mem_segs[i]);
@@ -564,8 +565,6 @@ vm_unassign_pptdev(struct vm *vm, int bu
if (ppt_num_devices(vm) == 0) {
vm_iommu_unmap(vm);
vm_gpa_unwire(vm);
- iommu_destroy_domain(vm->iommu);
- vm->iommu = NULL;
}
return (0);
}
More information about the svn-src-projects
mailing list