[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAhV-H5f5e-cCaX7Gr20oG8F-aywJcosLn4ajxx2SQWoB8JtSA@mail.gmail.com>
Date: Wed, 14 Feb 2024 21:03:49 +0800
From: Huacai Chen <chenhuacai@...nel.org>
To: Oreoluwa Babatunde <quic_obabatun@...cinc.com>
Cc: jonas@...thpole.se, stefan.kristiansson@...nalahti.fi, shorne@...il.com,
ysato@...rs.sourceforge.jp, dalias@...c.org, glaubitz@...sik.fu-berlin.de,
robh+dt@...nel.org, frowand.list@...il.com, linux-openrisc@...r.kernel.org,
loongarch@...ts.linux.dev, linux-sh@...r.kernel.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org, kernel@...cinc.com
Subject: Re: [PATCH 1/3] loongarch: Call arch_mem_init() before
platform_init() in the init sequence
Hi, Oreoluwa,
On Sat, Feb 10, 2024 at 8:29 AM Oreoluwa Babatunde
<quic_obabatun@...cinc.com> wrote:
>
> The platform_init() function which is called during device bootup
> contains a few calls to memblock_alloc().
> This is an issue because these allocations are done before reserved
> memory regions are set aside in arch_mem_init().
> This means that there is a possibility for memblock to allocate memory
> from any of the reserved memory regions.
>
> Hence, move the call to arch_mem_init() to be earlier in the init
> sequence so that all reserved memory is set aside before any allocations
> are made with memblock.
>
> Signed-off-by: Oreoluwa Babatunde <quic_obabatun@...cinc.com>
> ---
> arch/loongarch/kernel/setup.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
> index edf2bba..66c307c 100644
> --- a/arch/loongarch/kernel/setup.c
> +++ b/arch/loongarch/kernel/setup.c
> @@ -597,8 +597,8 @@ void __init setup_arch(char **cmdline_p)
> parse_early_param();
> reserve_initrd_mem();
>
> - platform_init();
> arch_mem_init(cmdline_p);
> + platform_init();
Thank you for your patch, but I think we cannot simply exchange their
order. If I'm right, you try to move all memblock_reserve() as early
as possible, but both arch_mem_init() and platform_init() call
memblock_reserve(), we should do a complete refactor for this. And
since it works with the existing order, we can simply keep it as is
now.
Huacai
>
> resource_init();
> #ifdef CONFIG_SMP
> --
Powered by blists - more mailing lists