[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANgfPd_ozRcsXR9_SsZpEk3_q6epL--=8FbktygNnCKLi5W5Cw@mail.gmail.com>
Date: Wed, 10 Feb 2021 16:52:38 -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 03/15] KVM: selftests: Align HVA for HugeTLB-backed memslots
On Wed, Feb 10, 2021 at 3:06 PM Sean Christopherson <seanjc@...gle.com> wrote:
>
> 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 <bgardon@...gle.com>
> Cc: Yanan Wang <wangyanan55@...wei.com>
> Cc: Andrew Jones <drjones@...hat.com>
> Cc: Peter Xu <peterx@...hat.com>
> Cc: Aaron Lewis <aaronlewis@...gle.com>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
Reviewed-by: Ben Gardon <bgardon@...gle.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
>
Powered by blists - more mailing lists