Subject: Re: [PATCH -V2 2/4] powerpc: Contiguous memory allocator based hash page allocation

From: Paul Mackerras <[email-masked]>
Date: Sat, 29 Jun 2013 17:25:49 +1000

On Fri, Jun 28, 2013 at 02:41:00PM +0530, Aneesh Kumar K.V wrote:
> From: "Aneesh Kumar K.V" <[email-masked]>
> 
> Use CMA for allocation of guest hash page.

"page table" not just "page".  This patch description seems a bit
brief for a patch of this length.  Please describe a little more of
the motivation and the design decisions.

> +	if (selected_size) {
> +		pr_debug("%s: reserving %ld MiB for global area\n", __func__,
> +			 (unsigned long)selected_size / SZ_1M);
> +		align_size = hpt_align_pages << PAGE_SHIFT;
> +		kvm_cma_declare_contiguous(selected_size, align_size);

The alignment you declare here has to be at least as large as the
largest alignment that we will be requesting for any block later on.
This alignment is fine for POWER7, but PPC970 requires the HPT to be
aligned on a multiple of its size.  For PPC970 we should make sure
align_size is at least as large as any block that we could allocate.
Thus align_size should be at least __rounddown_pow_of_two(selected_size)
for PPC970.

Paul.