]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powerpc/pseries: Fix cpu hotplug crash with memoryless nodes
authorMichael Bringmann <mwb@linux.vnet.ibm.com>
Tue, 28 Nov 2017 22:58:43 +0000 (16:58 -0600)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 27 Jan 2018 09:59:45 +0000 (20:59 +1100)
On powerpc systems with shared configurations of CPUs and memory and
memoryless nodes at boot, an event ordering problem was observed on a
SLES12 build platforms with the hot-add of CPUs to the memoryless
nodes.

* The most common error occurred when the memory SLAB driver attempted
  to reference the memoryless node to which a CPU was being added
  before the kernel had finished initializing all of the data
  structures for the CPU and exited 'device_online' under
  DLPAR/hot-add.

  Normally the memoryless node would be initialized through the call
  path device_online ... arch_update_cpu_topology ... find_cpu_nid ...
  try_online_node. This patch ensures that the powerpc node will be
  initialized as early as possible, even if it was memoryless and
  CPU-less at the point when we are trying to hot-add a new CPU to it.

Signed-off-by: Michael Bringmann <mwb@linux.vnet.ibm.com>
Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/numa.c
arch/powerpc/platforms/pseries/hotplug-cpu.c

index 1bead2c672728665bae65f5bec686d234ae4b978..314d19ab9385e038a4f38c18a50364da4873eb86 100644 (file)
@@ -1198,7 +1198,7 @@ static long vphn_get_associativity(unsigned long cpu,
        return rc;
 }
 
-static inline int find_and_online_cpu_nid(int cpu)
+int find_and_online_cpu_nid(int cpu)
 {
        __be32 associativity[VPHN_ASSOC_BUFSIZE] = {0};
        int new_nid;
@@ -1229,6 +1229,8 @@ static inline int find_and_online_cpu_nid(int cpu)
 #endif
        }
 
+       pr_debug("%s:%d cpu %d nid %d\n", __FUNCTION__, __LINE__,
+               cpu, new_nid);
        return new_nid;
 }
 
index a7d14aa7bb7c5c2d67fdd0e522d271f71f05a738..dceb51454d8d212a5cbc78ef891322bddf499800 100644 (file)
@@ -340,6 +340,8 @@ static void pseries_remove_processor(struct device_node *np)
        cpu_maps_update_done();
 }
 
+extern int find_and_online_cpu_nid(int cpu);
+
 static int dlpar_online_cpu(struct device_node *dn)
 {
        int rc = 0;
@@ -364,6 +366,7 @@ static int dlpar_online_cpu(struct device_node *dn)
                                        != CPU_STATE_OFFLINE);
                        cpu_maps_update_done();
                        timed_topology_update(1);
+                       find_and_online_cpu_nid(cpu);
                        rc = device_online(get_cpu_device(cpu));
                        if (rc)
                                goto out;