diff --git a/sys/amd64/vmm/io/vatpic.c b/sys/amd64/vmm/io/vatpic.c --- a/sys/amd64/vmm/io/vatpic.c +++ b/sys/amd64/vmm/io/vatpic.c @@ -809,6 +809,7 @@ void vatpic_cleanup(struct vatpic *vatpic) { + mtx_destroy(&vatpic->mtx); free(vatpic, M_VATPIC); } diff --git a/sys/amd64/vmm/io/vatpit.c b/sys/amd64/vmm/io/vatpit.c --- a/sys/amd64/vmm/io/vatpit.c +++ b/sys/amd64/vmm/io/vatpit.c @@ -470,6 +470,7 @@ for (i = 0; i < 3; i++) callout_drain(&vatpit->channel[i].callout); + mtx_destroy(&vatpit->mtx); free(vatpit, M_VATPIT); } diff --git a/sys/amd64/vmm/io/vhpet.c b/sys/amd64/vmm/io/vhpet.c --- a/sys/amd64/vmm/io/vhpet.c +++ b/sys/amd64/vmm/io/vhpet.c @@ -754,6 +754,7 @@ for (i = 0; i < VHPET_NUM_TIMERS; i++) callout_drain(&vhpet->timer[i].callout); + mtx_destroy(&vhpet->mtx); free(vhpet, M_VHPET); } diff --git a/sys/amd64/vmm/io/vioapic.c b/sys/amd64/vmm/io/vioapic.c --- a/sys/amd64/vmm/io/vioapic.c +++ b/sys/amd64/vmm/io/vioapic.c @@ -508,6 +508,7 @@ vioapic_cleanup(struct vioapic *vioapic) { + mtx_destroy(&vioapic->mtx); free(vioapic, M_VIOAPIC); } diff --git a/sys/amd64/vmm/io/vlapic.c b/sys/amd64/vmm/io/vlapic.c --- a/sys/amd64/vmm/io/vlapic.c +++ b/sys/amd64/vmm/io/vlapic.c @@ -1641,6 +1641,7 @@ { callout_drain(&vlapic->callout); + mtx_destroy(&vlapic->timer_mtx); } uint64_t diff --git a/sys/amd64/vmm/io/vrtc.c b/sys/amd64/vmm/io/vrtc.c --- a/sys/amd64/vmm/io/vrtc.c +++ b/sys/amd64/vmm/io/vrtc.c @@ -1018,6 +1018,7 @@ { callout_drain(&vrtc->callout); + mtx_destroy(&vrtc->mtx); free(vrtc, M_VRTC); } diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c --- a/sys/amd64/vmm/vmm.c +++ b/sys/amd64/vmm/vmm.c @@ -128,6 +128,7 @@ #define vcpu_lock_initialized(v) mtx_initialized(&((v)->mtx)) #define vcpu_lock_init(v) mtx_init(&((v)->mtx), "vcpu lock", 0, MTX_SPIN) +#define vcpu_lock_destroy(v) mtx_destroy(&((v)->mtx)) #define vcpu_lock(v) mtx_lock_spin(&((v)->mtx)) #define vcpu_unlock(v) mtx_unlock_spin(&((v)->mtx)) #define vcpu_assert_locked(v) mtx_assert(&((v)->mtx), MA_OWNED) @@ -320,6 +321,7 @@ if (destroy) { vmm_stat_free(vcpu->stats); fpu_save_area_free(vcpu->guestfpu); + vcpu_lock_destroy(vcpu); } } @@ -606,6 +608,8 @@ vmmops_vmspace_free(vm->vmspace); vm->vmspace = NULL; + + mtx_destroy(&vm->rendezvous_mtx); } } diff --git a/sys/amd64/vmm/vmm_dev.c b/sys/amd64/vmm/vmm_dev.c --- a/sys/amd64/vmm/vmm_dev.c +++ b/sys/amd64/vmm/vmm_dev.c @@ -103,6 +103,7 @@ static unsigned pr_allow_flag; static struct mtx vmmdev_mtx; +MTX_SYSINIT(vmmdev_mtx, &vmmdev_mtx, "vmm device mutex", MTX_DEF); static MALLOC_DEFINE(M_VMMDEV, "vmmdev", "vmmdev"); @@ -1216,7 +1217,6 @@ void vmmdev_init(void) { - mtx_init(&vmmdev_mtx, "vmm device mutex", NULL, MTX_DEF); pr_allow_flag = prison_add_allow(NULL, "vmm", NULL, "Allow use of vmm in a jail."); }