lkml.org 
[lkml]   [2014]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] mips: cma: Do not reserve memory if not required
From
I meet the same problem on Loongson-3, and this patch resolve my
problem. Thanks.
Tested-by: Huacai Chen <chenhc@lemote.com>

On Tue, Oct 28, 2014 at 7:28 PM, Zubair Lutfullah Kakakhel
<Zubair.Kakakhel@imgtec.com> wrote:
> Even if CMA is disabled, the for_each_memblock macro expands
> to run reserve_bootmem once. Hence, reserve_bootmem attempts to
> reserve location 0 of size 0.
>
> Add a check to avoid that.
>
> Issue was highlighted during testing with EVA enabled.
> resrve_bootmem used to exit gracefully when passed arguments to
> reserve 0 size location at 0 without EVA.
>
> But with EVA enabled, macros would point to different addresses
> and the code would trigger a BUG.
>
> Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>
> Tested-by: Markos Chandras <markos.chandras@imgtec.com>
> ---
> arch/mips/kernel/setup.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
> index 938f157..eacfd7d 100644
> --- a/arch/mips/kernel/setup.c
> +++ b/arch/mips/kernel/setup.c
> @@ -683,7 +683,8 @@ static void __init arch_mem_init(char **cmdline_p)
> dma_contiguous_reserve(PFN_PHYS(max_low_pfn));
> /* Tell bootmem about cma reserved memblock section */
> for_each_memblock(reserved, reg)
> - reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT);
> + if (reg->size != 0)
> + reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT);
> }
>
> static void __init resource_init(void)
> --
> 1.9.1
>
>


\
 
 \ /
  Last update: 2014-10-29 03:01    [W:0.063 / U:0.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site