diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2025-10-10 13:16:45 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2025-10-10 13:22:40 +0000 |
| commit | 756fa1c09673ba555f603574af5943f455daff90 (patch) | |
| tree | 2458e6f52f1f0eb453f85b956a7e3e4c9c1962a7 | |
| parent | 188ddc15e5460b3abfb2ad5492557911465bedc1 (diff) | |
vmm: Unify implementations of vcpu_cleanup()
Different vmm implementations were freeing the per-vCPU structure in
different places. Make the implementations consistent. No functional
change intended.
Reviewed by: corvink
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53010
| -rw-r--r-- | sys/arm64/vmm/vmm.c | 3 | ||||
| -rw-r--r-- | sys/riscv/vmm/vmm.c | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/sys/arm64/vmm/vmm.c b/sys/arm64/vmm/vmm.c index a551a2807183..5a0b627b2fe2 100644 --- a/sys/arm64/vmm/vmm.c +++ b/sys/arm64/vmm/vmm.c @@ -274,6 +274,7 @@ vcpu_cleanup(struct vcpu *vcpu, bool destroy) vmm_stat_free(vcpu->stats); fpu_save_area_free(vcpu->guestfpu); vcpu_lock_destroy(vcpu); + free(vcpu, M_VMM); } } @@ -585,8 +586,6 @@ vm_cleanup(struct vm *vm, bool destroy) vmmops_vmspace_free(vm->vmspace); vm->vmspace = NULL; - for (i = 0; i < vm->maxcpus; i++) - free(vm->vcpu[i], M_VMM); free(vm->vcpu, M_VMM); sx_destroy(&vm->vcpus_init_lock); } diff --git a/sys/riscv/vmm/vmm.c b/sys/riscv/vmm/vmm.c index ec4514f70fa6..b1e5c0e52ac8 100644 --- a/sys/riscv/vmm/vmm.c +++ b/sys/riscv/vmm/vmm.c @@ -174,6 +174,7 @@ vcpu_cleanup(struct vcpu *vcpu, bool destroy) vmm_stat_free(vcpu->stats); fpu_save_area_free(vcpu->guestfpu); vcpu_lock_destroy(vcpu); + free(vcpu, M_VMM); } } @@ -453,8 +454,6 @@ vm_cleanup(struct vm *vm, bool destroy) vmmops_vmspace_free(vm->vmspace); vm->vmspace = NULL; - for (i = 0; i < vm->maxcpus; i++) - free(vm->vcpu[i], M_VMM); free(vm->vcpu, M_VMM); sx_destroy(&vm->vcpus_init_lock); } |
