[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANgfPd-D66s=78d8VbHHnpRLnWg134o+CApBVPRG2pUBSDR1Rw@mail.gmail.com>
Date: Wed, 10 Feb 2021 17:32:53 -0800
From: Ben Gardon <bgardon@...gle.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, kvm <kvm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Yanan Wang <wangyanan55@...wei.com>,
Andrew Jones <drjones@...hat.com>,
Peter Xu <peterx@...hat.com>,
Aaron Lewis <aaronlewis@...gle.com>
Subject: Re: [PATCH 11/15] KVM: selftests: Create VM with adjusted number of
guest pages for perf tests
On Wed, Feb 10, 2021 at 3:06 PM Sean Christopherson <seanjc@...gle.com> wrote:
>
> Use the already computed guest_num_pages when creating the so called
> extra VM pages for a perf test, and add a comment explaining why the
> pages are allocated as extra pages.
>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
Reviewed-by: Ben Gardon <bgardon@...gle.com>
> ---
> tools/testing/selftests/kvm/lib/perf_test_util.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/lib/perf_test_util.c b/tools/testing/selftests/kvm/lib/perf_test_util.c
> index 982a86c8eeaa..9b0cfdf10772 100644
> --- a/tools/testing/selftests/kvm/lib/perf_test_util.c
> +++ b/tools/testing/selftests/kvm/lib/perf_test_util.c
> @@ -71,9 +71,12 @@ struct kvm_vm *perf_test_create_vm(enum vm_guest_mode mode, int vcpus,
> TEST_ASSERT(vcpu_memory_bytes % pta->guest_page_size == 0,
> "Guest memory size is not guest page size aligned.");
>
> - vm = vm_create_with_vcpus(mode, vcpus,
> - (vcpus * vcpu_memory_bytes) / pta->guest_page_size,
> - 0, guest_code, NULL);
> + /*
> + * Pass guest_num_pages to populate the page tables for test memory.
> + * The memory is also added to memslot 0, but that's a benign side
> + * effect as KVM allows aliasing HVAs in memslots.
> + */
> + vm = vm_create_with_vcpus(mode, vcpus, 0, guest_num_pages, guest_code, NULL);
> pta->vm = vm;
>
> /*
> --
> 2.30.0.478.g8a0d178c01-goog
>
Powered by blists - more mailing lists