powerpc/dlpar: Correct display of hot-add/hot-remove CPUs and memory
v9 cover powerpc/dlpar: Correct display of hot-add/hot-remove CPUs and memory
On Power systems with shared configurations of CPUs and memory, there are some issues with association of additional CPUs and memory to nodes when hot-adding resources. These patches address some of those problems.
powerpc/numa: Correct the currently broken capability to set the topology for shared CPUs in LPARs. At boot time for shared CPU lpars, the topology for each shared CPU is set to node zero, however, this is now updated correctly using the Virtual Processor Home Node (VPHN) capabilities information provided by the pHyp. The VPHN handling in Linux is disabled, if PRRN handling is present.
powerpc/nodes: On systems like PowerPC which allow 'hot-add' of CPU or memory resources, it may occur that the new resources are to be inserted into nodes that were not used for these resources at bootup. In the kernel, any node that is used must be defined and initialized at boot.
This patch extracts the value of the lowest domain level (number of allocable resources) from the "rtas" device tree property "ibm,max-associativity-domains" to use as the maximum number of nodes to setup as possibly available in the system. This new setting will override the instruction,
nodes_and(node_possible_map, node_possible_map, node_online_map);
presently seen in the function arch/powerpc/mm/numa.c:initmem_init().
If the property is not present at boot, no operation will be performed to define or enable additional nodes.
Michael Bringmann (2):
powerpc/numa: Update CPU topology when VPHN enabled powerpc/nodes: Ensure enough nodes avail for operations
---
Changes in V9:
-- Calculate number of nodes via property "ibm,max-associativity-domains"
PATCH v9 1/2 powerpc/numa: Update CPU topology when VPHN enabled
powerpc/numa: Correct the currently broken capability to set the topology for shared CPUs in LPARs. At boot time for shared CPU lpars, the topology for each shared CPU is set to node zero, however, this is now updated correctly using the Virtual Processor Home Node (VPHN) capabilities information provided by the pHyp.
Also, update initialization checks for device-tree attributes to independently recognize PRRN or VPHN usage.
--- arch/powerpc/include/asm/topology.h | 14 ++++++ arch/powerpc/mm/numa.c | 64 +++++++++++++++++++++++--- arch/powerpc/platforms/pseries/dlpar.c | 2 + arch/powerpc/platforms/pseries/hotplug-cpu.c | 2 + 4 files changed, 75 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/topology.h +14 -0
@@ -98,6 +98,20 @@ 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 */ + +#if defined(CONFIG_PPC_SPLPAR ) +extern void shared_topology_update (void ); +#else +#define shared_topology_update () 0 +#endif /* CONFIG_PPC_SPLPAR */ +#include <asm-generic/topology.h> #ifdef CONFIG_SMP
arch/powerpc/mm/numa.c +57 -7
154 lines not on this page · raw message
arch/powerpc/platforms/pseries/dlpar.c +2 -0
@@ -592,6 +592,8 @@ static ssize_t dlpar_show(struct class *class, struct class_attribute *attr,static int __init pseries_dlpar_init (void ) { +shared_topology_update (); + pseries_hp_wq =alloc_workqueue ("pseries hotplug workqueue" ,WQ_UNBOUND ,1 );return sysfs_create_file (kernel_kobj, &class_attr_dlpar.attr);
arch/powerpc/platforms/pseries/hotplug-cpu.c +2 -0
@@ -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;
Michael Ellerman
reviewerRe: [PATCH V9 1/2] powerpc/numa: Update CPU topology when VPHN enabled
Quoted 8 lines · Michael Bringmann
powerpc/numa: Correct the currently broken capability to set the topology for shared CPUs in LPARs. At boot time for shared CPU lpars, the topology for each shared CPU is set to node zero, however, this is now updated correctly using the Virtual Processor Home Node (VPHN) capabilities information provided by the pHyp.
Also, update initialization checks for device-tree attributes to independently recognize PRRN or VPHN usage.
Did you ever do anything to address Nathan's comments on v4 ?
http://patchwork.ozlabs.org/patch/767587/
Also your change log doesn't describe anything about what the patch does and why it is the correct fix for the problem.
When a DLPAR happens you modify the VPHN timer to run in 1 nsec, but you don't wait for it. Why would we not just run the logic synchronously?
It also seems to make VPHN and PRRN no longer exclusive, which looking at PAPR seems like it might be correct, but is also a major change so please justify it in detail.
Comments below.
arch/powerpc/mm/numa.c void __init initmem_init(void) · line 910
Quoted 10 lines
arch/powerpc/mm/numa.c +1
-1@@ -906,7 +907,7 @@ void __init initmem_init(void)/* * Reduce the possible NUMA nodes to the online NUMA nodes, -* since we do not support node hotplug. This ensures that we +* since we do not support node hotplug. This ensures that we
Please do whitespace/spelling changes in a separate patch.
Quoted 7 lines
arch/powerpc/mm/numa.c +0
-0* lower the maximum NUMA node ID to what is actually present. */ nodes_and (node_possible_map, node_possible_map, node_online_map);@@ -1148,11 +1149,32 @@ struct topology_update_data {int new_nid; };
arch/powerpc/mm/numa.c struct topology_update_data { · line 1161
Quoted 10 lines
arch/powerpc/mm/numa.c +5
-0+#define TOPOLOGY_DEF_TIMER_SECS 60 +static u8 vphn_cpu_change_counts[NR_CPUS ][MAX_DISTANCE_REF_POINTS ];static cpumask_t cpu_associativity_changes_mask;static int vphn_enabled;static int prrn_enabled;static void reset_topology_timer (void ); +static int topology_timer_secs =TOPOLOGY_DEF_TIMER_SECS ; +static int topology_inited; +static int topology_update_needed;
None of this code should be in numa.c. Which is not your fault but I'm inclined to move it before we make it worse.
Quoted 20 lines
arch/powerpc/mm/numa.c +16
-0+ +/* +* Change polling interval for associativity changes. +*/ +int timed_topology_update (int nsecs) +{ +if (nsecs >0 ) + topology_timer_secs = nsecs; +else + topology_timer_secs =TOPOLOGY_DEF_TIMER_SECS ; + +if (vphn_enabled) +reset_topology_timer (); + +return 0 ; +}/* * Store the current values of the associativity change counters in the
arch/powerpc/mm/numa.c static long vphn_get_associativity(unsigned long cpu, · line 1274
Quoted 7 lines
arch/powerpc/mm/numa.c +4
-0@@ -1246,6 +1268,12 @@ static long vphn_get_associativity(unsigned long cpu,"hcall_vphn() experienced a hardware fault " "preventing VPHN. Disabling polling...\n");stop_topology_update (); +break ; +case H_SUCCESS : +printk (KERN_INFO +"VPHN hcall succeeded. Reset polling...\n" );
We don't need that to hit everyone's console once a minute. Remove it or pr_debug() if you like.
arch/powerpc/mm/numa.c int numa_update_cpu_topology(bool cpus_locked) · line 1398
Quoted 6 lines
arch/powerpc/mm/numa.c +2
-0@@ -1363,6 +1394,8 @@ int numa_update_cpu_topology(bool cpus_locked)cpumask_andnot (&cpu_associativity_changes_mask, &cpu_associativity_changes_mask,cpu_sibling_mask (cpu)); +pr_info ("Assoc chg gives same node %d for cpu%d\n" , + new_nid, cpu);
No thanks.
arch/powerpc/mm/numa.c int numa_update_cpu_topology(bool cpus_locked) · line 1416
Quoted 6 lines
arch/powerpc/mm/numa.c +2
-0@@ -1379,6 +1412,9 @@ int numa_update_cpu_topology(bool cpus_locked) cpu =cpu_last_thread_sibling (cpu); } +if (i) + updates[i-1 ].next =NULL ;
???
arch/powerpc/mm/numa.c static void topology_schedule_update(void) · line 1499
Quoted 11 lines
arch/powerpc/mm/numa.c +7
-0@@ -1453,6 +1490,14 @@ static void topology_schedule_update(void)schedule_work (&topology_work); } +void shared_topology_update (void ) +{ +if (firmware_has_feature (FW_FEATURE_VPHN ) && +lppaca_shared_proc (get_lppaca ())) +topology_schedule_update (); +} +EXPORT_SYMBOL (shared_topology_update);
There's no reason for that to be exported AFAICS.
arch/powerpc/platforms/pseries/dlpar.c static ssize_t dlpar_show(struct class *class, struct class_attribute *attr, · line 596
Quoted 10 lines
arch/powerpc/platforms/pseries/dlpar.c +2
-0@@ -592,6 +592,8 @@ static ssize_t dlpar_show(struct class *class, struct class_attribute *attr,static int __init pseries_dlpar_init (void ) { +shared_topology_update (); +
I don't see any reason to call that from here.
It could just as easily be a machine init call in the file where it lives.
cheers
Re: [PATCH V9 1/2] powerpc/numa: Update CPU topology when VPHN enabled
Quoted 8 lines · Michael Ellerman
Quoted 6 lines · Michael Bringmann
powerpc/numa: Correct the currently broken capability to set the topology for shared CPUs in LPARs. At boot time for shared CPU lpars, the topology for each shared CPU is set to node zero, however, this is now updated correctly using the Virtual Processor Home Node (VPHN) capabilities information provided by the pHyp.
Quoted 6 lines
Quoted 2 lines
Also, update initialization checks for device-tree attributes to independently recognize PRRN or VPHN usage.
Did you ever do anything to address Nathan's comments on v4 ?
Looking at this patch I do not see that VPHN is always enabled.
Quoted 11 lines
Also your change log doesn't describe anything about what the patch does and why it is the correct fix for the problem.
When a DLPAR happens you modify the VPHN timer to run in 1 nsec, but you don't wait for it. Why would we not just run the logic synchronously?
It also seems to make VPHN and PRRN no longer exclusive, which looking at PAPR seems like it might be correct, but is also a major change so please justify it in detail.
This is correct, they are not exclusive. When we first added PRRN support we mistakenly thought they were exclusive which is why the code currently only starts PRRN, or VPHN if PRRN is not present.
Quoted 24 lines
Comments below.
arch/powerpc/mm/numa.c void __init initmem_init(void) · line 910
Quoted 10 lines
arch/powerpc/mm/numa.c +1
-1@@ -906,7 +907,7 @@ void __init initmem_init(void)/* * Reduce the possible NUMA nodes to the online NUMA nodes, -* since we do not support node hotplug. This ensures that we +* since we do not support node hotplug. This ensures that we Please do whitespace/spelling changes in a separate patch.
Quoted 7 lines
arch/powerpc/mm/numa.c +0
-0* lower the maximum NUMA node ID to what is actually present. */ nodes_and (node_possible_map, node_possible_map, node_online_map);@@ -1148,11 +1149,32 @@ struct topology_update_data {int new_nid; };
Quoted 13 lines
arch/powerpc/mm/numa.c struct topology_update_data { · line 1161
Quoted 10 lines
arch/powerpc/mm/numa.c +5
-0+#define TOPOLOGY_DEF_TIMER_SECS 60 +static u8 vphn_cpu_change_counts[NR_CPUS ][MAX_DISTANCE_REF_POINTS ];static cpumask_t cpu_associativity_changes_mask;static int vphn_enabled;static int prrn_enabled;static void reset_topology_timer (void ); +static int topology_timer_secs =TOPOLOGY_DEF_TIMER_SECS ; +static int topology_inited; +static int topology_update_needed;None of this code should be in
numa.c. Which is not your fault but I'm inclined to move it before we make it worse.
Agreed. Perhaps this should all be in mm/vphn.c
-Nathan
Quoted 82 lines
Quoted 21 lines
arch/powerpc/mm/numa.c +16
-0+ +/* +* Change polling interval for associativity changes. +*/ +int timed_topology_update (int nsecs) +{ +if (nsecs >0 ) + topology_timer_secs = nsecs; +else + topology_timer_secs =TOPOLOGY_DEF_TIMER_SECS ; + +if (vphn_enabled) +reset_topology_timer (); + +return 0 ; +}/* * Store the current values of the associativity change counters in the arch/powerpc/mm/numa.c static long vphn_get_associativity(unsigned long cpu, · line 1274
Quoted 7 lines
arch/powerpc/mm/numa.c +4
-0@@ -1246,6 +1268,12 @@ static long vphn_get_associativity(unsigned long cpu,"hcall_vphn() experienced a hardware fault " "preventing VPHN. Disabling polling...\n");stop_topology_update (); +break ; +case H_SUCCESS : +printk (KERN_INFO +"VPHN hcall succeeded. Reset polling...\n" );We don't need that to hit everyone's console once a minute. Remove it or
pr_debug()if you like.arch/powerpc/mm/numa.c int numa_update_cpu_topology(bool cpus_locked) · line 1398
Quoted 6 lines
arch/powerpc/mm/numa.c +2
-0@@ -1363,6 +1394,8 @@ int numa_update_cpu_topology(bool cpus_locked)cpumask_andnot (&cpu_associativity_changes_mask, &cpu_associativity_changes_mask,cpu_sibling_mask (cpu)); +pr_info ("Assoc chg gives same node %d for cpu%d\n" , + new_nid, cpu);No thanks.
arch/powerpc/mm/numa.c int numa_update_cpu_topology(bool cpus_locked) · line 1416
Quoted 6 lines
arch/powerpc/mm/numa.c +2
-0@@ -1379,6 +1412,9 @@ int numa_update_cpu_topology(bool cpus_locked) cpu =cpu_last_thread_sibling (cpu); } +if (i) + updates[i-1 ].next =NULL ;???
arch/powerpc/mm/numa.c static void topology_schedule_update(void) · line 1499
Quoted 11 lines
arch/powerpc/mm/numa.c +7
-0@@ -1453,6 +1490,14 @@ static void topology_schedule_update(void)schedule_work (&topology_work); } +void shared_topology_update (void ) +{ +if (firmware_has_feature (FW_FEATURE_VPHN ) && +lppaca_shared_proc (get_lppaca ())) +topology_schedule_update (); +} +EXPORT_SYMBOL (shared_topology_update);There's no reason for that to be exported AFAICS.
arch/powerpc/platforms/pseries/dlpar.c static ssize_t dlpar_show(struct class *class, struct class_attribute *attr, · line 596
Quoted 10 lines
arch/powerpc/platforms/pseries/dlpar.c +2
-0@@ -592,6 +592,8 @@ static ssize_t dlpar_show(struct class *class, struct class_attribute *attr,static int __init pseries_dlpar_init (void ) { +shared_topology_update (); +I don't see any reason to call that from here.
It could just as easily be a machine init call in the file where it lives.
cheers
Michael Ellerman
reviewerRe: [PATCH V9 1/2] powerpc/numa: Update CPU topology when VPHN enabled
Quoted 9 lines · Nathan Fontenot
Quoted 8 lines · Michael Ellerman
Quoted 6 lines · Michael Bringmann
powerpc/numa: Correct the currently broken capability to set the topology for shared CPUs in LPARs. At boot time for shared CPU lpars, the topology for each shared CPU is set to node zero, however, this is now updated correctly using the Virtual Processor Home Node (VPHN) capabilities information provided by the pHyp.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Also, update initialization checks for device-tree attributes to independently recognize PRRN or VPHN usage.
Did you ever do anything to address Nathan's comments on v4 ?
Looking at this patch I do not see that VPHN is always enabled.
You mean *this* patch? Or v4?
I think you mean this patch, in which case I agree.
Quoted 6 lines
Quoted 6 lines
Also your change log doesn't describe anything about what the patch does and why it is the correct fix for the problem.
When a DLPAR happens you modify the VPHN timer to run in 1 nsec, but you don't wait for it. Why would we not just run the logic synchronously?
Quoted 7 lines
Quoted 3 lines
It also seems to make VPHN and PRRN no longer exclusive, which looking at PAPR seems like it might be correct, but is also a major change so please justify it in detail.
This is correct, they are not exclusive. When we first added PRRN support we mistakenly thought they were exclusive which is why the code currently only starts PRRN, or VPHN if PRRN is not present.
OK.
So we need a patch that does that and only that, and clearly explains why we're doing that and why it's the correct thing to do.
Then a 2nd patch can fiddle with the timer, if we must.
...
Quoted 8 lines
Quoted 6 lines
arch/powerpc/mm/numa.c struct topology_update_data { · line 1161
Quoted 3 lines
arch/powerpc/mm/numa.c +3
-0+static int topology_timer_secs =TOPOLOGY_DEF_TIMER_SECS ; +static int topology_inited; +static int topology_update_needed;None of this code should be in
numa.c. Which is not your fault but I'm inclined to move it before we make it worse.Agreed. Perhaps this should all be in
mm/vphn.c
Actually I was thinking platforms/pseries/vphn.c
cheers