Skip to contentSkip to conversation

powerpc: topology.h: fix build when CONFIG_NUMA=n

PATCH Superseded Scott Cheloha 2 participants 2 messages Nov 5, 2020 PowerPC

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: topology.h: fix build when CONFIG_NUMA=n

Add a non-NUMA definition for of_drconf_to_nid_single() to topology.h so we have one even if powerpc/mm/numa.c is not compiled. On a non-NUMA kernel the appropriate node id is always first_online_node.

Fixes 72cdd117c449 ("pseries/hotplug-memory: hot-add: skip redundant LMB lookup")
---
 arch/powerpc/include/asm/topology.h | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
arch/powerpc/include/asm/topology.h +10 -3
index 8728590f514a..90d2424418b5 100644
@@ -61,6 +61,10 @@ static inline int early_cpu_to_node(int cpu)
 	 */
 	return (nid < 0) ? 0 : nid;
 }
+
+struct drmem_lmb;
+extern int of_drconf_to_nid_single(struct drmem_lmb *lmb);
+
 #else
 
 static inline int early_cpu_to_node(int cpu) { return 0; }
@@ -84,10 +88,13 @@ static inline int cpu_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc)
 	return 0;
 }
 
-#endif /* CONFIG_NUMA */
-
 struct drmem_lmb;
-int of_drconf_to_nid_single(struct drmem_lmb *lmb);
+static inline int of_drconf_to_nid_single(struct drmem_lmb *lmb)
+{
+	return first_online_node;
+}
+
+#endif /* CONFIG_NUMA */
 
 #if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
 extern int find_and_online_cpu_nid(int cpu);
Signature · 1 line
2.28.0
#1 lore raw

Le 05/11/2020 à 17:20, Scott Cheloha a écrit :

Quoted 16 lines

Add a non-NUMA definition for of_drconf_to_nid_single() to topology.h so we have one even if powerpc/mm/numa.c is not compiled. On a non-NUMA kernel the appropriate node id is always first_online_node.

Fixes 72cdd117c449 ("pseries/hotplug-memory: hot-add: skip redundant LMB lookup")
---
  arch/powerpc/include/asm/topology.h | 13 ++++++++++---
  1 file changed, 10 insertions(+), 3 deletions(-)
arch/powerpc/include/asm/topology.h +0 -0
index 8728590f514a..90d2424418b5 100644

arch/powerpc/include/asm/topology.h static inline int early_cpu_to_node(int cpu) · line 65

Quoted 5 lines
arch/powerpc/include/asm/topology.h +2 -0
@@ -61,6 +61,10 @@ static inline int early_cpu_to_node(int cpu)
  	 */
  	return (nid < 0) ? 0 : nid;
  }
+
+struct drmem_lmb;

Can you put that before the #ifdef CONFIG_NUMA in order to avoid duplicating it ?

arch/powerpc/include/asm/topology.h static inline int early_cpu_to_node(int cpu) · line 66

Quoted 1 line
arch/powerpc/include/asm/topology.h +1 -0
+extern int of_drconf_to_nid_single(struct drmem_lmb *lmb);

'extern' keywork is useless on a function prototype, don't add one, keep the prototype as before, ie:

int of_drconf_to_nid_single(struct drmem_lmb *lmb);

arch/powerpc/include/asm/topology.h static inline int cpu_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc) · line 91

Quoted 11 lines
arch/powerpc/include/asm/topology.h +1 -2
+
  #else
 
  static inline int early_cpu_to_node(int cpu) { return 0; }
@@ -84,10 +88,13 @@ static inline int cpu_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc)
  	return 0;
  }
 
-#endif /* CONFIG_NUMA */
-
  struct drmem_lmb;

Can you put that before the #ifdef CONFIG_NUMA in order to avoid duplicating it ?

arch/powerpc/include/asm/topology.h static inline int cpu_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc) · line 100

Quoted 11 lines
arch/powerpc/include/asm/topology.h +6 -1
-int of_drconf_to_nid_single(struct drmem_lmb *lmb);
+static inline int of_drconf_to_nid_single(struct drmem_lmb *lmb)
+{
+	return first_online_node;
+}
+
+#endif /* CONFIG_NUMA */
 
  #if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
  extern int find_and_online_cpu_nid(int cpu);

Christophe