]> www.infradead.org Git - users/jedix/linux-maple.git/commit
KVM: selftests: Don't bother deleting memslots in KVM when freeing VMs
authorSean Christopherson <seanjc@google.com>
Thu, 7 Nov 2024 19:39:59 +0000 (11:39 -0800)
committerOliver Upton <oliver.upton@linux.dev>
Mon, 11 Nov 2024 18:45:29 +0000 (18:45 +0000)
commit5afe18dfa47daead88517b095b6e0ce012f031f8
tree91f1fdc64fc80021fd42d212022cd4be4c5049fa
parent38d7aacca09230fdb98a34194fec2af597e8e20d
KVM: selftests: Don't bother deleting memslots in KVM when freeing VMs

When freeing a VM, don't call into KVM to manually remove each memslot,
simply cleanup and free any userspace assets associated with the memory
region.  KVM is ultimately responsible for ensuring kernel resources are
freed when the VM is destroyed, deleting memslots one-by-one is
unnecessarily slow, and unless a test is already leaking the VM fd, the
VM will be destroyed when kvm_vm_release() is called.

Not deleting KVM's memslot also allows cleaning up dead VMs without having
to care whether or not the to-be-freed VM is dead or alive.

Reported-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Reported-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Link: https://lore.kernel.org/kvmarm/Zy0bcM0m-N18gAZz@google.com/
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
tools/testing/selftests/kvm/lib/kvm_util.c