Re: [PATCH v10 40/41] KVM: selftests: Update private_mem_conversions_test to mmap() guest_memfd

From: Xiaoyao Li

Date: Thu Aug 20 2026 - 23:12:53 EST


On 8/8/2026 5:53 AM, Ackerley Tng via B4 Relay wrote:
From: Ackerley Tng<ackerleytng@xxxxxxxxxx>

Update the private memory conversions selftest to also test conversions
that are done "in-place" via per-guest_memfd memory attributes. In-place
conversions require the host to be able to mmap() the guest_memfd so that
the host and guest can share the same backing physical memory.

This includes several updates, that are conditioned on the system
supporting per-guest_memfd attributes (kvm_has_gmem_attributes):

1. Set up guest_memfd requesting MMAP and INIT_SHARED.

If I understand correctly, even with in-place gmem, the model that shared memory comes from the userspace_addr and private memory comes from gmem can still work without passing GUEST_MEMFD_FLAG_MMAP flag.

Since this model is not prohibited by KVM. I think we should keep the testcase for this model to ensure test coverage?