From: Huacai Chen <chenhuacai@kernel.org>
To: Oreoluwa Babatunde <quic_obabatun@quicinc.com>
Cc: jonas@southpole.se, stefan.kristiansson@saunalahti.fi,
shorne@gmail.com, ysato@users.sourceforge.jp, dalias@libc.org,
glaubitz@physik.fu-berlin.de, robh+dt@kernel.org,
frowand.list@gmail.com, linux-openrisc@vger.kernel.org,
loongarch@lists.linux.dev, linux-sh@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
kernel@quicinc.com
Subject: Re: [PATCH 1/3] loongarch: Call arch_mem_init() before platform_init() in the init sequence
Date: Wed, 14 Feb 2024 21:03:49 +0800 [thread overview]
Message-ID: <CAAhV-H5f5e-cCaX7Gr20oG8F-aywJcosLn4ajxx2SQWoB8JtSA@mail.gmail.com> (raw)
In-Reply-To: <1707524971-146908-2-git-send-email-quic_obabatun@quicinc.com>
Hi, Oreoluwa,
On Sat, Feb 10, 2024 at 8:29 AM Oreoluwa Babatunde
<quic_obabatun@quicinc.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@quicinc.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
> --
next prev parent reply other threads:[~2024-02-14 13:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-10 0:29 [PATCH 0/3] Restructure init sequence to set aside reserved memory earlier Oreoluwa Babatunde
2024-02-10 0:29 ` [PATCH 1/3] loongarch: Call arch_mem_init() before platform_init() in the init sequence Oreoluwa Babatunde
2024-02-14 13:03 ` Huacai Chen [this message]
2024-02-14 21:31 ` Oreoluwa Babatunde
2024-02-15 9:37 ` Huacai Chen
2024-02-10 0:29 ` [PATCH 2/3] openrisc: Call setup_memory() earlier " Oreoluwa Babatunde
2024-03-08 22:27 ` Stafford Horne
2024-02-10 0:29 ` [PATCH 3/3] sh: Call paging_init() " Oreoluwa Babatunde
2024-03-11 16:02 ` Rob Herring
2024-03-05 18:59 ` [PATCH 0/3] Restructure init sequence to set aside reserved memory earlier Oreoluwa Babatunde
2024-03-08 22:20 ` Stafford Horne
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAhV-H5f5e-cCaX7Gr20oG8F-aywJcosLn4ajxx2SQWoB8JtSA@mail.gmail.com \
--to=chenhuacai@kernel.org \
--cc=dalias@libc.org \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=glaubitz@physik.fu-berlin.de \
--cc=jonas@southpole.se \
--cc=kernel@quicinc.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-openrisc@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=quic_obabatun@quicinc.com \
--cc=robh+dt@kernel.org \
--cc=shorne@gmail.com \
--cc=stefan.kristiansson@saunalahti.fi \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).