MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vmmdev_destroy

Function vmmdev_destroy

freebsd/amd64/vmm/vmm_dev.c:947–977  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

945}
946
947static void
948vmmdev_destroy(void *arg)
949{
950 struct vmmdev_softc *sc = arg;
951 struct devmem_softc *dsc;
952 int error;
953
954 error = vcpu_lock_all(sc);
955 KASSERT(error == 0, ("%s: error %d freezing vcpus", __func__, error));
956
957 while ((dsc = SLIST_FIRST(&sc->devmem)) != NULL) {
958 KASSERT(dsc->cdev == NULL, ("%s: devmem not free", __func__));
959 SLIST_REMOVE_HEAD(&sc->devmem, link);
960 free(dsc->name, M_VMMDEV);
961 free(dsc, M_VMMDEV);
962 }
963
964 if (sc->cdev != NULL)
965 destroy_dev(sc->cdev);
966
967 if (sc->vm != NULL)
968 vm_destroy(sc->vm);
969
970 if ((sc->flags & VSC_LINKED) != 0) {
971 mtx_lock(&vmmdev_mtx);
972 SLIST_REMOVE(&head, sc, vmmdev_softc, link);
973 mtx_unlock(&vmmdev_mtx);
974 }
975
976 free(sc, M_VMMDEV);
977}
978
979static int
980sysctl_vmm_destroy(SYSCTL_HANDLER_ARGS)

Callers 1

sysctl_vmm_createFunction · 0.85

Calls 6

vcpu_lock_allFunction · 0.85
destroy_devFunction · 0.85
vm_destroyFunction · 0.85
freeFunction · 0.50
mtx_lockFunction · 0.50
mtx_unlockFunction · 0.50

Tested by

no test coverage detected