]> www.infradead.org Git - users/dwmw2/linux.git/commit
KVM: selftests: Add helpers to convert guest memory b/w private and shared
authorVishal Annapurve <vannapurve@google.com>
Fri, 27 Oct 2023 18:22:09 +0000 (11:22 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 14 Nov 2023 13:01:06 +0000 (08:01 -0500)
commitf7fa67495d118f734f98b406fd46888616b4a3c3
tree644b93b8eabc2af1f2a72a17d23f389ba4565e93
parentbb2968ad6c33c0902dce48ea57d58c5bb4f3c617
KVM: selftests: Add helpers to convert guest memory b/w private and shared

Add helpers to convert memory between private and shared via KVM's
memory attributes, as well as helpers to free/allocate guest_memfd memory
via fallocate().  Userspace, i.e. tests, is NOT required to do fallocate()
when converting memory, as the attributes are the single source of truth.
Provide allocate() helpers so that tests can mimic a userspace that frees
private memory on conversion, e.g. to prioritize memory usage over
performance.

Signed-off-by: Vishal Annapurve <vannapurve@google.com>
Co-developed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20231027182217.3615211-28-seanjc@google.com>
Reviewed-by: Fuad Tabba <tabba@google.com>
Tested-by: Fuad Tabba <tabba@google.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/include/kvm_util_base.h
tools/testing/selftests/kvm/lib/kvm_util.c