Re: [PATCH v2 07/13] KVM: selftests: Create a new guest_memfd for each testcase
From: Lisa Wang
Date: Tue Oct 07 2025 - 18:55:00 EST
Fri, Oct 03, 2025 at 04:26:00PM -0700, Sean Christopherson wrote:
> 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@xxxxxxx
> Reported-by: Ackerley Tng <ackerleytng@xxxxxxxxxx>
> Reviewed-by: Fuad Tabba <tabba@xxxxxxxxxx>
> Tested-by: Fuad Tabba <tabba@xxxxxxxxxx>
> Reviewed-by: David Hildenbrand <david@xxxxxxxxxx>
> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
> ---
> .../testing/selftests/kvm/guest_memfd_test.c | 31 ++++++++++---------
> 1 file changed, 16 insertions(+), 15 deletions(-)
>
> [...snip...]
>
Reviewed-by: Lisa Wang <wyihan@xxxxxxxxxx>
Tested-by: Lisa Wang <wyihan@xxxxxxxxxx>