remove extended cede offline mode and bogus topology update code
Subsystems (2)
cover remove extended cede offline mode and bogus topology update code
Two major parts to this series:
1. Removal of the extended cede offline mode for CPUs as well as the partition suspend code which accommodates it by temporarily onlining all CPUs prior to suspending the LPAR. This solves some accounting problems, simplifies the pseries CPU hotplug code, and greatly uncomplicates the existing partition suspend code, easing a much-needed transition to the Linux suspend framework. The two patches which make up this part have been posted before:
https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=180718
and they are simply incorporated unchanged into the larger series here, with Gautham's Reviewed-by added to patch #1.
2. Removal of the long-disabled "topology update" code, most of which resides in mm/numa.c, but there are pieces in pseries and rtasd to excise as well. This code was an attempt to honor changes in a partition's NUMA properties arising from resource reassignments which occur as part of a migration, VPHN change, or a Dynamic Platform Optimizer operation. Its main technique is to remove and re-add affected processors and LMBs and hope in vain that the changes in cpu-node and physaddr-node relationships aren't disruptive. We want to provide user space with some indication that Linux's logical NUMA representation has become out of sync with the platform's assignments, but we need to get this unusable stuff out of the way before this code can sustain new features.
Nathan Lynch (18):
powerpc/pseries: remove cede offline state for CPUs powerpc/rtas: don't online CPUs for partition suspend powerpc/numa: remove ability to enable topology updates powerpc/numa: remove unreachable topology update code powerpc/numa: make vphn_enabled, prrn_enabled flags const powerpc/numa: remove unreachable topology timer code powerpc/numa: remove unreachable topology workqueue code powerpc/numa: remove vphn_enabled and prrn_enabled internal flags powerpc/numa: stub out numa_update_cpu_topology() powerpc/numa: remove timed_topology_update() powerpc/numa: remove start/stop_topology_update() powerpc/rtasd: simplify handle_rtas_event(), emit message on events powerpc/numa: remove prrn_is_enabled()
powerpc/numa: remove arch_update_cpu_topology powerpc/pseries: remove prrn special case from DT update path powerpc/pseries: remove memory "re-add" implementation powerpc/pseries: remove dlpar_cpu_readd() powerpc/pseries: remove obsolete memory hotplug DT notifier code
Documentation/core-api/cpu_hotplug.rst | 7 - arch/powerpc/include/asm/rtas.h | 3 - arch/powerpc/include/asm/topology.h | 27 - arch/powerpc/kernel/rtas.c | 122 +---- arch/powerpc/kernel/rtasd.c | 28 +- arch/powerpc/mm/numa.c | 486 ------------------ arch/powerpc/platforms/pseries/hotplug-cpu.c | 189 +------ .../platforms/pseries/hotplug-memory.c | 107 +--- arch/powerpc/platforms/pseries/mobility.c | 31 -- .../platforms/pseries/offline_states.h | 38 -- arch/powerpc/platforms/pseries/pmem.c | 1 - arch/powerpc/platforms/pseries/smp.c | 28 +- arch/powerpc/platforms/pseries/suspend.c | 27 +- 13 files changed, 22 insertions(+), 1072 deletions(-) delete mode 100644 arch/powerpc/platforms/pseries/offline_states.h
Signature · 1 line
2.25.4
PATCH 1/18 powerpc/pseries: remove cede offline state for CPUs
This effectively reverts commit 3aa565f53c39 ("powerpc/pseries: Add hooks to put the CPU into an appropriate offline state"), which added an offline mode for CPUs which uses the H_CEDE hcall instead of the architected stop-self RTAS function in order to facilitate "folding" of dedicated mode processors on PowerVM platforms to achieve energy savings. This has been the default offline mode since its introduction.
There's nothing about stop-self that would prevent the hypervisor from achieving the energy savings available via H_CEDE, so the original premise of this change appears to be flawed.
I also have encountered the claim that the transition to and from ceded state is much faster than stop-self/start-cpu. Certainly we would not want to use stop-self as an *idle* mode. That is what H_CEDE is for. However, this difference is insignificant in the context of Linux CPU hotplug, where the latency of an offline or online operation on current systems is on the order of 100ms, mainly attributable to all the various subsystems' cpuhp callbacks.
The cede offline mode also prevents accurate accounting, as discussed before:
https://lore.kernel.org/linuxppc-dev/[email protected]/
Unconditionally use stop-self to offline processor threads. This is the architected method for offlining CPUs on PAPR systems.
The "cede_offline" boot parameter is rendered obsolete.
Removing this code enables the removal of the partition suspend code which temporarily onlines all present CPUs.
--- Documentation/core-api/cpu_hotplug.rst | 7 - arch/powerpc/platforms/pseries/hotplug-cpu.c | 170 ++---------------- .../platforms/pseries/offline_states.h | 38 ---- arch/powerpc/platforms/pseries/pmem.c | 1 - arch/powerpc/platforms/pseries/smp.c | 28 +-- 5 files changed, 15 insertions(+), 229 deletions(-) delete mode 100644 arch/powerpc/platforms/pseries/offline_states.h
Documentation/core-api/cpu_hotplug.rst +0 -7
@@ -50,13 +50,6 @@ Command Line Switches This option is limited to the X86 and S390 architecture. -``cede_offline={"off","on"}`` - Use this option to disable/enable putting offlined processors to an extended - ``H_CEDE`` state on supported pseries platforms. If nothing is specified, - ``cede_offline`` is set to "on". - - This option is limited to the PowerPC architecture. - ``cpu0_hotplug`` Allow to shutdown CPU0.
arch/powerpc/platforms/pseries/hotplug-cpu.c +14 -156
229 lines not on this page · raw message
arch/powerpc/platforms/pseries/offline_states.h deleted +0 -38
@@ -1,38 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _OFFLINE_STATES_H_ -#define _OFFLINE_STATES_H_ - -/* Cpu offline states go here */ -enum cpu_state_vals { -CPU_STATE_OFFLINE , -CPU_STATE_INACTIVE , -CPU_STATE_ONLINE , -CPU_MAX_OFFLINE_STATES -}; - -#ifdef CONFIG_HOTPLUG_CPU -extern enum cpu_state_vals get_cpu_current_state (int cpu); -extern void set_cpu_current_state (int cpu,enum cpu_state_vals state); -extern void set_preferred_offline_state (int cpu,enum cpu_state_vals state); -extern void set_default_offline_state (int cpu); -#else -static inline enum cpu_state_vals get_cpu_current_state (int cpu) -{ -return CPU_STATE_ONLINE ; -} - -static inline void set_cpu_current_state (int cpu,enum cpu_state_vals state) -{ -} - -static inline void set_preferred_offline_state (int cpu,enum cpu_state_vals state) -{ -} - -static inline void set_default_offline_state (int cpu) -{ -} -#endif - -extern enum cpu_state_vals get_preferred_offline_state (int cpu); -#endif
arch/powerpc/platforms/pseries/pmem.c +0 -1
@@ -24,7 +24,6 @@#include <asm/topology.h> #include "pseries.h" -#include "offline_states.h" static struct device_node *pmem_node;
arch/powerpc/platforms/pseries/smp.c +1 -27
@@ -44,8 +44,6 @@#include <asm/svm.h> #include "pseries.h" -#include "offline_states.h" -/* * The Primary thread of each non-boot processor was started from the OF client
@@ -108,10 +106,7 @@ static inline int smp_startup_cpu(unsigned int lcpu)/* Fixup atomic count: it exited inside IRQ handler. */ task_thread_info (paca_ptrs[lcpu]->__current)->preempt_count =0 ; -#ifdef CONFIG_HOTPLUG_CPU -if (get_cpu_current_state (lcpu) ==CPU_STATE_INACTIVE ) - goto out; -#endif +/* * If the RTAS start-cpu token does not exist then presume the * cpu is already spinning.
@@ -126,9 +121,6 @@ static inline int smp_startup_cpu(unsigned int lcpu)return 0 ; } -#ifdef CONFIG_HOTPLUG_CPU -out: -#endif return 1 ; }
@@ -143,10 +135,6 @@ static void smp_setup_cpu(int cpu)vpa_init (cpu);cpumask_clear_cpu (cpu, of_spin_mask); -#ifdef CONFIG_HOTPLUG_CPU -set_cpu_current_state (cpu,CPU_STATE_ONLINE ); -set_default_offline_state (cpu); -#endif }static int smp_pSeries_kick_cpu (int nr)
@@ -163,20 +151,6 @@ static int smp_pSeries_kick_cpu(int nr)* the processor will continue on to secondary_start */ paca_ptrs[nr]->cpu_start =1 ; -#ifdef CONFIG_HOTPLUG_CPU -set_preferred_offline_state (nr,CPU_STATE_ONLINE ); - -if (get_cpu_current_state (nr) ==CPU_STATE_INACTIVE ) { -long rc; -unsigned long hcpuid; - - hcpuid =get_hard_smp_processor_id (nr); - rc =plpar_hcall_norets (H_PROD , hcpuid); -if (rc !=H_SUCCESS ) -printk (KERN_ERR "Error: Prod to wake up processor %d " -"Ret= %ld\n" , nr, rc); - } -#endif return 0 ; }
Signature · 1 line
2.25.4
PATCH 2/18 powerpc/rtas: don't online CPUs for partition suspend
In reply to Nathan LynchPartition suspension, used for hibernation and migration, requires that the OS place all but one of the LPAR's processor threads into one of two states prior to calling the ibm,suspend-me RTAS function:
* the architected offline state (via RTAS stop-self); or
* the H_JOIN hcall, which does not return until the partition resumes execution
Using H_CEDE as the offline mode, introduced by
commit 3aa565f53c39 ("powerpc/pseries: Add hooks to put the CPU into an appropriate offline state"), means that any threads which are offline from Linux's point of view must be moved to one of those two states before a partition suspension can proceed.
This was eventually addressed in commit 120496ac2d2d ("powerpc: Bring all threads online prior to migration/hibernation"), which added code to temporarily bring up any offline processor threads so they can call H_JOIN. Conceptually this is fine, but the implementation has had multiple races with cpu hotplug operations initiated from user space[1][2][3], the error handling is fragile, and it generates user-visible cpu hotplug events which is a lot of noise for a platform feature that's supposed to minimize disruption to workloads.
With commit 3aa565f53c39 ("powerpc/pseries: Add hooks to put the CPU into an appropriate offline state") reverted, this code becomes unnecessary, so remove it. Since any offline CPUs now are truly offline from the platform's point of view, it is no longer necessary to bring up CPUs only to have them call H_JOIN and then go offline again upon resuming. Only active threads are required to call H_JOIN; stopped threads can be left alone.
[1] commit a6717c01ddc2 ("powerpc/rtas: use device model APIs and serialization during LPM")
[2] commit 9fb603050ffd ("powerpc/rtas: retry when cpu offline races with suspend/migration")
[3] commit dfd718a2ed1f ("powerpc/rtas: Fix a potential race between CPU-Offline & Migration")
--- arch/powerpc/include/asm/rtas.h | 2 - arch/powerpc/kernel/rtas.c | 122 +---------------------- arch/powerpc/platforms/pseries/suspend.c | 22 +--- 3 files changed, 3 insertions(+), 143 deletions(-)
arch/powerpc/include/asm/rtas.h +0 -2
@@ -253,8 +253,6 @@ extern int rtas_set_indicator_fast(int indicator, int index, int new_value);extern void rtas_progress (char *s,unsigned short hex);extern int rtas_suspend_cpu (struct rtas_suspend_me_data *data);extern int rtas_suspend_last_cpu (struct rtas_suspend_me_data *data); -extern int rtas_online_cpus_mask (cpumask_var_t cpus); -extern int rtas_offline_cpus_mask (cpumask_var_t cpus);extern int rtas_ibm_suspend_me (u64 handle);struct rtc_time ;
arch/powerpc/kernel/rtas.c +2 -120
157 lines not on this page · raw message
arch/powerpc/platforms/pseries/suspend.c +1 -21
@@ -132,15 +132,11 @@ static ssize_t store_hibernate(struct device *dev,struct device_attribute *attr, const char *buf, size_t count) { - cpumask_var_t offline_mask; int rc;if (!capable (CAP_SYS_ADMIN ))return -EPERM ; -if (!alloc_cpumask_var (&offline_mask,GFP_KERNEL )) -return -ENOMEM ; - stream_id =simple_strtoul (buf,NULL ,16 ); do {
@@ -150,32 +146,16 @@ static ssize_t store_hibernate(struct device *dev, }while (rc == -EAGAIN );if (!rc) { -/* All present CPUs must be online */ -cpumask_andnot (offline_mask, cpu_present_mask, - cpu_online_mask); - rc =rtas_online_cpus_mask (offline_mask); -if (rc) { -pr_err ("%s: Could not bring present CPUs online.\n" , - __func__); - goto out; - } -stop_topology_update (); rc =pm_suspend (PM_SUSPEND_MEM );start_topology_update (); - -/* Take down CPUs not online prior to suspend */ -if (!rtas_offline_cpus_mask (offline_mask)) -pr_warn ("%s: Could not restore CPUs to offline " -"state.\n" , __func__); } stream_id =0 ;if (!rc) rc = count; -out: -free_cpumask_var (offline_mask); +return rc; }
Signature · 1 line
2.25.4
PATCH 3/18 powerpc/numa: remove ability to enable topology updates
In reply to Nathan LynchRemove the /proc/powerpc/topology_updates interface and the topology_updates=on/off command line argument. The internal topology_updates_enabled flag remains for now, but always false.
--- arch/powerpc/mm/numa.c | 71 +----------------------------------------- 1 file changed, 1 insertion(+), 70 deletions(-)
arch/powerpc/mm/numa.c +1 -70
@@ -984,27 +984,7 @@ static int __init early_numa(char *p) }early_param ("numa" , early_numa); -/* -* The platform can inform us through one of several mechanisms -* (post-migration device tree updates, PRRN or VPHN) that the NUMA -* assignment of a resource has changed. This controls whether we act -* on that. Disabled by default. -*/ -static bool topology_updates_enabled; - -static int __init early_topology_updates (char *p) -{ -if (!p) -return 0 ; - -if (!strcmp (p,"on" )) { -pr_warn ("Caution: enabling topology updates\n" ); - topology_updates_enabled = true; - } - -return 0 ; -} -early_param ("topology_updates" , early_topology_updates); +static const bool topology_updates_enabled;#ifdef CONFIG_MEMORY_HOTPLUG /*
@@ -1632,52 +1612,6 @@ int prrn_is_enabled(void)return prrn_enabled; } -static int topology_read (struct seq_file *file,void *v) -{ -if (vphn_enabled || prrn_enabled) -seq_puts (file,"on\n" ); -else -seq_puts (file,"off\n" ); - -return 0 ; -} - -static int topology_open (struct inode *inode,struct file *file) -{ -return single_open (file, topology_read,NULL ); -} - -static ssize_t topology_write (struct file *file,const char __user *buf, -size_t count,loff_t *off) -{ -char kbuf[4 ];/* "on" or "off" plus null. */ -int read_len; - - read_len = count <3 ? count :3 ; -if (copy_from_user (kbuf, buf, read_len)) -return -EINVAL ; - - kbuf[read_len] ='\0' ; - -if (!strncmp (kbuf,"on" ,2 )) { - topology_updates_enabled = true; -start_topology_update (); - }else if (!strncmp (kbuf,"off" ,3 )) { -stop_topology_update (); - topology_updates_enabled = false; - }else -return -EINVAL ; - -return count; -} - -static const struct proc_ops topology_proc_ops = { - .proc_read = seq_read, - .proc_write = topology_write, - .proc_open = topology_open, - .proc_release = single_release, -}; -static int topology_update_init (void ) {start_topology_update ();
@@ -1685,9 +1619,6 @@ static int topology_update_init(void)if (vphn_enabled)topology_schedule_update (); -if (!proc_create ("powerpc/topology_updates" ,0644 ,NULL , &topology_proc_ops)) -return -ENOMEM ; - topology_inited =1 ;return 0 ; }
Signature · 1 line
2.25.4
Re: [PATCH 03/18] powerpc/numa: remove ability to enable topology updates
Quoted 4 lines · Nathan Lynch
Remove the
/proc/powerpc/topology_updatesinterface and the topology_updates=on/off command line argument. The internaltopology_updates_enabledflag remains for now, but always false.
Looks good to me.
Quoted 104 lines
Signed-off-by Nathan Lynch <[email protected]>--- arch/powerpc/mm/numa.c | 71 +----------------------------------------- 1 file changed, 1 insertion(+), 70 deletions(-)arch/powerpc/mm/numa.c +1
-70@@ -984,27 +984,7 @@ static int __init early_numa(char *p) }early_param ("numa" , early_numa); -/* -* The platform can inform us through one of several mechanisms -* (post-migration device tree updates, PRRN or VPHN) that the NUMA -* assignment of a resource has changed. This controls whether we act -* on that. Disabled by default. -*/ -static bool topology_updates_enabled; - -static int __init early_topology_updates (char *p) -{ -if (!p) -return 0 ; - -if (!strcmp (p,"on" )) { -pr_warn ("Caution: enabling topology updates\n" ); - topology_updates_enabled = true; - } - -return 0 ; -} -early_param ("topology_updates" , early_topology_updates); +static const bool topology_updates_enabled;#ifdef CONFIG_MEMORY_HOTPLUG /* @@ -1632,52 +1612,6 @@ int prrn_is_enabled(void)return prrn_enabled; } -static int topology_read (struct seq_file *file,void *v) -{ -if (vphn_enabled || prrn_enabled) -seq_puts (file,"on\n" ); -else -seq_puts (file,"off\n" ); - -return 0 ; -} - -static int topology_open (struct inode *inode,struct file *file) -{ -return single_open (file, topology_read,NULL ); -} - -static ssize_t topology_write (struct file *file,const char __user *buf, -size_t count,loff_t *off) -{ -char kbuf[4 ];/* "on" or "off" plus null. */ -int read_len; - - read_len = count <3 ? count :3 ; -if (copy_from_user (kbuf, buf, read_len)) -return -EINVAL ; - - kbuf[read_len] ='\0' ; - -if (!strncmp (kbuf,"on" ,2 )) { - topology_updates_enabled = true; -start_topology_update (); - }else if (!strncmp (kbuf,"off" ,3 )) { -stop_topology_update (); - topology_updates_enabled = false; - }else -return -EINVAL ; - -return count; -} - -static const struct proc_ops topology_proc_ops = { - .proc_read = seq_read, - .proc_write = topology_write, - .proc_open = topology_open, - .proc_release = single_release, -}; -static int topology_update_init (void ) {start_topology_update ();@@ -1685,9 +1619,6 @@ static int topology_update_init(void)if (vphn_enabled)topology_schedule_update (); -if (!proc_create ("powerpc/topology_updates" ,0644 ,NULL , &topology_proc_ops)) -return -ENOMEM ; - topology_inited =1 ;return 0 ; }Signature · 1 line
2.25.4
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
PATCH 4/18 powerpc/numa: remove unreachable topology update code
In reply to Nathan LynchSince the topology_updates_enabled flag is now always false, remove it and the code which has become unreachable. This is the minimum change that prevents 'defined but unused' warnings emitted by the compiler after stubbing out the start/stop_topology_updates() functions.
--- arch/powerpc/mm/numa.c | 149 +---------------------------------------- 1 file changed, 2 insertions(+), 147 deletions(-)
arch/powerpc/mm/numa.c +2 -147
@@ -984,8 +984,6 @@ static int __init early_numa(char *p) }early_param ("numa" , early_numa); -static const bool topology_updates_enabled; -#ifdef CONFIG_MEMORY_HOTPLUG /* * Find the node associated with a hot added memory section for
@@ -1133,7 +1131,6 @@ struct topology_update_data {#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;
@@ -1158,63 +1155,6 @@ int timed_topology_update(int nsecs)return 0 ; } -/* -* Store the current values of the associativity change counters in the -* hypervisor. -*/ -static void setup_cpu_associativity_change_counters (void ) -{ -int cpu; - -/* The VPHN feature supports a maximum of 8 reference points */ -BUILD_BUG_ON (MAX_DISTANCE_REF_POINTS >8 ); - -for_each_possible_cpu (cpu) { -int i; -u8 *counts = vphn_cpu_change_counts[cpu]; -volatile u8 *hypervisor_counts =lppaca_of (cpu).vphn_assoc_counts; - -for (i =0 ; i < distance_ref_points_depth; i++) - counts[i] = hypervisor_counts[i]; - } -} - -/* -* The hypervisor maintains a set of 8 associativity change counters in -* the VPA of each cpu that correspond to the associativity levels in the -* ibm,associativity-reference-points property. When an associativity -* level changes, the corresponding counter is incremented. -* -* Set a bit in cpu_associativity_changes_mask for each cpu whose home -* node associativity levels have changed. -* -* Returns the number of cpus with unhandled associativity changes. -*/ -static int update_cpu_associativity_changes_mask (void ) -{ -int cpu; -cpumask_t *changes = &cpu_associativity_changes_mask; - -for_each_possible_cpu (cpu) { -int i, changed =0 ; -u8 *counts = vphn_cpu_change_counts[cpu]; -volatile u8 *hypervisor_counts =lppaca_of (cpu).vphn_assoc_counts; - -for (i =0 ; i < distance_ref_points_depth; i++) { -if (hypervisor_counts[i] != counts[i]) { - counts[i] = hypervisor_counts[i]; - changed =1 ; - } - } -if (changed) { -cpumask_or (changes, changes,cpu_sibling_mask (cpu)); - cpu =cpu_last_thread_sibling (cpu); - } - } - -return cpumask_weight (changes); -} -/* * Retrieve the new associativity information for a virtual processor's * home node.
@@ -1498,16 +1438,6 @@ static void topology_schedule_update(void)schedule_work (&topology_work); } -static void topology_timer_fn (struct timer_list *unused) -{ -if (prrn_enabled &&cpumask_weight (&cpu_associativity_changes_mask)) -topology_schedule_update (); -else if (vphn_enabled) { -if (update_cpu_associativity_changes_mask () >0 ) -topology_schedule_update (); -reset_topology_timer (); - } -}static struct timer_list topology_timer;static void reset_topology_timer (void )
@@ -1516,69 +1446,12 @@ static void reset_topology_timer(void)mod_timer (&topology_timer, jiffies + topology_timer_secs *HZ ); } -#ifdef CONFIG_SMP - -static int dt_update_callback (struct notifier_block *nb, -unsigned long action,void *data) -{ -struct of_reconfig_data *update = data; -int rc =NOTIFY_DONE ; - -switch (action) { -case OF_RECONFIG_UPDATE_PROPERTY : -if (of_node_is_type (update->dn,"cpu" ) && - !of_prop_cmp (update->prop->name,"ibm,associativity" )) { -u32 core_id; -of_property_read_u32 (update->dn,"reg" , &core_id); - rc =dlpar_cpu_readd (core_id); - rc =NOTIFY_OK ; - } -break ; - } - -return rc; -} - -static struct notifier_block dt_update_nb = { - .notifier_call = dt_update_callback, -}; - -#endif -/* * Start polling for associativity changes. */ int start_topology_update (void ) { -int rc =0 ; - -if (!topology_updates_enabled) -return 0 ; - -if (firmware_has_feature (FW_FEATURE_PRRN )) { -if (!prrn_enabled) { - prrn_enabled =1 ; -#ifdef CONFIG_SMP - rc =of_reconfig_notifier_register (&dt_update_nb); -#endif - } - } -if (firmware_has_feature (FW_FEATURE_VPHN ) && -lppaca_shared_proc (get_lppaca ())) { -if (!vphn_enabled) { - vphn_enabled =1 ; -setup_cpu_associativity_change_counters (); -timer_setup (&topology_timer, topology_timer_fn, -TIMER_DEFERRABLE ); -reset_topology_timer (); - } - } - -pr_info ("Starting topology update%s%s\n" , - (prrn_enabled ?" prrn_enabled" :"" ), - (vphn_enabled ?" vphn_enabled" :"" )); - -return rc; +return 0 ; }/*
@@ -1586,25 +1459,7 @@ int start_topology_update(void)*/ int stop_topology_update (void ) { -int rc =0 ; - -if (!topology_updates_enabled) -return 0 ; - -if (prrn_enabled) { - prrn_enabled =0 ; -#ifdef CONFIG_SMP - rc =of_reconfig_notifier_unregister (&dt_update_nb); -#endif - } -if (vphn_enabled) { - vphn_enabled =0 ; - rc =del_timer_sync (&topology_timer); - } - -pr_info ("Stopping topology update\n" ); - -return rc; +return 0 ; }int prrn_is_enabled (void )
Signature · 1 line
2.25.4
Re: [PATCH 04/18] powerpc/numa: remove unreachable topology update code
Quoted 6 lines · Nathan Lynch
Since the
topology_updates_enabledflag is now always false, remove it and the code which has become unreachable. This is the minimum change that prevents 'defined but unused' warnings emitted by the compiler after stubbing out the start/stop_topology_updates() functions.Signed-off-by Nathan Lynch <[email protected]>
Looks good to me.
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
PATCH 5/18 powerpc/numa: make vphn_enabled, prrn_enabled flags const
In reply to Nathan LynchPrevious changes have made it so these flags are never changed; enforce this by making them const.
--- arch/powerpc/mm/numa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/mm/numa.c +2 -2
@@ -1132,8 +1132,8 @@ struct topology_update_data {#define TOPOLOGY_DEF_TIMER_SECS 60static cpumask_t cpu_associativity_changes_mask; -static int vphn_enabled; -static int prrn_enabled; +static const int vphn_enabled; +static const int prrn_enabled;static void reset_topology_timer (void );static int topology_timer_secs =1 ;static int topology_inited;
Signature · 1 line
2.25.4
Re: [PATCH 05/18] powerpc/numa: make vphn_enabled, prrn_enabled flags const
Quoted 5 lines · Nathan Lynch
Previous changes have made it so these flags are never changed; enforce this by making them const.
Signed-off-by Nathan Lynch <[email protected]>---
Looks good to me.
Quoted 21 lines
arch/powerpc/mm/numa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/powerpc/mm/numa.c +2
-2@@ -1132,8 +1132,8 @@ struct topology_update_data {#define TOPOLOGY_DEF_TIMER_SECS 60static cpumask_t cpu_associativity_changes_mask; -static int vphn_enabled; -static int prrn_enabled; +static const int vphn_enabled; +static const int prrn_enabled;static void reset_topology_timer (void );static int topology_timer_secs =1 ;static int topology_inited;Signature · 1 line
2.25.4
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
PATCH 6/18 powerpc/numa: remove unreachable topology timer code
In reply to Nathan LynchSince vphn_enabled is always 0, we can stub out timed_topology_update() and remove the code which becomes unreachable.
--- arch/powerpc/mm/numa.c | 21 --------------------- 1 file changed, 21 deletions(-)
arch/powerpc/mm/numa.c +0 -21
@@ -1129,13 +1129,9 @@ struct topology_update_data {int new_nid; }; -#define TOPOLOGY_DEF_TIMER_SECS 60 -static cpumask_t cpu_associativity_changes_mask;static const int vphn_enabled;static const int prrn_enabled; -static void reset_topology_timer (void ); -static int topology_timer_secs =1 ;static int topology_inited;/*
@@ -1143,15 +1139,6 @@ static int topology_inited;*/ int timed_topology_update (int nsecs) { -if (vphn_enabled) { -if (nsecs >0 ) - topology_timer_secs = nsecs; -else - topology_timer_secs =TOPOLOGY_DEF_TIMER_SECS ; - -reset_topology_timer (); - } -return 0 ; }
@@ -1438,14 +1425,6 @@ static void topology_schedule_update(void)schedule_work (&topology_work); } -static struct timer_list topology_timer; - -static void reset_topology_timer (void ) -{ -if (vphn_enabled) -mod_timer (&topology_timer, jiffies + topology_timer_secs *HZ ); -} -/* * Start polling for associativity changes. */
Signature · 1 line
2.25.4
Re: [PATCH 06/18] powerpc/numa: remove unreachable topology timer code
Quoted 8 lines · Nathan Lynch
Since
vphn_enabledis always 0, we can stub outtimed_topology_update()and remove the code which becomes unreachable.Signed-off-by Nathan Lynch <[email protected]>--- arch/powerpc/mm/numa.c | 21 --------------------- 1 file changed, 21 deletions(-)
Looks good to me.
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
PATCH 7/18 powerpc/numa: remove unreachable topology workqueue code
In reply to Nathan LynchSince vphn_enabled is always 0, we can remove the call to topology_schedule_update() and remove the code which becomes unreachable as a result.
--- arch/powerpc/mm/numa.c | 14 -------------- 1 file changed, 14 deletions(-)
arch/powerpc/mm/numa.c +0 -14
@@ -1414,17 +1414,6 @@ int arch_update_cpu_topology(void)return numa_update_cpu_topology (true); } -static void topology_work_fn (struct work_struct *work) -{ -rebuild_sched_domains (); -} -static DECLARE_WORK(topology_work, topology_work_fn); - -static void topology_schedule_update (void ) -{ -schedule_work (&topology_work); -} -/* * Start polling for associativity changes. */
@@ -1450,9 +1439,6 @@ static int topology_update_init(void) {start_topology_update (); -if (vphn_enabled) -topology_schedule_update (); - topology_inited =1 ;return 0 ; }
Signature · 1 line
2.25.4
Re: [PATCH 07/18] powerpc/numa: remove unreachable topology workqueue code
Quoted 9 lines · Nathan Lynch
Since
vphn_enabledis always 0, we can remove the call totopology_schedule_update()and remove the code which becomes unreachable as a result.Signed-off-by Nathan Lynch <[email protected]>--- arch/powerpc/mm/numa.c | 14 -------------- 1 file changed, 14 deletions(-)
Looks good to me.
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
PATCH 8/18 powerpc/numa: remove vphn_enabled and prrn_enabled internal flags
In reply to Nathan LynchThese flags are always zero now; remove them and suitably adjust the remaining references to them.
--- arch/powerpc/mm/numa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/powerpc/mm/numa.c +2 -4
@@ -1130,8 +1130,6 @@ struct topology_update_data { };static cpumask_t cpu_associativity_changes_mask; -static const int vphn_enabled; -static const int prrn_enabled;static int topology_inited;/*
@@ -1292,7 +1290,7 @@ int numa_update_cpu_topology(bool cpus_locked)struct device *dev;int weight, new_nid, i =0 ; -if (!prrn_enabled && !vphn_enabled && topology_inited) +if (topology_inited)return 0 ; weight =cpumask_weight (&cpu_associativity_changes_mask);
@@ -1432,7 +1430,7 @@ int stop_topology_update(void)int prrn_is_enabled (void ) { -return prrn_enabled; +return 0 ; }static int topology_update_init (void )
Signature · 1 line
2.25.4
Re: [PATCH 08/18] powerpc/numa: remove vphn_enabled and prrn_enabled internal flags
Quoted 8 lines · Nathan Lynch
These flags are always zero now; remove them and suitably adjust the remaining references to them.
Signed-off-by Nathan Lynch <[email protected]>--- arch/powerpc/mm/numa.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Looks good to me.
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
PATCH 9/18 powerpc/numa: stub out numa_update_cpu_topology()
In reply to Nathan LynchPrevious changes have removed the code which sets bits in cpu_associativity_changes_mask and thus it is never modifed at runtime. From this we can reason that numa_update_cpu_topology() always returns 0 without doing anything. Remove the body of numa_update_cpu_topology() and remove all code which becomes unreachable as a result.
--- arch/powerpc/mm/numa.c | 193 +---------------------------------------- 1 file changed, 1 insertion(+), 192 deletions(-)
arch/powerpc/mm/numa.c +1 -192
@@ -1122,14 +1122,6 @@ u64 memory_hotplug_max(void)/* Virtual Processor Home Node (VPHN) support */ #ifdef CONFIG_PPC_SPLPAR -struct topology_update_data { -struct topology_update_data *next; -unsigned int cpu; -int old_nid; -int new_nid; -}; - -static cpumask_t cpu_associativity_changes_mask;static int topology_inited;/*
@@ -1219,192 +1211,9 @@ int find_and_online_cpu_nid(int cpu)return new_nid; } -/* -* Update the CPU maps and sysfs entries for a single CPU when its NUMA -* characteristics change. This function doesn't perform any locking and is -* only safe to call from stop_machine(). -*/ -static int update_cpu_topology (void *data) -{ -struct topology_update_data *update; -unsigned long cpu; - -if (!data) -return -EINVAL ; - - cpu =smp_processor_id (); - -for (update = data; update; update = update->next) { -int new_nid = update->new_nid; -if (cpu != update->cpu) -continue ; - -unmap_cpu_from_node (cpu); -map_cpu_to_node (cpu, new_nid); -set_cpu_numa_node (cpu, new_nid); -set_cpu_numa_mem (cpu,local_memory_node (new_nid)); -vdso_getcpu_init (); - } - -return 0 ; -} - -static int update_lookup_table (void *data) -{ -struct topology_update_data *update; - -if (!data) -return -EINVAL ; - -/* -* Upon topology update, the numa-cpu lookup table needs to be updated -* for all threads in the core, including offline CPUs, to ensure that -* future hotplug operations respect the cpu-to-node associativity -* properly. -*/ -for (update = data; update; update = update->next) { -int nid, base, j; - - nid = update->new_nid; - base =cpu_first_thread_sibling (update->cpu); - -for (j =0 ; j < threads_per_core; j++) { -update_numa_cpu_lookup_table (base + j, nid); - } - } - -return 0 ; -} - -/* -* Update the node maps and sysfs entries for each cpu whose home node -* has changed. Returns 1 when the topology has changed, and 0 otherwise. -* -* cpus_locked says whether we already hold cpu_hotplug_lock. -*/ int numa_update_cpu_topology (bool cpus_locked) { -unsigned int cpu, sibling, changed =0 ; -struct topology_update_data *updates, *ud; -cpumask_t updated_cpus; -struct device *dev; -int weight, new_nid, i =0 ; - -if (topology_inited) -return 0 ; - - weight =cpumask_weight (&cpu_associativity_changes_mask); -if (!weight) -return 0 ; - - updates =kcalloc (weight,sizeof (*updates),GFP_KERNEL ); -if (!updates) -return 0 ; - -cpumask_clear (&updated_cpus); - -for_each_cpu (cpu, &cpu_associativity_changes_mask) { -/* -* If siblings aren't flagged for changes, updates list -* will be too short. Skip on this update and set for next -* update. -*/ -if (!cpumask_subset (cpu_sibling_mask (cpu), - &cpu_associativity_changes_mask)) { -pr_info ("Sibling bits not set for associativity " -"change, cpu%d\n" , cpu); -cpumask_or (&cpu_associativity_changes_mask, - &cpu_associativity_changes_mask, -cpu_sibling_mask (cpu)); - cpu =cpu_last_thread_sibling (cpu); -continue ; - } - - new_nid =find_and_online_cpu_nid (cpu); - -if (new_nid == numa_cpu_lookup_table[cpu]) { -cpumask_andnot (&cpu_associativity_changes_mask, - &cpu_associativity_changes_mask, -cpu_sibling_mask (cpu)); -dbg ("Assoc chg gives same node %d for cpu%d\n" , - new_nid, cpu); - cpu =cpu_last_thread_sibling (cpu); -continue ; - } - -for_each_cpu (sibling,cpu_sibling_mask (cpu)) { - ud = &updates[i++]; - ud->next = &updates[i]; - ud->cpu = sibling; - ud->new_nid = new_nid; - ud->old_nid = numa_cpu_lookup_table[sibling]; -cpumask_set_cpu (sibling, &updated_cpus); - } - cpu =cpu_last_thread_sibling (cpu); - } - -/* -* Prevent processing of 'updates' from overflowing array -* where last entry filled in a 'next' pointer. -*/ -if (i) - updates[i-1 ].next =NULL ; - -pr_debug ("Topology update for the following CPUs:\n" ); -if (cpumask_weight (&updated_cpus)) { -for (ud = &updates[0 ]; ud; ud = ud->next) { -pr_debug ("cpu %d moving from node %d " -"to %d\n" , ud->cpu, - ud->old_nid, ud->new_nid); - } - } - -/* -* In cases where we have nothing to update (because the updates list -* is too short or because the new topology is same as the old one), -* skip invoking update_cpu_topology() via stop-machine(). This is -* necessary (and not just a fast-path optimization) since stop-machine -* can end up electing a random CPU to run update_cpu_topology(), and -* thus trick us into setting up incorrect cpu-node mappings (since -* 'updates' is kzalloc()'ed). -* -* And for the similar reason, we will skip all the following updating. -*/ -if (!cpumask_weight (&updated_cpus)) - goto out; - -if (cpus_locked) -stop_machine_cpuslocked (update_cpu_topology, &updates[0 ], - &updated_cpus); -else -stop_machine (update_cpu_topology, &updates[0 ], &updated_cpus); - -/* -* Update the numa-cpu lookup table with the new mappings, even for -* offline CPUs. It is best to perform this update from the stop- -* machine context. -*/ -if (cpus_locked) -stop_machine_cpuslocked (update_lookup_table, &updates[0 ], -cpumask_of (raw_smp_processor_id ())); -else -stop_machine (update_lookup_table, &updates[0 ], -cpumask_of (raw_smp_processor_id ())); - -for (ud = &updates[0 ]; ud; ud = ud->next) { -unregister_cpu_under_node (ud->cpu, ud->old_nid); -register_cpu_under_node (ud->cpu, ud->new_nid); - - dev =get_cpu_device (ud->cpu); -if (dev) -kobject_uevent (&dev->kobj,KOBJ_CHANGE ); -cpumask_clear_cpu (ud->cpu, &cpu_associativity_changes_mask); - changed =1 ; - } - -out: -kfree (updates); -return changed; +return 0 ; }int arch_update_cpu_topology (void )
Signature · 1 line
2.25.4
Re: [PATCH 09/18] powerpc/numa: stub out numa_update_cpu_topology()
Quoted 7 lines · Nathan Lynch
Previous changes have removed the code which sets bits in
cpu_associativity_changes_maskand thus it is never modifed at runtime. From this we can reason thatnuma_update_cpu_topology()always returns 0 without doing anything. Remove the body ofnuma_update_cpu_topology()and remove all code which becomes unreachable as a result.
Quoted 5 lines
Signed-off-by Nathan Lynch <[email protected]>--- arch/powerpc/mm/numa.c | 193 +---------------------------------------- 1 file changed, 1 insertion(+), 192 deletions(-)
Looks good to me.
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
PATCH 10/18 powerpc/numa: remove timed_topology_update()
In reply to Nathan Lynchtimed_topology_update is a no-op now, so remove it and all call sites.
--- arch/powerpc/include/asm/topology.h | 5 ----- arch/powerpc/mm/numa.c | 9 --------- arch/powerpc/platforms/pseries/hotplug-cpu.c | 2 -- 3 files changed, 16 deletions(-)
arch/powerpc/include/asm/topology.h +0 -5
@@ -97,7 +97,6 @@ extern int start_topology_update(void);extern int stop_topology_update (void );extern int prrn_is_enabled (void );extern int find_and_online_cpu_nid (int cpu); -extern int timed_topology_update (int nsecs);#else static inline int start_topology_update (void ) {
@@ -115,10 +114,6 @@ static inline int find_and_online_cpu_nid(int cpu) {return 0 ; } -static inline int timed_topology_update (int nsecs) -{ -return 0 ; -}#endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */
arch/powerpc/mm/numa.c +0 -9
@@ -1124,14 +1124,6 @@ u64 memory_hotplug_max(void)#ifdef CONFIG_PPC_SPLPAR static int topology_inited; -/* -* Change polling interval for associativity changes. -*/ -int timed_topology_update (int nsecs) -{ -return 0 ; -} -/* * Retrieve the new associativity information for a virtual processor's * home node.
@@ -1147,7 +1139,6 @@ static long vphn_get_associativity(unsigned long cpu,switch (rc) {case H_SUCCESS :dbg ("VPHN hcall succeeded. Reset polling...\n" ); -timed_topology_update (0 ); goto out;case H_FUNCTION :
arch/powerpc/platforms/pseries/hotplug-cpu.c +0 -2
@@ -263,7 +263,6 @@ static int dlpar_offline_cpu(struct device_node *dn)break ;cpu_maps_update_done (); -timed_topology_update (1 ); rc =device_offline (get_cpu_device (cpu));if (rc) goto out;
@@ -302,7 +301,6 @@ static int dlpar_online_cpu(struct device_node *dn)if (get_hard_smp_processor_id (cpu) != thread)continue ;cpu_maps_update_done (); -timed_topology_update (1 );find_and_online_cpu_nid (cpu); rc =device_online (get_cpu_device (cpu));if (rc) {
Signature · 1 line
2.25.4
Re: [PATCH 10/18] powerpc/numa: remove timed_topology_update()
Quoted 9 lines · Nathan Lynch
timed_topology_updateis a no-op now, so remove it and all call sites.Signed-off-by Nathan Lynch <[email protected]>--- arch/powerpc/include/asm/topology.h | 5 ----- arch/powerpc/mm/numa.c | 9 --------- arch/powerpc/platforms/pseries/hotplug-cpu.c | 2 -- 3 files changed, 16 deletions(-)
Looks good to me.
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
PATCH 11/18 powerpc/numa: remove start/stop_topology_update()
In reply to Nathan LynchThese APIs have become no-ops, so remove them and all call sites.
--- arch/powerpc/include/asm/topology.h | 10 ---------- arch/powerpc/mm/numa.c | 20 -------------------- arch/powerpc/platforms/pseries/mobility.c | 4 ---- arch/powerpc/platforms/pseries/suspend.c | 5 +---- 4 files changed, 1 insertion(+), 38 deletions(-)
arch/powerpc/include/asm/topology.h +0 -10
@@ -93,19 +93,9 @@ static inline int cpu_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc)#endif /* CONFIG_NUMA */ #if defined(CONFIG_NUMA ) && defined(CONFIG_PPC_SPLPAR ) -extern int start_topology_update (void ); -extern int stop_topology_update (void );extern int prrn_is_enabled (void );extern int find_and_online_cpu_nid (int cpu);#else -static inline int start_topology_update (void ) -{ -return 0 ; -} -static inline int stop_topology_update (void ) -{ -return 0 ; -}static inline int prrn_is_enabled (void ) {return 0 ;
arch/powerpc/mm/numa.c +0 -20
@@ -1157,8 +1157,6 @@ static long vphn_get_associativity(unsigned long cpu, , rc);break ; } - -stop_topology_update (); out:return rc; }
@@ -1212,22 +1210,6 @@ int arch_update_cpu_topology(void)return numa_update_cpu_topology (true); } -/* -* Start polling for associativity changes. -*/ -int start_topology_update (void ) -{ -return 0 ; -} - -/* -* Disable polling for VPHN associativity changes. -*/ -int stop_topology_update (void ) -{ -return 0 ; -} -int prrn_is_enabled (void ) {return 0 ;
@@ -1235,8 +1217,6 @@ int prrn_is_enabled(void)static int topology_update_init (void ) { -start_topology_update (); - topology_inited =1 ;return 0 ; }
arch/powerpc/platforms/pseries/mobility.c +0 -4
@@ -388,8 +388,6 @@ static ssize_t migration_store(struct class *class,if (rc)return rc; -stop_topology_update (); - do { rc = rtas_ibm_suspend_me(streamid); if (rc == -EAGAIN)
@@ -401,8 +399,6 @@ static ssize_t migration_store(struct class *class,post_mobility_fixup (); -start_topology_update (); -return count; }
arch/powerpc/platforms/pseries/suspend.c +1 -4
@@ -145,11 +145,8 @@ static ssize_t store_hibernate(struct device *dev,ssleep (1 ); }while (rc == -EAGAIN ); -if (!rc) { -stop_topology_update (); +if (!rc) rc =pm_suspend (PM_SUSPEND_MEM ); -start_topology_update (); - } stream_id =0 ;
Signature · 1 line
2.25.4
Re: [PATCH 11/18] powerpc/numa: remove start/stop_topology_update()
Quoted 4 lines · Nathan Lynch
These APIs have become no-ops, so remove them and all call sites.
Signed-off-by Nathan Lynch <[email protected]>---
Looks good to me.
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
PATCH 12/18 powerpc/rtasd: simplify handle_rtas_event(), emit message on events
In reply to Nathan Lynchprrn_is_enabled() always returns false/0, so handle_rtas_event() can be simplified and some dead code can be removed. Use machine_is() instead of #ifdef to run this code only on pseries, and add an informational ratelimited message that we are ignoring the events. PRRN events are relatively rare in normal operation and usually arise from operator-initiated actions such as a DPO (Dynamic Platform Optimizer) run.
Eventually we do want to consume these events and update the device tree, but that needs more care to be safe vs LPM and DLPAR.
--- arch/powerpc/kernel/rtasd.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-)
arch/powerpc/kernel/rtasd.c +3 -25
@@ -273,37 +273,15 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal) } } -#ifdef CONFIG_PPC_PSERIES -static void handle_prrn_event (s32 scope) -{ -/* -* For PRRN, we must pass the negative of the scope value in -* the RTAS event. -*/ -pseries_devicetree_update (-scope); -numa_update_cpu_topology (false); -} -static void handle_rtas_event (const struct rtas_error_log *log) { -if (rtas_error_type (log) !=RTAS_TYPE_PRRN || !prrn_is_enabled ()) +if (!machine_is (pseries))return ; -/* For PRRN Events the extended log length is used to denote -* the scope for calling rtas update-nodes. -*/ -handle_prrn_event (rtas_error_extended_log_length (log)); +if (rtas_error_type (log) ==RTAS_TYPE_PRRN ) +pr_info_ratelimited ("Platform resource reassignment ignored.\n" ); } -#else - -static void handle_rtas_event (const struct rtas_error_log *log) -{ -return ; -} - -#endif -static int rtas_log_open (struct inode * inode,struct file * file) {return 0 ;
Signature · 1 line
2.25.4
Re: [PATCH 12/18] powerpc/rtasd: simplify handle_rtas_event(), emit message on events
Quoted 8 lines · Nathan Lynch
prrn_is_enabled()always returns false/0, sohandle_rtas_event()can be simplified and some dead code can be removed. Usemachine_is()instead of #ifdef to run this code only on pseries, and add an informational ratelimited message that we are ignoring the events. PRRN events are relatively rare in normal operation and usually arise from operator-initiated actions such as a DPO (Dynamic Platform Optimizer) run.
Quoted 8 lines
Eventually we do want to consume these events and update the device tree, but that needs more care to be safe vs LPM and DLPAR.
Signed-off-by Nathan Lynch <[email protected]>--- arch/powerpc/kernel/rtasd.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-)
Looks good to me.
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
PATCH 13/18 powerpc/numa: remove prrn_is_enabled()
In reply to Nathan LynchAll users of this prrn_is_enabled() are gone; remove it.
--- arch/powerpc/include/asm/topology.h | 5 ----- arch/powerpc/mm/numa.c | 5 ----- 2 files changed, 10 deletions(-)
arch/powerpc/include/asm/topology.h +0 -5
@@ -93,13 +93,8 @@ static inline int cpu_distance(__be32 *cpu1_assoc, __be32 *cpu2_assoc)#endif /* CONFIG_NUMA */ #if defined(CONFIG_NUMA ) && defined(CONFIG_PPC_SPLPAR ) -extern int prrn_is_enabled (void );extern int find_and_online_cpu_nid (int cpu);#else -static inline int prrn_is_enabled (void ) -{ -return 0 ; -}static inline int find_and_online_cpu_nid (int cpu) {return 0 ;
arch/powerpc/mm/numa.c +0 -5
@@ -1210,11 +1210,6 @@ int arch_update_cpu_topology(void)return numa_update_cpu_topology (true); } -int prrn_is_enabled (void ) -{ -return 0 ; -} -static int topology_update_init (void ) { topology_inited =1 ;
Signature · 1 line
2.25.4
Re: [PATCH 13/18] powerpc/numa: remove prrn_is_enabled()
Quoted 8 lines · Nathan Lynch
All users of this
prrn_is_enabled()are gone; remove it.Signed-off-by Nathan Lynch <[email protected]>--- arch/powerpc/include/asm/topology.h | 5 ----- arch/powerpc/mm/numa.c | 5 ----- 2 files changed, 10 deletions(-)
Looks good to me.
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
PATCH 14/18 powerpc/numa: remove arch_update_cpu_topology
In reply to Nathan LynchSince arch_update_cpu_topology() doesn't do anything on powerpc now, remove it and associated dead code.
--- arch/powerpc/include/asm/topology.h | 6 ------ arch/powerpc/mm/numa.c | 10 ---------- 2 files changed, 16 deletions(-)
arch/powerpc/include/asm/topology.h +0 -6
@@ -43,7 +43,6 @@ extern void __init dump_numa_cpu_topology(void);extern int sysfs_add_device_to_node (struct device *dev,int nid);extern void sysfs_remove_device_from_node (struct device *dev,int nid); -extern int numa_update_cpu_topology (bool cpus_locked);static inline void update_numa_cpu_lookup_table (unsigned int cpu,int node) {
@@ -78,11 +77,6 @@ static inline void sysfs_remove_device_from_node(struct device *dev, { } -static inline int numa_update_cpu_topology (bool cpus_locked) -{ -return 0 ; -} -static inline void update_numa_cpu_lookup_table (unsigned int cpu,int node) {}static inline int cpu_distance (__be32 *cpu1_assoc,__be32 *cpu2_assoc)
arch/powerpc/mm/numa.c +0 -10
@@ -1200,16 +1200,6 @@ int find_and_online_cpu_nid(int cpu)return new_nid; } -int numa_update_cpu_topology (bool cpus_locked) -{ -return 0 ; -} - -int arch_update_cpu_topology (void ) -{ -return numa_update_cpu_topology (true); -} -static int topology_update_init (void ) { topology_inited =1 ;
Signature · 1 line
2.25.4
Re: [PATCH 14/18] powerpc/numa: remove arch_update_cpu_topology
Quoted 9 lines · Nathan Lynch
Since
arch_update_cpu_topology()doesn't do anything on powerpc now, remove it and associated dead code.Signed-off-by Nathan Lynch <[email protected]>--- arch/powerpc/include/asm/topology.h | 6 ------ arch/powerpc/mm/numa.c | 10 ---------- 2 files changed, 16 deletions(-)
Looks good to me.
Signature · 2 lines
Thanks and Regards Srikar Dronamraju
PATCH 15/18 powerpc/pseries: remove prrn special case from DT update path
In reply to Nathan Lynchpseries_devicetree_update() is no longer called with PRRN_SCOPE. The purpose of prrn_update_node() was to remove and then add back a LMB whose NUMA assignment had changed. This has never been reliable, and this codepath has been default-disabled for several releases. Remove prrn_update_node().
--- arch/powerpc/platforms/pseries/mobility.c | 27 ----------------------- 1 file changed, 27 deletions(-)
arch/powerpc/platforms/pseries/mobility.c +0 -27
@@ -244,29 +244,6 @@ static int add_dt_node(__be32 parent_phandle, __be32 drc_index)return rc; } -static void prrn_update_node (__be32 phandle) -{ -struct pseries_hp_errorlog hp_elog; -struct device_node *dn; - -/* -* If a node is found from a the given phandle, the phandle does not -* represent the drc index of an LMB and we can ignore. -*/ - dn =of_find_node_by_phandle (be32_to_cpu (phandle)); -if (dn) { -of_node_put (dn); -return ; - } - - hp_elog.resource =PSERIES_HP_ELOG_RESOURCE_MEM ; - hp_elog.action =PSERIES_HP_ELOG_ACTION_READD ; - hp_elog.id_type =PSERIES_HP_ELOG_ID_DRC_INDEX ; - hp_elog._drc_u.drc_index = phandle; - -handle_dlpar_errorlog (&hp_elog); -} -int pseries_devicetree_update (s32 scope) {char *rtas_buf;
@@ -305,10 +282,6 @@ int pseries_devicetree_update(s32 scope)break ;case UPDATE_DT_NODE :update_dt_node (phandle, scope); - -if (scope ==PRRN_SCOPE ) -prrn_update_node (phandle); -break ;case ADD_DT_NODE : drc_index = *data++;
Signature · 1 line
2.25.4
PATCH 16/18 powerpc/pseries: remove memory "re-add" implementation
In reply to Nathan Lynchdlpar_memory() no longer has any callers which pass PSERIES_HP_ELOG_ACTION_READD. Remove this case and the corresponding unreachable code.
--- arch/powerpc/include/asm/rtas.h | 1 - .../platforms/pseries/hotplug-memory.c | 42 ------------------- 2 files changed, 43 deletions(-)
arch/powerpc/include/asm/rtas.h +0 -1
@@ -215,7 +215,6 @@ inline uint16_t pseries_errorlog_length(struct pseries_errorlog *sect)#define PSERIES_HP_ELOG_ACTION_ADD 1#define PSERIES_HP_ELOG_ACTION_REMOVE 2 -#define PSERIES_HP_ELOG_ACTION_READD 3#define PSERIES_HP_ELOG_ID_DRC_NAME 1#define PSERIES_HP_ELOG_ID_DRC_INDEX 2
arch/powerpc/platforms/pseries/hotplug-memory.c +0 -42
60 lines not on this page · raw message
Signature · 1 line
2.25.4
PATCH 17/18 powerpc/pseries: remove dlpar_cpu_readd()
In reply to Nathan Lynchdlpar_cpu_readd() is unused now.
--- arch/powerpc/include/asm/topology.h | 1 - arch/powerpc/platforms/pseries/hotplug-cpu.c | 19 ------------------- 2 files changed, 20 deletions(-)
arch/powerpc/include/asm/topology.h +0 -1
@@ -115,7 +115,6 @@ int get_physical_package_id(int cpu);#define topology_core_cpumask (cpu) (per_cpu(cpu_core_map, cpu))#define topology_core_id (cpu) (cpu_to_core_id(cpu)) -int dlpar_cpu_readd (int cpu);#endif #endif
arch/powerpc/platforms/pseries/hotplug-cpu.c +0 -19
@@ -779,25 +779,6 @@ static int dlpar_cpu_add_by_count(u32 cpus_to_add)return rc; } -int dlpar_cpu_readd (int cpu) -{ -struct device_node *dn; -struct device *dev; -u32 drc_index; -int rc; - - dev =get_cpu_device (cpu); - dn = dev->of_node; - - rc =of_property_read_u32 (dn,"ibm,my-drc-index" , &drc_index); - - rc =dlpar_cpu_remove_by_index (drc_index); -if (!rc) - rc =dlpar_cpu_add (drc_index); - -return rc; -} -int dlpar_cpu (struct pseries_hp_errorlog *hp_elog) {u32 count, drc_index;
Signature · 1 line
2.25.4
PATCH 18/18 powerpc/pseries: remove obsolete memory hotplug DT notifier code
In reply to Nathan Lynchpseries_update_drconf_memory() runs from a DT notifier in response to an update to the ibm,dynamic-memory property of the /ibm,dynamic-reconfiguration-memory node. This property is an older less compact format than the ibm,dynamic-memory-v2 property used in most currently supported firmwares. There has never been an equivalent function for the v2 property.
pseries_update_drconf_memory() compares the 'assigned' flag for each LMB in the old vs new properties and adds or removes the block accordingly. However it appears to be of no actual utility:
* Partition suspension and PRRNs are specified only to change LMBs' NUMA affinity information. This notifier should be a no-op for those scenarios since the assigned flags should not change.
* The memory hotplug/DLPAR path has a hack which short-circuits execution of the notifier:
dlpar_memory()
...
rtas_hp_event = true;
drmem_update_dt()
of_update_property()
pseries_memory_notifier()
pseries_update_drconf_memory()
if (rtas_hp_event) return;So this code only makes sense as a relic of the time when more of the DLPAR workflow took place in user space. I don't see a purpose for it now.
--- .../platforms/pseries/hotplug-memory.c | 65 +------------------ 1 file changed, 1 insertion(+), 64 deletions(-)
arch/powerpc/platforms/pseries/hotplug-memory.c +1 -64
@@ -22,8 +22,6 @@#include <asm/drmem.h> #include "pseries.h" -static bool rtas_hp_event; -unsigned long pseries_memory_block_size (void ) {struct device_node *np;
@@ -871,11 +869,8 @@ int dlpar_memory(struct pseries_hp_errorlog *hp_elog)break ; } -if (!rc) { - rtas_hp_event = true; +if (!rc) rc =drmem_update_dt (); - rtas_hp_event = false; - }unlock_device_hotplug ();return rc;
@@ -911,60 +906,6 @@ static int pseries_add_mem_node(struct device_node *np)return (ret <0 ) ? -EINVAL :0 ; } -static int pseries_update_drconf_memory (struct of_reconfig_data *pr) -{ -struct of_drconf_cell_v1 *new_drmem, *old_drmem; -unsigned long memblock_size; -u32 entries; -__be32 *p; -int i, rc = -EINVAL ; - -if (rtas_hp_event) -return 0 ; - - memblock_size =pseries_memory_block_size (); -if (!memblock_size) -return -EINVAL ; - -if (!pr->old_prop) -return 0 ; - - p = (__be32 *) pr->old_prop->value; -if (!p) -return -EINVAL ; - -/* The first int of the property is the number of lmb's described -* by the property. This is followed by an array of of_drconf_cell -* entries. Get the number of entries and skip to the array of -* of_drconf_cell's. -*/ - entries =be32_to_cpu (*p++); - old_drmem = (struct of_drconf_cell_v1 *)p; - - p = (__be32 *)pr->prop->value; - p++; - new_drmem = (struct of_drconf_cell_v1 *)p; - -for (i =0 ; i < entries; i++) { -if ((be32_to_cpu (old_drmem[i].flags) &DRCONF_MEM_ASSIGNED ) && - (!(be32_to_cpu (new_drmem[i].flags) &DRCONF_MEM_ASSIGNED ))) { - rc =pseries_remove_memblock ( -be64_to_cpu (old_drmem[i].base_addr), - memblock_size); -break ; - }else if ((!(be32_to_cpu (old_drmem[i].flags) & -DRCONF_MEM_ASSIGNED )) && - (be32_to_cpu (new_drmem[i].flags) & -DRCONF_MEM_ASSIGNED )) { - rc =memblock_add (be64_to_cpu (old_drmem[i].base_addr), - memblock_size); - rc = (rc <0 ) ? -EINVAL :0 ; -break ; - } - } -return rc; -} -static int pseries_memory_notifier (struct notifier_block *nb,unsigned long action,void *data) {
@@ -978,10 +919,6 @@ static int pseries_memory_notifier(struct notifier_block *nb,case OF_RECONFIG_DETACH_NODE : err =pseries_remove_mem_node (rd->dn);break ; -case OF_RECONFIG_UPDATE_PROPERTY : -if (!strcmp (rd->prop->name,"ibm,dynamic-memory" )) - err =pseries_update_drconf_memory (rd); -break ; }return notifier_from_errno (err); }
Signature · 1 line
2.25.4
Michael Ellerman
AppliedQuoted 11 lines · Nathan Lynch
Two major parts to this series:
1. Removal of the extended cede offline mode for CPUs as well as the partition suspend code which accommodates it by temporarily onlining all CPUs prior to suspending the LPAR. This solves some accounting problems, simplifies the pseries CPU hotplug code, and greatly uncomplicates the existing partition suspend code, easing a much-needed transition to the Linux suspend framework. The two patches which make up this part have been posted before:
[...]
Applied to powerpc/next.
[01/18] powerpc/pseries: remove cede offline state for CPUs
https://git.kernel.org/powerpc/c/48f6e7f6d948b56489da027bc3284c709b939d28 [02/18] powerpc/rtas: don't online CPUs for partition suspend https://git.kernel.org/powerpc/c/ec2fc2a9e9bbad9023aab65bc472ce7a3ca8608f [03/18] powerpc/numa: remove ability to enable topology updates https://git.kernel.org/powerpc/c/c30f931e891eb0a32885ecd79984e1e7366fceda [04/18] powerpc/numa: remove unreachable topology update code https://git.kernel.org/powerpc/c/7d35bef96a46f7e9e167bb25258c0bd389aeab1b [05/18] powerpc/numa: make vphn_enabled, prrn_enabled flags const https://git.kernel.org/powerpc/c/e6eacf8eb4dee7bc7021c837666e3ebf1b0ec3b5 [06/18] powerpc/numa: remove unreachable topology timer code https://git.kernel.org/powerpc/c/50e0cf3742a01e72f4ea4a8fe9221b152e22871b [07/18] powerpc/numa: remove unreachable topology workqueue code https://git.kernel.org/powerpc/c/6325cb4a4ea8f4af8515b923650dd8f709694b44 [08/18] powerpc/numa: remove vphn_enabled and prrn_enabled internal flags https://git.kernel.org/powerpc/c/9fb8b5fd1bf782a8257506ad5198237f4124d556 [09/18] powerpc/numa: stub out numa_update_cpu_topology() https://git.kernel.org/powerpc/c/893ec6461f46c91487d914e6d467d2e804b9a883 [10/18] powerpc/numa: remove timed_topology_update() https://git.kernel.org/powerpc/c/b1815aeac7fde2dc3412daf2efaededd21cd58e0 [11/18] powerpc/numa: remove start/stop_topology_update() https://git.kernel.org/powerpc/c/1835303e5690cbeef2c07a9a5416045475ddaa13 [12/18] powerpc/rtasd: simplify handle_rtas_event(), emit message on events https://git.kernel.org/powerpc/c/91713ac377859893a7798999cb2e3a388d8ae710 [13/18] powerpc/numa: remove prrn_is_enabled() https://git.kernel.org/powerpc/c/042ef7cc43f4571d8cbe44a7c735ab6622809142 [14/18] powerpc/numa: remove arch_update_cpu_topology https://git.kernel.org/powerpc/c/cdf082c4570f186d608aca688f2cc872b014558a [15/18] powerpc/pseries: remove prrn special case from DT update path https://git.kernel.org/powerpc/c/bb7c3d36e3b18aa02d34358ae75e1b91f69a968b [16/18] powerpc/pseries: remove memory "re-add" implementation https://git.kernel.org/powerpc/c/4abe60c6448bf1dba48689450ad1348e5fc6f7b7 [17/18] powerpc/pseries: remove dlpar_cpu_readd() https://git.kernel.org/powerpc/c/38c392cef19019457ddcfb197ff3d9c5267698e6 [18/18] powerpc/pseries: remove obsolete memory hotplug DT notifier code https://git.kernel.org/powerpc/c/e978a3ccaa714b5ff125857d2cbecbb6fdf6c094
cheers