On Fri, Jan 19, 2024 at 10:05:39AM +0000, Jiaxun Yang wrote: > > > 在 2024/1/19 04:02, Huang Pei 写道: > > Commit 61167ad5fecd("mm: pass nid to reserve_bootmem_region()) reveals > > that reserved memblock regions have no valid node id set, just set it > > right since loongson64 firmware makes it clear in memory layout info. > > > > This works around booting failure on 3A1000+ since commit 61167ad5fecd > > ("mm: pass nid to reserve_bootmem_region()) under > > CONFIG_DEFERRED_STRUCT_PAGE_INIT. > > This should be done at MIPS arch level I guess. You mean the real fix or the set nid for the reserved memblock region? + the real fix is [1](see old mail). I do not think MIPS arch needs it: + This ONLY matters on NUMA, most of MIPS platforms is UMA. + MM does not care about the nid of reserved memblock region provided by arch/platform, nor it provide "memblock_reserved_node" like "memblock_add_node". Loongson64 knows about nid of reserved region and the regular distribution of physical memory bewtween nodes, that is why it can be done by simple "memblock_set_node" and I add it. > > Thanks > - Jiaxun > > > > > Signed-off-by: Huang Pei <huangpei@xxxxxxxxxxx> > > --- > > arch/mips/loongson64/init.c | 2 ++ > > arch/mips/loongson64/numa.c | 2 ++ > > 2 files changed, 4 insertions(+) > > > > diff --git a/arch/mips/loongson64/init.c b/arch/mips/loongson64/init.c > > index f25caa6aa9d3..000ba91c0886 100644 > > --- a/arch/mips/loongson64/init.c > > +++ b/arch/mips/loongson64/init.c > > @@ -103,6 +103,8 @@ void __init szmem(unsigned int node) > > if (loongson_sysconf.vgabios_addr) > > memblock_reserve(virt_to_phys((void *)loongson_sysconf.vgabios_addr), > > SZ_256K); > > + /* set nid for reserved memory */ > > + memblock_set_node((u64)node << 44, (u64)(node+1) << 44, &memblock.reserved, node); > > } > > #ifndef CONFIG_NUMA > > diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c > > index 8f61e93c0c5b..6345e096c532 100644 > > --- a/arch/mips/loongson64/numa.c > > +++ b/arch/mips/loongson64/numa.c > > @@ -132,6 +132,8 @@ static void __init node_mem_init(unsigned int node) > > /* Reserve pfn range 0~node[0]->node_start_pfn */ > > memblock_reserve(0, PAGE_SIZE * start_pfn); > > + /* set nid for reserved memory on node 0 */ > > + memblock_set_node(0, (u64)1 << 44, &memblock.reserved, 1); > > } > > } > > -- > --- > Jiaxun Yang