summary refs log tree commit diff
diff options
context:
space:
mode:
authorSrikar Dronamraju <srikar@linux.vnet.ibm.com>2022-03-30 19:21:23 +0530
committerMichael Ellerman <mpe@ellerman.id.au>2022-03-31 23:23:18 +1100
commite4ff77598a109bd36789ad5e80aba66fc53d0ffb (patch)
tree5a9578ef6607d0ff2cdc62e38799802ea6f73ed6
parentaf41d2866f7d75bbb38d487f6ec7770425d70e45 (diff)
downloadlinux-e4ff77598a109bd36789ad5e80aba66fc53d0ffb.tar.gz
powerpc/numa: Handle partially initialized numa nodes
With commit 09f49dca570a ("mm: handle uninitialized numa nodes
gracefully") NODE_DATA for even a memoryless/cpuless node is partially
initialized at boot time.

Before onlining the node, current Powerpc code checks for NODE_DATA to
be NULL. However since NODE_DATA is partially initialized, this check
will end up always being false.

This causes hotplugging a CPU to a memoryless/cpuless node to fail.

Before adding CPUs:
  $ numactl -H
  available: 1 nodes (4)
  node 4 cpus: 0 1 2 3 4 5 6 7
  node 4 size: 97372 MB
  node 4 free: 95545 MB
  node distances:
  node   4
  4:  10

  $ lparstat
  System Configuration
  type=Dedicated mode=Capped smt=8 lcpu=1 mem=99709440 kB cpus=0 ent=1.00

  %user  %sys %wait    %idle    physc %entc lbusy   app  vcsw phint
  ----- ----- -----    -----    ----- ----- ----- ----- ----- -----
  2.66  2.67  0.16    94.51     0.00  0.00  5.33  0.00 67749     0

After hotplugging 32 cores:
  $ numactl -H
  node 4 cpus: 0 1 2 3 4 5 6 7 120 121 122 123 124 125 126 127 128 129 130
  131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
  149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
  167 168 169 170 171 172 173 174 175
  node 4 size: 97372 MB
  node 4 free: 93636 MB
  node distances:
  node   4
  4:  10

  $ lparstat
  System Configuration
  type=Dedicated mode=Capped smt=8 lcpu=33 mem=99709440 kB cpus=0 ent=33.00

  %user  %sys %wait    %idle    physc %entc lbusy   app  vcsw phint
  ----- ----- -----    -----    ----- ----- ----- ----- ----- -----
  0.04  0.02  0.00    99.94     0.00  0.00  0.06  0.00 1128751     3

As we can see numactl is listing only 8 cores while lparstat is showing
33 cores.

Also dmesg is showing messages like:
  [ 2261.318350 ] BUG: arch topology borken
  [ 2261.318357 ]      the DIE domain not a subset of the NODE domain

Fixes: 09f49dca570a ("mm: handle uninitialized numa nodes gracefully")
Reported-by: Geetika Moolchandani <Geetika.Moolchandani1@ibm.com>
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Oscar Salvador <osalvador@suse.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220330135123.1868197-1-srikar@linux.vnet.ibm.com
-rw-r--r--arch/powerpc/mm/numa.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index b9b7fefbb64b..13022d734951 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1436,7 +1436,7 @@ int find_and_online_cpu_nid(int cpu)
 	if (new_nid < 0 || !node_possible(new_nid))
 		new_nid = first_online_node;
 
-	if (NODE_DATA(new_nid) == NULL) {
+	if (!node_online(new_nid)) {
 #ifdef CONFIG_MEMORY_HOTPLUG
 		/*
 		 * Need to ensure that NODE_DATA is initialized for a node from