KVM: selftests: Adapt vm_userspace_mem_region_add to new helpers
authorYanan Wang <wangyanan55@huawei.com>
Tue, 30 Mar 2021 08:08:55 +0000 (16:08 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 20 Apr 2021 08:18:53 +0000 (04:18 -0400)
commita4b3c8b583bfc8b3a3d04c63a527cbd081eac9f7
tree08221a4e0924b924871b8c936dea230fd1e472af
parent623653b7d4622cb7d016e9a81e6a9d0d9b1326df
KVM: selftests: Adapt vm_userspace_mem_region_add to new helpers

With VM_MEM_SRC_ANONYMOUS_THP specified in vm_userspace_mem_region_add(),
we have to get the transparent hugepage size for HVA alignment. With the
new helpers, we can use get_backing_src_pagesz() to check whether THP is
configured and then get the exact configured hugepage size.

As different architectures may have different THP page sizes configured,
this can get the accurate THP page sizes on any platform.

Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
Reviewed-by: Ben Gardon <bgardon@google.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Message-Id: <20210330080856.14940-10-wangyanan55@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/lib/kvm_util.c