Thread (35 messages) 35 messages, 5 authors, 2021-03-13
STALE1951d

[PATCH 03/15] KVM: selftests: Align HVA for HugeTLB-backed memslots

From: Sean Christopherson <seanjc@google.com>
Date: 2021-02-10 23:08:47
Also in: lkml
Subsystem: kernel selftest framework, kernel virtual machine (kvm), the rest · Maintainers: Shuah Khan, Paolo Bonzini, Linus Torvalds

Align the HVA for HugeTLB memslots, not just THP memslots.  Add an
assert so any future backing types are forced to assess whether or not
they need to be aligned.

Cc: Ben Gardon <redacted>
Cc: Yanan Wang <redacted>
Cc: Andrew Jones <redacted>
Cc: Peter Xu <peterx@redhat.com>
Cc: Aaron Lewis <redacted>
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 tools/testing/selftests/kvm/lib/kvm_util.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
index 584167c6dbc7..deaeb47b5a6d 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util.c
+++ b/tools/testing/selftests/kvm/lib/kvm_util.c
@@ -731,8 +731,11 @@ void vm_userspace_mem_region_add(struct kvm_vm *vm,
 	alignment = 1;
 #endif
 
-	if (src_type == VM_MEM_SRC_ANONYMOUS_THP)
+	if (src_type == VM_MEM_SRC_ANONYMOUS_THP ||
+	    src_type == VM_MEM_SRC_ANONYMOUS_HUGETLB)
 		alignment = max(huge_page_size, alignment);
+	else
+		ASSERT_EQ(src_type, VM_MEM_SRC_ANONYMOUS);
 
 	/* Add enough memory to align up if necessary */
 	if (alignment > 1)
-- 
2.30.0.478.g8a0d178c01-goog
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help