[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87mwb861sy.fsf@linux.vnet.ibm.com>
Date: Wed, 13 Aug 2014 17:26:13 +0530
From: "Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
To: Alexey Kardashevskiy <aik@...abs.ru>, linuxppc-dev@...ts.ozlabs.org
Cc: Alexey Kardashevskiy <aik@...abs.ru>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Alexander Graf <agraf@...e.de>, Gleb Natapov <gleb@...nel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Michael Ellerman <mpe@...erman.id.au>, kvm-ppc@...r.kernel.org,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Joonsoo Kim <iamjoonsoo.kim@....com>, stable@...r.kernel.org
Subject: Re: [PATCH] PC, KVM, CMA: Fix regression caused by wrong get_order() use
Alexey Kardashevskiy <aik@...abs.ru> writes:
> fc95ca7284bc54953165cba76c3228bd2cdb9591 claims that there is no
> functional change but this is not true as it calls get_order() (which
> takes bytes) where it should have called ilog2() and the kernel stops
> on VM_BUG_ON().
>
> This replaces get_order() with ilog2().
Should we round it up ? ie, ilog2(kvm_rma_pages - 1) + 1 ?
>
> Suggested-by: Paul Mackerras <paulus@...ba.org>
> Cc: Alexander Graf <agraf@...e.de>
> Cc: Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com>
> Cc: Joonsoo Kim <iamjoonsoo.kim@....com>
> Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
> Cc: <stable@...r.kernel.org>
Why stable ? We merged it this merge window.
> Signed-off-by: Alexey Kardashevskiy <aik@...abs.ru>
> ---
> arch/powerpc/kvm/book3s_hv_builtin.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s_hv_builtin.c
> index 329d7fd..bfe9f01 100644
> --- a/arch/powerpc/kvm/book3s_hv_builtin.c
> +++ b/arch/powerpc/kvm/book3s_hv_builtin.c
> @@ -101,7 +101,7 @@ struct kvm_rma_info *kvm_alloc_rma()
> ri = kmalloc(sizeof(struct kvm_rma_info), GFP_KERNEL);
> if (!ri)
> return NULL;
> - page = cma_alloc(kvm_cma, kvm_rma_pages, get_order(kvm_rma_pages));
> + page = cma_alloc(kvm_cma, kvm_rma_pages, ilog2(kvm_rma_pages));
> if (!page)
> goto err_out;
> atomic_set(&ri->use_count, 1);
> @@ -135,12 +135,12 @@ struct page *kvm_alloc_hpt(unsigned long nr_pages)
> {
> unsigned long align_pages = HPT_ALIGN_PAGES;
>
> - VM_BUG_ON(get_order(nr_pages) < KVM_CMA_CHUNK_ORDER - PAGE_SHIFT);
> + VM_BUG_ON(ilog2(nr_pages) < KVM_CMA_CHUNK_ORDER - PAGE_SHIFT);
>
> /* Old CPUs require HPT aligned on a multiple of its size */
> if (!cpu_has_feature(CPU_FTR_ARCH_206))
> align_pages = nr_pages;
> - return cma_alloc(kvm_cma, nr_pages, get_order(align_pages));
> + return cma_alloc(kvm_cma, nr_pages, ilog2(align_pages));
> }
> EXPORT_SYMBOL_GPL(kvm_alloc_hpt);
>
> --
> 2.0.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists