vmm: Destroy mutexes.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37171
This commit is contained in:
John Baldwin 2022-11-18 10:04:30 -08:00
parent d5118d0fc4
commit 08ebb36076
8 changed files with 11 additions and 1 deletions

View File

@ -809,6 +809,7 @@ vatpic_init(struct vm *vm)
void
vatpic_cleanup(struct vatpic *vatpic)
{
mtx_destroy(&vatpic->mtx);
free(vatpic, M_VATPIC);
}

View File

@ -470,6 +470,7 @@ vatpit_cleanup(struct vatpit *vatpit)
for (i = 0; i < 3; i++)
callout_drain(&vatpit->channel[i].callout);
mtx_destroy(&vatpit->mtx);
free(vatpit, M_VATPIT);
}

View File

@ -754,6 +754,7 @@ vhpet_cleanup(struct vhpet *vhpet)
for (i = 0; i < VHPET_NUM_TIMERS; i++)
callout_drain(&vhpet->timer[i].callout);
mtx_destroy(&vhpet->mtx);
free(vhpet, M_VHPET);
}

View File

@ -508,6 +508,7 @@ void
vioapic_cleanup(struct vioapic *vioapic)
{
mtx_destroy(&vioapic->mtx);
free(vioapic, M_VIOAPIC);
}

View File

@ -1641,6 +1641,7 @@ vlapic_cleanup(struct vlapic *vlapic)
{
callout_drain(&vlapic->callout);
mtx_destroy(&vlapic->timer_mtx);
}
uint64_t

View File

@ -1018,6 +1018,7 @@ vrtc_cleanup(struct vrtc *vrtc)
{
callout_drain(&vrtc->callout);
mtx_destroy(&vrtc->mtx);
free(vrtc, M_VRTC);
}

View File

@ -128,6 +128,7 @@ struct vcpu {
#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 @@ vcpu_cleanup(struct vm *vm, int i, bool destroy)
if (destroy) {
vmm_stat_free(vcpu->stats);
fpu_save_area_free(vcpu->guestfpu);
vcpu_lock_destroy(vcpu);
}
}
@ -606,6 +608,8 @@ vm_cleanup(struct vm *vm, bool destroy)
vmmops_vmspace_free(vm->vmspace);
vm->vmspace = NULL;
mtx_destroy(&vm->rendezvous_mtx);
}
}

View File

@ -103,6 +103,7 @@ static SLIST_HEAD(, vmmdev_softc) head;
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 @@ SYSCTL_PROC(_hw_vmm, OID_AUTO, create,
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.");
}