]> git.baikalelectronics.ru Git - kernel.git/commit
selftests: KVM: Don't leak GIC FD across dirty log test iterations
authorOliver Upton <oupton@google.com>
Wed, 6 Apr 2022 23:56:14 +0000 (23:56 +0000)
committerMarc Zyngier <maz@kernel.org>
Thu, 7 Apr 2022 07:46:13 +0000 (08:46 +0100)
commit6257a9d33cf92c1da0e0a1518f2934682836d545
tree09ad1d78e0cf77d919869f43b43e53745e4e043c
parentc3d82a65b83c53a579d5ad6eeb0527dba5873a14
selftests: KVM: Don't leak GIC FD across dirty log test iterations

dirty_log_perf_test instantiates a VGICv3 for the guest (if supported by
hardware) to reduce the overhead of guest exits. However, the test does
not actually close the GIC fd when cleaning up the VM between test
iterations, meaning that the VM is never actually destroyed in the
kernel.

While this is generally a bad idea, the bug was detected from the kernel
spewing about duplicate debugfs entries as subsequent VMs happen to
reuse the same FD even though the debugfs directory is still present.

Abstract away the notion of setup/cleanup of the GIC FD from the test
by creating arch-specific helpers for test setup/cleanup. Close the GIC
FD on VM cleanup and do nothing for the other architectures.

Fixes: aee4bd55c389 ("KVM: selftests: Add vgic initialization for dirty log perf test for ARM")
Reviewed-by: Jing Zhang <jingzhangos@google.com>
Signed-off-by: Oliver Upton <oupton@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220406235615.1447180-3-oupton@google.com
tools/testing/selftests/kvm/dirty_log_perf_test.c