git: 08ebb3607647 - main - vmm: Destroy mutexes.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 18 Nov 2022 18:26:51 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=08ebb360764729632e1f6bc4e3f434abdd708204
commit 08ebb360764729632e1f6bc4e3f434abdd708204
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-11-18 18:04:30 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-11-18 18:25:38 +0000
vmm: Destroy mutexes.
Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37171
---
sys/amd64/vmm/io/vatpic.c | 1 +
sys/amd64/vmm/io/vatpit.c | 1 +
sys/amd64/vmm/io/vhpet.c | 1 +
sys/amd64/vmm/io/vioapic.c | 1 +
sys/amd64/vmm/io/vlapic.c | 1 +
sys/amd64/vmm/io/vrtc.c | 1 +
sys/amd64/vmm/vmm.c | 4 ++++
sys/amd64/vmm/vmm_dev.c | 2 +-
8 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/sys/amd64/vmm/io/vatpic.c b/sys/amd64/vmm/io/vatpic.c
index 5ece5d433244..d959909d7cdc 100644
--- a/sys/amd64/vmm/io/vatpic.c
+++ b/sys/amd64/vmm/io/vatpic.c
@@ -809,6 +809,7 @@ vatpic_init(struct vm *vm)
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
index 7626b4dc4cc2..c58a6da66c1a 100644
--- a/sys/amd64/vmm/io/vatpit.c
+++ b/sys/amd64/vmm/io/vatpit.c
@@ -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);
}
diff --git a/sys/amd64/vmm/io/vhpet.c b/sys/amd64/vmm/io/vhpet.c
index dd409cde188f..7e73684ebad2 100644
--- a/sys/amd64/vmm/io/vhpet.c
+++ b/sys/amd64/vmm/io/vhpet.c
@@ -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);
}
diff --git a/sys/amd64/vmm/io/vioapic.c b/sys/amd64/vmm/io/vioapic.c
index e41b5acac920..00a206fa604d 100644
--- a/sys/amd64/vmm/io/vioapic.c
+++ b/sys/amd64/vmm/io/vioapic.c
@@ -508,6 +508,7 @@ void
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
index 9c61726e77d7..1a8b54bba3bf 100644
--- a/sys/amd64/vmm/io/vlapic.c
+++ b/sys/amd64/vmm/io/vlapic.c
@@ -1641,6 +1641,7 @@ vlapic_cleanup(struct vlapic *vlapic)
{
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
index d950bd68ad04..9cf70027f3d8 100644
--- a/sys/amd64/vmm/io/vrtc.c
+++ b/sys/amd64/vmm/io/vrtc.c
@@ -1018,6 +1018,7 @@ vrtc_cleanup(struct vrtc *vrtc)
{
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
index fa6420aab1c2..c8a45c7aa811 100644
--- a/sys/amd64/vmm/vmm.c
+++ b/sys/amd64/vmm/vmm.c
@@ -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);
}
}
diff --git a/sys/amd64/vmm/vmm_dev.c b/sys/amd64/vmm/vmm_dev.c
index a007a25aa9b5..249131b16464 100644
--- a/sys/amd64/vmm/vmm_dev.c
+++ b/sys/amd64/vmm/vmm_dev.c
@@ -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.");
}