Skip to content

Instantly share code, notes, and snippets.

@enukane
Created July 29, 2012 09:43
Show Gist options
  • Save enukane/3197085 to your computer and use it in GitHub Desktop.
Save enukane/3197085 to your computer and use it in GitHub Desktop.
fix panic (sleeping thread) on vmmctl --destroy --vm=* when bhyve is runnning
Index: sys/amd64/vmm/vmm_dev.c
===================================================================
--- sys/amd64/vmm/vmm_dev.c (revision 238860)
+++ sys/amd64/vmm/vmm_dev.c (working copy)
@@ -378,7 +378,9 @@
* XXX must stop virtual machine instances that may be still
* running and cleanup their state.
*/
+ mtx_lock(&vmmdev_mtx);
SLIST_REMOVE(&head, sc, vmmdev_softc, link);
+ mtx_unlock(&vmmdev_mtx);
destroy_dev(sc->cdev);
vm_destroy(sc->vm);
free(sc, M_VMMDEV);
@@ -398,12 +400,11 @@
mtx_lock(&vmmdev_mtx);
sc = vmmdev_lookup(buf);
+ mtx_unlock(&vmmdev_mtx);
if (sc == NULL) {
- mtx_unlock(&vmmdev_mtx);
return (EINVAL);
}
vmmdev_destroy(sc);
- mtx_unlock(&vmmdev_mtx);
return (0);
}
SYSCTL_PROC(_hw_vmm, OID_AUTO, destroy, CTLTYPE_STRING | CTLFLAG_RW,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment