Re: [PATCH] riscv: reserve DTB before possible memblock allocation

From: Conor Dooley
Date: Wed Jun 07 2023 - 18:26:18 EST


On Thu, Jun 08, 2023 at 06:17:22AM +0800, Woody Zhang wrote:
> Hi, Conor
>
> On Wed, Jun 07, 2023 at 07:17:28PM +0100, Conor Dooley wrote:
> >+CC Alex, you should take a look at this patch.
> >
> >On Wed, Jun 07, 2023 at 09:35:19PM +0800, Woody Zhang wrote:
> >> It's possible that early_init_fdt_scan_reserved_mem() allocates memory
> >> from memblock for dynamic reserved memory in `/reserved-memory` node.
> >> Any fixed reservation must be done before that to avoid potential
> >> conflicts.
> >>
> >> Reserve the DTB in memblock just after early scanning it.
> >
> >The rationale makes sense to me, I am just wondering what compelling
> >reason there is to move it away from the memblock_reserve()s for the
> >initd and vmlinux? Moving it above early_init_fdt_scan_reserved_mem()
> >should be the sufficient minimum & would keep things together.
>
> IMO, moving it to parse_dtb() is more reasonable as early scanning and
> reservation are both subject to DTB. It can also lower the risk to
> mess up the sequence in the future. BTW, it's also invoked in
> setup_machine_fdt() in arm64.

I'm fine with the change either way, so:
Reviewed-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx>
Mostly wanted to know whether you'd considered the minimal change.

Cheers,
Conor.

Attachment: signature.asc
Description: PGP signature