Skip to contentSkip to conversation

powerpc/vphn: Update CPU topology when VPHN enabled

PATCH Superseded Michael Bringmann 2 participants 2 messages Aug 31, 2017 – Sep 1, 2017 PowerPC

v12 of 14 Superseded Latest is v14 →

lore
Share & tools
lore
#0 lore raw

PATCH v12 1/1 powerpc/vphn: Update CPU topology when VPHN enabled

powerpc/numa: On Power systems with shared configurations of CPUs and memory, there are some issues with the association of additional CPUs and memory to nodes when hot-adding resources. This patch addresses some of those problems.

First, it corrects the currently broken capability to set the topology for shared CPUs in LPARs. At boot time for shared CPU lpars, the topology for each CPU was being set to node zero. Now when numa_update_cpu_topology() is called appropriately, the Virtual Processor Home Node (VPHN) capabilities information provided by the pHyp allows the appropriate node in the shared configuration to be selected for the CPU.

Next, it updates the initialization checks to independently recognize PRRN or VPHN support.

Next, during hotplug CPU operations, it resets the timer on topology update work function to a small value to better ensure that the CPU topology is detected and configured sooner.

Also, fix an end-of-updates processing problem observed occasionally in numa_update_cpu_topology().

---
Changes in V12:
-- Reorganize some of the updates to minimize kernel impact. -- Improve documentation of this patch.

---
 arch/powerpc/include/asm/topology.h          |    8 +++
 arch/powerpc/mm/numa.c                       |   65 ++++++++++++++++++++++++--
 arch/powerpc/platforms/pseries/hotplug-cpu.c |    2 +
 3 files changed, 69 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/topology.h +8 -0
index dc4e159..600e1c6 100644
@@ -98,6 +98,14 @@ static inline int prrn_is_enabled(void)
 }
 #endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */
 
+#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_NEED_MULTIPLE_NODES)
+#if defined(CONFIG_PPC_SPLPAR)
+extern int timed_topology_update(int nsecs);
+#else
+#define	timed_topology_update(nsecs)	0
+#endif /* CONFIG_PPC_SPLPAR */
+#endif /* CONFIG_HOTPLUG_CPU || CONFIG_NEED_MULTIPLE_NODES */
+
 #include <asm-generic/topology.h>
 
 #ifdef CONFIG_SMP
arch/powerpc/mm/numa.c +59 -6

146 lines not on this page · raw message

arch/powerpc/platforms/pseries/hotplug-cpu.c +2 -0
index 6afd1ef..5a7fb1e 100644
@@ -356,6 +356,7 @@ static int dlpar_online_cpu(struct device_node *dn)
 			BUG_ON(get_cpu_current_state(cpu)
 					!= CPU_STATE_OFFLINE);
 			cpu_maps_update_done();
+			timed_topology_update(1);
 			rc = device_online(get_cpu_device(cpu));
 			if (rc)
 				goto out;
@@ -522,6 +523,7 @@ static int dlpar_offline_cpu(struct device_node *dn)
 				set_preferred_offline_state(cpu,
 							    CPU_STATE_OFFLINE);
 				cpu_maps_update_done();
+				timed_topology_update(1);
 				rc = device_offline(get_cpu_device(cpu));
 				if (rc)
 					goto out;
#1 lore raw

Hi Michael,

Thanks for trying to reduce this down to the minimum required.

But ...

Quoted 5 lines · Michael Bringmann

powerpc/numa: On Power systems with shared configurations of CPUs and memory, there are some issues with the association of additional CPUs and memory to nodes when hot-adding resources. This patch addresses some of those problems.

Quoted 7 lines

First, it corrects the currently broken capability to set the topology for shared CPUs in LPARs. At boot time for shared CPU lpars, the topology for each CPU was being set to node zero. Now when numa_update_cpu_topology() is called appropriately, the Virtual Processor Home Node (VPHN) capabilities information provided by the pHyp allows the appropriate node in the shared configuration to be selected for the CPU.

That should be one patch.

Quoted 2 lines

Next, it updates the initialization checks to independently recognize PRRN or VPHN support.

And another.

Quoted 3 lines

Next, during hotplug CPU operations, it resets the timer on topology update work function to a small value to better ensure that the CPU topology is detected and configured sooner.

Another.

Quoted 2 lines

Also, fix an end-of-updates processing problem observed occasionally in numa_update_cpu_topology().

And another.

I would have let you get away with lumping it all in together, except that it doesn't compile when CONFIG_PPC_SPLPAR=3Dn:

In file included from ../include/linux/topology.h:35:0,

                   from ../include/linux/gfp.h:8,
                   from ../include/linux/irq.h:17,
                   from ../arch/powerpc/include/asm/hardirq.h:5,
                   from ../include/linux/hardirq.h:8,
                   from ../include/linux/interrupt.h:12,
                   from ../arch/powerpc/platforms/pseries/hotplug-cpu.c:24:

../arch/powerpc/platforms/pseries/hotplug-cpu.c: In function =E2=80=98dlp=
ar_online_cpu=E2=80=99:
../arch/powerpc/include/asm/topology.h:103:38: error: statement with no e=
ffect [-Werror=3Dunused-value]

   #define timed_topology_update(nsecs) 0
                                        ^
  ../arch/powerpc/platforms/pseries/hotplug-cpu.c:366:4: note: in expansion=
 of macro =E2=80=98timed_topology_update=E2=80=99
      timed_topology_update(1);
      ^~~~~~~~~~~~~~~~~~~~~

../arch/powerpc/platforms/pseries/hotplug-cpu.c: In function =E2=80=98dlp=
ar_offline_cpu=E2=80=99:
../arch/powerpc/include/asm/topology.h:103:38: error: statement with no e=
ffect [-Werror=3Dunused-value]

   #define timed_topology_update(nsecs) 0
                                        ^
  ../arch/powerpc/platforms/pseries/hotplug-cpu.c:533:5: note: in expansion=
 of macro =E2=80=98timed_topology_update=E2=80=99
       timed_topology_update(1);
       ^~~~~~~~~~~~~~~~~~~~~

cc1: all warnings being treated as errors

So please fix that up, split it, and resend.

I know it would have been fairly easy for me to fix that compiler error, but it tells me you haven't tested that configuration at all, which is the bigger problem. Please at least give it a smoke test.

cheers