powerpc: Add support for Virtual Processor Home Node (VPHN)
PATCH 1/1 powerpc: Add support for Virtual Processor Home Node (VPHN)
From: Jesse Larrew <[email protected]>
The SPLPAR option allows the platform to dispatch virtual processors on physical processors that, due to the variable nature of work loads, are temporarily free, thus improving the utilization of computing resources. However, SPLPAR implies inconsistent mapping of virtual to physical processors, thus defeating resource allocation software that attempts to optimize performance on platforms that implement the NUMA option.
To bridge the gap between these two options, the VPHN option maintain a substantially consistent mapping of a given virtual processor to a physical processor or set of processors within a given associativity domain. When allocating computing resources, the kernel can take advantage of this statistically consistent mapping to improve processing performance.
VPHN mappings are substantially consistent but not static. For any given dispatch cycle, a best effort is made by the hypervisor to dispatch the virtual processor on a physical processor within a targeted associativity domain (the virtual processor's home node). However, if processing capacity within the home node is not available, some other physical processor is assigned to meet the processing capacity entitlement. From time to time, to optimize the total platform performance, it may be necessary for the platform to change the home node of a given virtual processor.
The Virtual Processor Home Node feature addresses this by adding the H_HOME_NODE_ASSOCIATIVITY hcall to retrieve the current associativity domain information directly from the hypervisor for a given virtual processor's home node. It also exposes a set of associativity change counters in the Virtual Processor Area (VPA) of each processor to indicate when associativity changes occur.
This patch sets a timer during boot that will periodically poll the associativity change counters. When a change in associativity is detected, it retrieves the new associativity domain information via the H_HOME_NODE_ASSOCIATIVITY hcall and updates the NUMA node maps and sysfs entries accordingly. The polling mechanism is also tied into the ibm,suspend-me rtas call to stop/restart polling before/after a suspend, hibernate, migrate, or checkpoint restart operation.
--- arch/powerpc/include/asm/firmware.h | 3 +- arch/powerpc/include/asm/hvcall.h | 3 +- arch/powerpc/include/asm/lppaca.h | 5 +- arch/powerpc/include/asm/topology.h | 6 +- arch/powerpc/kernel/rtas.c | 15 ++ arch/powerpc/mm/numa.c | 274 +++++++++++++++++++++++++++- arch/powerpc/platforms/pseries/firmware.c | 1 + 7 files changed, 293 insertions(+), 14 deletions(-)
arch/powerpc/include/asm/firmware.h +2 -1
@@ -46,6 +46,7 @@#define FW_FEATURE_PS3_LV1 ASM_CONST(0x0000000000800000)#define FW_FEATURE_BEAT ASM_CONST(0x0000000001000000)#define FW_FEATURE_CMO ASM_CONST(0x0000000002000000) +#define FW_FEATURE_VPHN ASM_CONST(0x0000000004000000)#ifndef __ASSEMBLY__
@@ -59,7 +60,7 @@ enum {FW_FEATURE_VIO |FW_FEATURE_RDMA |FW_FEATURE_LLAN |FW_FEATURE_BULK_REMOVE |FW_FEATURE_XDABR |FW_FEATURE_MULTITCE |FW_FEATURE_SPLPAR |FW_FEATURE_LPAR | -FW_FEATURE_CMO , +FW_FEATURE_CMO |FW_FEATURE_VPHN ,FW_FEATURE_PSERIES_ALWAYS =0 ,FW_FEATURE_ISERIES_POSSIBLE =FW_FEATURE_ISERIES |FW_FEATURE_LPAR , FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
arch/powerpc/include/asm/hvcall.h +2 -1
@@ -232,7 +232,8 @@#define H_GET_EM_PARMS 0x2B8#define H_SET_MPP 0x2D0#define H_GET_MPP 0x2D4 -#define MAX_HCALL_OPCODE H_GET_MPP +#define H_HOME_NODE_ASSOCIATIVITY 0x2EC +#define MAX_HCALL_OPCODE H_HOME_NODE_ASSOCIATIVITY#ifndef __ASSEMBLY__
arch/powerpc/include/asm/lppaca.h +4 -1
@@ -62,7 +62,10 @@ struct lppaca {volatile u32 dyn_pir;// Dynamic ProcIdReg value x20-x23 u32 dsei_data;// DSEI data x24-x27 u64 sprg3;// SPRG3 value x28-x2F -u8 reserved3[80 ];// Reserved x30-x7F +u8 reserved3[40 ];// Reserved x30-x57 +volatile u8 vphn_assoc_counts[8 ];// Virtual processor home node +// associativity change counters x58-x5F +u8 reserved4[32 ];// Reserved x60-x7F //============================================================================= // CACHE_LINE_2 0x0080 - 0x00FF Contains local read-write data
arch/powerpc/include/asm/topology.h +5 -1
@@ -49,7 +49,7 @@ static inline int pcibus_to_node(struct pci_bus *bus) {return -1 ; } -#endif +#endif /* CONFIG_PCI */ #define cpumask_of_pcibus (bus) (pcibus_to_node(bus) == -1 ? \ cpu_all_mask : \
@@ -93,6 +93,8 @@ extern void __init dump_numa_cpu_topology(void);extern int sysfs_add_device_to_node (struct sys_device *dev,int nid);extern void sysfs_remove_device_from_node (struct sys_device *dev,int nid); +extern int __init init_topology_update (void ); +extern int stop_topology_update (void );#else static inline void dump_numa_cpu_topology (void ) {}
@@ -107,6 +109,8 @@ static inline void sysfs_remove_device_from_node(struct sys_device *dev, { } +static int __init init_topology_update (void ) {} +static int stop_topology_update (void ) {}#endif /* CONFIG_NUMA */ #include <asm-generic/topology.h>
arch/powerpc/kernel/rtas.c +15 -0
@@ -41,6 +41,7 @@#include <asm/atomic.h> #include <asm/time.h> #include <asm/mmu.h> +#include <asm/topology.h> struct rtas_t rtas = { .lock = __ARCH_SPIN_LOCK_UNLOCKED
@@ -706,6 +707,18 @@ void rtas_os_term(char *str)static int ibm_suspend_me_token =RTAS_UNKNOWN_SERVICE ;#ifdef CONFIG_PPC_PSERIES +static void pre_suspend_work (void ) +{ +stop_topology_update (); +return ; +} + +static void post_suspend_work (void ) +{ +init_topology_update (); +return ; +} +static int __rtas_suspend_last_cpu (struct rtas_suspend_me_data *data,int wake_when_done) {u16 slb_size = mmu_slb_size;
@@ -713,6 +726,7 @@ static int __rtas_suspend_last_cpu(struct rtas_suspend_me_data *data, int wake_wint cpu;slb_set_size (SLB_MIN_SIZE ); +pre_suspend_work ();printk (KERN_DEBUG "calling ibm,suspend-me on cpu %i\n" ,smp_processor_id ()); while (rc == H_MULTI_THREADS_ACTIVE && !atomic_read(&data->done) &&
@@ -728,6 +742,7 @@ static int __rtas_suspend_last_cpu(struct rtas_suspend_me_data *data, int wake_w rc =atomic_read (&data->error);atomic_set (&data->error, rc); +post_suspend_work ();if (wake_when_done) {atomic_set (&data->done,1 );
arch/powerpc/mm/numa.c +264 -10
309 lines not on this page · raw message
arch/powerpc/platforms/pseries/firmware.c +1 -0
@@ -55,6 +55,7 @@ firmware_features_table[FIRMWARE_MAX_FEATURES] = { {FW_FEATURE_XDABR, "hcall-xdabr"}, {FW_FEATURE_MULTITCE, "hcall-multi-tce"}, {FW_FEATURE_SPLPAR, "hcall-splpar"}, + {FW_FEATURE_VPHN, "hcall-vphn"}, };/* Build up the firmware features bitmask using the contents of
Signature · 1 line
1.7.2.3