]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: selftests: Create a new guest_memfd for each testcase
authorSean Christopherson <seanjc@google.com>
Fri, 3 Oct 2025 23:26:00 +0000 (16:26 -0700)
committerSean Christopherson <seanjc@google.com>
Fri, 10 Oct 2025 21:25:26 +0000 (14:25 -0700)
commit21d602ed616aebae4de568be55db65a1f5a3be10
treee623fbea6dee3fd9f35bf7d6ef5dbb9265ed0e03
parent3a6c08538c742624c60cb6a53dd61eb025e0d1e1
KVM: selftests: Create a new guest_memfd for each testcase

Refactor the guest_memfd selftest to improve test isolation by creating a
a new guest_memfd for each testcase.  Currently, the test reuses a single
guest_memfd instance for all testcases, and thus creates dependencies
between tests, e.g. not truncating folios from the guest_memfd instance
at the end of a test could lead to unexpected results (see the PUNCH_HOLE
purging that needs to done by in-flight the NUMA testcases[1]).

Invoke each test via a macro wrapper to create and close a guest_memfd
to cut down on the boilerplate copy+paste needed to create a test.

Link: https://lore.kernel.org/all/20250827175247.83322-10-shivankg@amd.com
Reported-by: Ackerley Tng <ackerleytng@google.com>
Reviewed-by: Fuad Tabba <tabba@google.com>
Tested-by: Fuad Tabba <tabba@google.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Ackerley Tng <ackerleytng@google.com>
Tested-by: Ackerley Tng <ackerleytng@google.com>
Link: https://lore.kernel.org/r/20251003232606.4070510-8-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/guest_memfd_test.c