[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220504224914.1654036-31-seanjc@google.com>
Date: Wed, 4 May 2022 22:47:36 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Paolo Bonzini <pbonzini@...hat.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Andrew Jones <drjones@...hat.com>,
David Matlack <dmatlack@...gle.com>,
Ben Gardon <bgardon@...gle.com>,
Oliver Upton <oupton@...gle.com>,
Sean Christopherson <seanjc@...gle.com>
Subject: [PATCH 030/128] KVM: selftests: Push vm_adjust_num_guest_pages() into
"w/o vCPUs" helper
Move the call to vm_adjust_num_guest_pages() from vm_create_with_vcpus()
down into vm_create_without_vcpus(). This will allow a future patch to
make the "w/o vCPUs" variant the common inner helper, e.g. so that the
"with_vcpus" helper calls the "without_vcpus" helper, instead of having
them be separate paths.
Signed-off-by: Sean Christopherson <seanjc@...gle.com>
---
tools/testing/selftests/kvm/lib/kvm_util.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c
index bf14574288e7..9a82d44e427d 100644
--- a/tools/testing/selftests/kvm/lib/kvm_util.c
+++ b/tools/testing/selftests/kvm/lib/kvm_util.c
@@ -286,6 +286,8 @@ struct kvm_vm *vm_create_without_vcpus(enum vm_guest_mode mode, uint64_t pages)
{
struct kvm_vm *vm;
+ pages = vm_adjust_num_guest_pages(VM_MODE_DEFAULT, pages);
+
vm = __vm_create(mode, pages);
kvm_vm_elf_load(vm, program_invocation_name);
@@ -345,8 +347,6 @@ struct kvm_vm *vm_create_with_vcpus(enum vm_guest_mode mode, uint32_t nr_vcpus,
"nr_vcpus = %d too large for host, max-vcpus = %d",
nr_vcpus, kvm_check_cap(KVM_CAP_MAX_VCPUS));
- pages = vm_adjust_num_guest_pages(mode, pages);
-
vm = vm_create_without_vcpus(mode, pages);
for (i = 0; i < nr_vcpus; ++i) {
--
2.36.0.464.gb9c8b46e94-goog
Powered by blists - more mailing lists