[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAhV-H6v+tO6PCqjfDcecxk-mUk8YEmSDUMjOXMj1hL5=XSpSw@mail.gmail.com>
Date: Mon, 8 Jun 2020 16:56:32 +0800
From: Huacai Chen <chenhuacai@...il.com>
To: Sean Christopherson <sean.j.christopherson@...el.com>
Cc: Marc Zyngier <maz@...nel.org>, Paul Mackerras <paulus@...abs.org>,
Christian Borntraeger <borntraeger@...ibm.com>,
Janosch Frank <frankja@...ux.ibm.com>,
Paolo Bonzini <pbonzini@...hat.com>,
James Morse <james.morse@....com>,
Julien Thierry <julien.thierry.kdev@...il.com>,
Suzuki K Poulose <suzuki.poulose@....com>,
David Hildenbrand <david@...hat.com>,
Cornelia Huck <cohuck@...hat.com>,
Claudio Imbrenda <imbrenda@...ux.ibm.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
kvmarm@...ts.cs.columbia.edu,
"open list:MIPS" <linux-mips@...r.kernel.org>,
kvm <kvm@...r.kernel.org>, kvm-ppc@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>,
Peter Feiner <pfeiner@...gle.com>,
Peter Shier <pshier@...gle.com>,
Junaid Shahid <junaids@...gle.com>,
Ben Gardon <bgardon@...gle.com>,
Christoffer Dall <christoffer.dall@....com>
Subject: Re: [PATCH 19/21] KVM: MIPS: Drop @max param from mmu_topup_memory_cache()
Reviewed-by: Huacai Chen <chenhc@...ote.com>
On Sat, Jun 6, 2020 at 5:44 AM Sean Christopherson
<sean.j.christopherson@...el.com> wrote:
>
> Replace the @max param in mmu_topup_memory_cache() and instead use
> ARRAY_SIZE() to terminate the loop to fill the cache. This removes a
> BUG_ON() and sets the stage for moving MIPS to the common memory cache
> implementation.
>
> No functional change intended.
>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@...el.com>
> ---
> arch/mips/kvm/mmu.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/arch/mips/kvm/mmu.c b/arch/mips/kvm/mmu.c
> index 7dad7a293eae..94562c54b930 100644
> --- a/arch/mips/kvm/mmu.c
> +++ b/arch/mips/kvm/mmu.c
> @@ -25,15 +25,13 @@
> #define KVM_MMU_CACHE_MIN_PAGES 2
> #endif
>
> -static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache,
> - int min, int max)
> +static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache, int min)
> {
> void *page;
>
> - BUG_ON(max > KVM_NR_MEM_OBJS);
> if (cache->nobjs >= min)
> return 0;
> - while (cache->nobjs < max) {
> + while (cache->nobjs < ARRAY_SIZE(cache->objects)) {
> page = (void *)__get_free_page(GFP_KERNEL);
> if (!page)
> return -ENOMEM;
> @@ -711,8 +709,7 @@ static int kvm_mips_map_page(struct kvm_vcpu *vcpu, unsigned long gpa,
> goto out;
>
> /* We need a minimum of cached pages ready for page table creation */
> - err = mmu_topup_memory_cache(memcache, KVM_MMU_CACHE_MIN_PAGES,
> - KVM_NR_MEM_OBJS);
> + err = mmu_topup_memory_cache(memcache, KVM_MMU_CACHE_MIN_PAGES);
> if (err)
> goto out;
>
> @@ -796,8 +793,7 @@ static pte_t *kvm_trap_emul_pte_for_gva(struct kvm_vcpu *vcpu,
> int ret;
>
> /* We need a minimum of cached pages ready for page table creation */
> - ret = mmu_topup_memory_cache(memcache, KVM_MMU_CACHE_MIN_PAGES,
> - KVM_NR_MEM_OBJS);
> + ret = mmu_topup_memory_cache(memcache, KVM_MMU_CACHE_MIN_PAGES);
> if (ret)
> return NULL;
>
> --
> 2.26.0
>
Powered by blists - more mailing lists