MIPS: Fix build error for loongson64 and sgi-ip27
Subsystems (2)
cover MIPS: Fix build error for loongson64 and sgi-ip27
Fix link errors after patch series "mm, memory_hotplug: handle unitialized numa node gracefully".
Feiyang Chen (2):
MIPS: loongson64: Fix build error when CONFIG_NUMA is set
MIPS: sgi-ip27: Fix build error
arch/mips/Kconfig | 4 ++++ .../mips/include/asm/mach-loongson64/mmzone.h | 4 ++-- .../include/asm/mach-loongson64/topology.h | 8 +++---- arch/mips/loongson64/numa.c | 22 +++++++++---------- arch/mips/sgi-ip27/ip27-memory.c | 10 +++++++++ 5 files changed, 31 insertions(+), 17 deletions(-)
Signature · 1 line
2.27.0
PATCH 1/2 MIPS: loongson64: Fix build error when CONFIG_NUMA is set
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'
BTW, modify __node_distances and __node_cpumask to follow the same style.
--- .../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(-)
arch/mips/include/asm/mach-loongson64/mmzone.h +2 -2
@@ -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 );
arch/mips/include/asm/mach-loongson64/topology.h +4 -4
@@ -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
arch/mips/loongson64/numa.c +11 -11
@@ -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++;
Signature · 1 line
2.27.0
Re: [PATCH 1/2] MIPS: loongson64: Fix build error when CONFIG_NUMA is set
Hi, Feiyang
Quoted 5 lines · Feiyang Chen
Modify
__node_datatonode_datato fix the build error whenCONFIG_NUMA=y:mips64el-unknown-linux-gnu-ld:
mm/page_alloc.o: in function `free_area_init':
(.init.text+0x1714): undefined reference tonode_data' mips64el-unknown-linux-gnu-ld: (.init.text+0x1730): undefined reference tonode_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".
3. If "__node_data" is changed to "node_data" in mips, it will cause problems with the crash tool.
Thanks,
Youling.
Quoted 117 lines
BTW, modify
__node_distancesand__node_cpumaskto follow the same style.Signed-off-by Feiyang Chen <[email protected]>--- .../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(-)arch/mips/include/asm/mach-loongson64/mmzone.h +2
-2@@ -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 );arch/mips/include/asm/mach-loongson64/topology.h +4
-4@@ -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 arch/mips/loongson64/numa.c +11
-11@@ -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++;
Re: [PATCH 1/2] MIPS: loongson64: Fix build error when CONFIG_NUMA is set
Quoted 8 lines · Youling Tang
Hi, Feiyang
Quoted 5 lines · Feiyang Chen
Modify
__node_datatonode_datato fix the build error whenCONFIG_NUMA=y:mips64el-unknown-linux-gnu-ld:
mm/page_alloc.o: in function `free_area_init':
(.init.text+0x1714): undefined reference tonode_data' mips64el-unknown-linux-gnu-ld: (.init.text+0x1730): undefined reference tonode_data'
Quoted 8 lines
1. This issue was introduced by the patch "mm,
memory_hotplug: makearch_alloc_nodedataindependent onCONFIG_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=9039a226f22047ba6b066128318d5be8ef7942732. The build error should not modify mips but should modifythe
include/linux/memory_hotplug.hfile, 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".
Quoted 3 lines
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
Quoted 121 lines
Thanks,
Youling.Quoted 117 lines
BTW, modify
__node_distancesand__node_cpumaskto follow the same style.Signed-off-by Feiyang Chen <[email protected]>--- .../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(-)arch/mips/include/asm/mach-loongson64/mmzone.h +2
-2@@ -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 );arch/mips/include/asm/mach-loongson64/topology.h +4
-4@@ -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 arch/mips/loongson64/numa.c +11
-11@@ -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++;
PATCH 2/2 MIPS: sgi-ip27: Fix build error
In reply to Feiyang ChenSelect HAVE_ARCH_NODEDATA_EXTENSION for sgi-ip27 to fix build error:
mips64el-unknown-linux-gnu-ld: mm/page_alloc.o: in function `free_area_init':
page_alloc.c:(.init.text+0x1ba8): undefined reference to node_data' mips64el-unknown-linux-gnu-ld: page_alloc.c:(.init.text+0x1bcc): undefined reference to node_data' mips64el-unknown-linux-gnu-ld: page_alloc.c:(.init.text+0x1be4): undefined reference to node_data' mips64el-unknown-linux-gnu-ld: page_alloc.c:(.init.text+0x1bf4): undefined reference to node_data'
--- arch/mips/Kconfig | 4 ++++ arch/mips/sgi-ip27/ip27-memory.c | 10 ++++++++++ 2 files changed, 14 insertions(+)
arch/mips/Kconfig +4 -0
@@ -709,6 +709,7 @@ config SGI_IP27 select WAR_R10000_LLSC select MIPS_L1_CACHE_SHIFT_7 select NUMA + select HAVE_ARCH_NODEDATA_EXTENSION help This are the SGI Origin 200, Origin 2000 and Onyx 2 Graphics workstations. To compile a Linux kernel that runs on these, say Y
@@ -2708,6 +2709,9 @@ config NUMA config SYS_SUPPORTS_NUMA bool +config HAVE_ARCH_NODEDATA_EXTENSION + bool + config RELOCATABLE bool "Relocatable kernel" depends on SYS_SUPPORTS_RELOCATABLE
arch/mips/sgi-ip27/ip27-memory.c +10 -0
@@ -422,3 +422,13 @@ void __init mem_init(void)memblock_free_all ();setup_zero_pages ();/* This comes from node 0 */ } + +pg_data_t *__init arch_alloc_nodedata (int nid) +{ +return memblock_alloc (sizeof (pg_data_t),SMP_CACHE_BYTES ); +} + +void arch_refresh_nodedata (int nid,pg_data_t *pgdat) +{ + __node_data[nid] = (struct node_data *)pgdat; +}
Signature · 1 line
2.27.0