[PATCH 03/13] fixup! KVM: selftests: Support multiple vCPUs in demand paging test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[guest_code() can't return, use GUEST_ASSERT(). Ensure the number
 of guests pages is compatible with the host.]
Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
---
 tools/testing/selftests/kvm/demand_paging_test.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/kvm/demand_paging_test.c b/tools/testing/selftests/kvm/demand_paging_test.c
index ec8860b70129..2e6e3db8418a 100644
--- a/tools/testing/selftests/kvm/demand_paging_test.c
+++ b/tools/testing/selftests/kvm/demand_paging_test.c
@@ -115,9 +115,8 @@ static void guest_code(uint32_t vcpu_id)
 	uint64_t pages;
 	int i;
 
-	/* Return to signal error if vCPU args data structure is courrupt. */
-	if (vcpu_args[vcpu_id].vcpu_id != vcpu_id)
-		return;
+	/* Make sure vCPU args data structure is not corrupt. */
+	GUEST_ASSERT(vcpu_args[vcpu_id].vcpu_id == vcpu_id);
 
 	gva = vcpu_args[vcpu_id].gva;
 	pages = vcpu_args[vcpu_id].pages;
@@ -186,6 +185,12 @@ static struct kvm_vm *create_vm(enum vm_guest_mode mode, int vcpus,
 	pages += ((2 * vcpus * vcpu_memory_bytes) >> PAGE_SHIFT_4K) /
 		 PTES_PER_4K_PT;
 
+	/*
+	 * If the host is uing 64K pages, then we need the number of 4K
+	 * guest pages to be a multiple of 16.
+	 */
+	pages += 16 - pages % 16;
+
 	vm = _vm_create(mode, pages, O_RDWR);
 	kvm_vm_elf_load(vm, program_invocation_name, 0, 0);
 #ifdef __x86_64__
-- 
2.21.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux