On Sat, 19 Mar 2022 at 16:03, Youling Tang <tangyouling@xxxxxxxxxxx> wrote: > > Hi, Feiyang > On 2022/3/19 下午3:11, Feiyang Chen wrote: > > Modify __node_data to node_data to fix the build error when CONFIG_NUMA=y: > > > > mips64el-unknown-linux-gnu-ld: mm/page_alloc.o: in function `free_area_init': > > (.init.text+0x1714): undefined reference to `node_data' > > mips64el-unknown-linux-gnu-ld: (.init.text+0x1730): undefined reference to `node_data' > 1. This issue was introduced by the patch "mm, memory_hotplug: make > arch_alloc_nodedata independent on CONFIG_MEMORY_HOTPLUG". The patch > has not yet been synced to the mips-next branch. > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=9039a226f22047ba6b066128318d5be8ef794273 > > 2. The build error should not modify mips but should modifythe > include/linux/memory_hotplug.h file, which will use "NODE_DATA" > instead of "node_data". Hi, Youling, The comment in include/linux/memory_hotplug.h says: /* * For supporting node-hotadd, we have to allocate a new pgdat. * * If an arch has generic style NODE_DATA(), * node_data[nid] = kzalloc() works well. But it depends on the architecture. * * In general, generic_alloc_nodedata() is used. * */ I don't think it's a good idea to modify "node_data" to "NODE_DATA". > > 3. If "__node_data" is changed to "node_data" in mips, it will cause > problems with the crash tool. How about selecting HAVE_ARCH_NODEDATA_EXTENSION and overloading functions as sgi-ip27 in Patch 2? Thanks, Feiyang > > Thanks, > Youling. > > > > BTW, modify __node_distances and __node_cpumask to follow the same style. > > > > Signed-off-by: Feiyang Chen <chenfeiyang@xxxxxxxxxxx> > > --- > > .../mips/include/asm/mach-loongson64/mmzone.h | 4 ++-- > > .../include/asm/mach-loongson64/topology.h | 8 +++---- > > arch/mips/loongson64/numa.c | 22 +++++++++---------- > > 3 files changed, 17 insertions(+), 17 deletions(-) > > > > diff --git a/arch/mips/include/asm/mach-loongson64/mmzone.h b/arch/mips/include/asm/mach-loongson64/mmzone.h > > index ebb1deaa77b9..14e2b860ad65 100644 > > --- a/arch/mips/include/asm/mach-loongson64/mmzone.h > > +++ b/arch/mips/include/asm/mach-loongson64/mmzone.h > > @@ -14,9 +14,9 @@ > > #define pa_to_nid(addr) (((addr) & 0xf00000000000) >> NODE_ADDRSPACE_SHIFT) > > #define nid_to_addrbase(nid) ((unsigned long)(nid) << NODE_ADDRSPACE_SHIFT) > > > > -extern struct pglist_data *__node_data[]; > > +extern struct pglist_data *node_data[]; > > > > -#define NODE_DATA(n) (__node_data[n]) > > +#define NODE_DATA(n) (node_data[n]) > > > > extern void setup_zero_pages(void); > > extern void __init prom_init_numa_memory(void); > > diff --git a/arch/mips/include/asm/mach-loongson64/topology.h b/arch/mips/include/asm/mach-loongson64/topology.h > > index 3414a1fd1783..dc71eaf9c819 100644 > > --- a/arch/mips/include/asm/mach-loongson64/topology.h > > +++ b/arch/mips/include/asm/mach-loongson64/topology.h > > @@ -6,17 +6,17 @@ > > > > #define cpu_to_node(cpu) (cpu_logical_map(cpu) >> 2) > > > > -extern cpumask_t __node_cpumask[]; > > -#define cpumask_of_node(node) (&__node_cpumask[node]) > > +extern cpumask_t node_cpumask[]; > > +#define cpumask_of_node(node) (&node_cpumask[node]) > > > > struct pci_bus; > > extern int pcibus_to_node(struct pci_bus *); > > > > #define cpumask_of_pcibus(bus) (cpu_online_mask) > > > > -extern unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES]; > > +extern unsigned char node_distances[MAX_NUMNODES][MAX_NUMNODES]; > > > > -#define node_distance(from, to) (__node_distances[(from)][(to)]) > > +#define node_distance(from, to) (node_distances[(from)][(to)]) > > > > #endif > > > > diff --git a/arch/mips/loongson64/numa.c b/arch/mips/loongson64/numa.c > > index e8e3e48c5333..9c1bf29c1aae 100644 > > --- a/arch/mips/loongson64/numa.c > > +++ b/arch/mips/loongson64/numa.c > > @@ -27,13 +27,13 @@ > > #include <boot_param.h> > > #include <loongson.h> > > > > -unsigned char __node_distances[MAX_NUMNODES][MAX_NUMNODES]; > > -EXPORT_SYMBOL(__node_distances); > > -struct pglist_data *__node_data[MAX_NUMNODES]; > > -EXPORT_SYMBOL(__node_data); > > +unsigned char node_distances[MAX_NUMNODES][MAX_NUMNODES]; > > +EXPORT_SYMBOL(node_distances); > > +struct pglist_data *node_data[MAX_NUMNODES]; > > +EXPORT_SYMBOL(node_data); > > > > -cpumask_t __node_cpumask[MAX_NUMNODES]; > > -EXPORT_SYMBOL(__node_cpumask); > > +cpumask_t node_cpumask[MAX_NUMNODES]; > > +EXPORT_SYMBOL(node_cpumask); > > > > static void cpu_node_probe(void) > > { > > @@ -71,11 +71,11 @@ static void __init init_topology_matrix(void) > > > > for (row = 0; row < MAX_NUMNODES; row++) > > for (col = 0; col < MAX_NUMNODES; col++) > > - __node_distances[row][col] = -1; > > + node_distances[row][col] = -1; > > > > for_each_online_node(row) { > > for_each_online_node(col) { > > - __node_distances[row][col] = > > + node_distances[row][col] = > > compute_node_distance(row, col); > > } > > } > > @@ -107,7 +107,7 @@ static void __init node_mem_init(unsigned int node) > > tnid = early_pfn_to_nid(nd_pa >> PAGE_SHIFT); > > if (tnid != node) > > pr_info("NODE_DATA(%d) on node %d\n", node, tnid); > > - __node_data[node] = nd; > > + node_data[node] = nd; > > NODE_DATA(node)->node_start_pfn = start_pfn; > > NODE_DATA(node)->node_spanned_pages = end_pfn - start_pfn; > > > > @@ -146,7 +146,7 @@ static __init void prom_meminit(void) > > if (node_online(node)) { > > szmem(node); > > node_mem_init(node); > > - cpumask_clear(&__node_cpumask[node]); > > + cpumask_clear(&node_cpumask[node]); > > } > > } > > max_low_pfn = PHYS_PFN(memblock_end_of_DRAM()); > > @@ -159,7 +159,7 @@ static __init void prom_meminit(void) > > if (loongson_sysconf.reserved_cpus_mask & (1<<cpu)) > > continue; > > > > - cpumask_set_cpu(active_cpu, &__node_cpumask[node]); > > + cpumask_set_cpu(active_cpu, &node_cpumask[node]); > > pr_info("NUMA: set cpumask cpu %d on node %d\n", active_cpu, node); > > > > active_cpu++; >