Re: [PATCH 09/15] KVM: selftests: Move per-VM GPA into perf_test_args
From: Sean Christopherson
Date: Wed Feb 10 2021 - 21:02:57 EST
On Wed, Feb 10, 2021, Ben Gardon wrote:
> > diff --git a/tools/testing/selftests/kvm/lib/perf_test_util.c b/tools/testing/selftests/kvm/lib/perf_test_util.c
> > index f22ce1836547..03f125236021 100644
> > --- a/tools/testing/selftests/kvm/lib/perf_test_util.c
> > +++ b/tools/testing/selftests/kvm/lib/perf_test_util.c
> > @@ -9,8 +9,6 @@
> >
> > struct perf_test_args perf_test_args;
> >
> > -uint64_t guest_test_phys_mem;
> > -
> > /*
> > * Guest virtual memory offset of the testing memory slot.
> > * Must not conflict with identity mapped test code.
> > @@ -87,29 +85,25 @@ struct kvm_vm *perf_test_create_vm(enum vm_guest_mode mode, int vcpus,
> > TEST_ASSERT(guest_num_pages < vm_get_max_gfn(vm),
> > "Requested more guest memory than address space allows.\n"
> > " guest pages: %lx max gfn: %x vcpus: %d wss: %lx]\n",
> > - guest_num_pages, vm_get_max_gfn(vm), vcpus,
> > - vcpu_memory_bytes);
> > + guest_num_pages, vm_get_max_gfn(vm), vcpus, vcpu_memory_bytes);
> >
> > - guest_test_phys_mem = (vm_get_max_gfn(vm) - guest_num_pages) *
> > - pta->guest_page_size;
> > - guest_test_phys_mem &= ~(pta->host_page_size - 1);
> > + pta->gpa = (vm_get_max_gfn(vm) - guest_num_pages) * pta->guest_page_size;
> > + pta->gpa &= ~(pta->host_page_size - 1);
>
> Also not related to this patch, but another case for align.
>
> > if (backing_src == VM_MEM_SRC_ANONYMOUS_THP ||
> > backing_src == VM_MEM_SRC_ANONYMOUS_HUGETLB)
> > - guest_test_phys_mem &= ~(KVM_UTIL_HUGEPAGE_ALIGNMENT - 1);
> > -
> > + pta->gpa &= ~(KVM_UTIL_HUGEPAGE_ALIGNMENT - 1);
>
> also align
>
> > #ifdef __s390x__
> > /* Align to 1M (segment size) */
> > - guest_test_phys_mem &= ~((1 << 20) - 1);
> > + pta->gpa &= ~((1 << 20) - 1);
>
> And here again (oof)
Yep, I'll fix all these and the align() comment in v2.