powerpc/smp: Use nid as fallback for package_id
PATCH v2 1/1 powerpc/smp: Use nid as fallback for package_id
Package_id is to find out all cores that are part of the same chip. On PowerNV machines, package_id defaults to chip_id. However ibm,chip_id property is not present in device-tree of PowerVM Lpars. Hence lscpu output shows one core per socket and multiple cores.
To overcome this, use nid as the package_id on PowerVM Lpars.
Before the patch.
---------------
Architecture: ppc64le Byte Order: Little Endian CPU(s): 128 On-line CPU(s) list: 0-127 Thread(s) per core: 8 Core(s) per socket: 1 <---------------------- Socket(s): 16 <---------------------- NUMA node(s): 2 Model: 2.2 (pvr 004e 0202) Model name: POWER9 (architected), altivec supported Hypervisor vendor: pHyp Virtualization type: para L1d cache: 32K L1i cache: 32K L2 cache: 512K L3 cache: 10240K NUMA node0 CPU(s): 0-63 NUMA node1 CPU(s): 64-127 # # cat /sys/devices/system/cpu/cpu0/topology/physical_package_id -1 #
After the patch
---------------
Architecture: ppc64le Byte Order: Little Endian CPU(s): 128 On-line CPU(s) list: 0-127 Thread(s) per core: 8 <------------------------------ Core(s) per socket: 8 <------------------------------ Socket(s): 2 NUMA node(s): 2 Model: 2.2 (pvr 004e 0202) Model name: POWER9 (architected), altivec supported Hypervisor vendor: pHyp Virtualization type: para L1d cache: 32K L1i cache: 32K L2 cache: 512K L3 cache: 10240K NUMA node0 CPU(s): 0-63 NUMA node1 CPU(s): 64-127 # # cat /sys/devices/system/cpu/cpu0/topology/physical_package_id 0 # Now lscpu output is more in line with the system configuration.
Link to previous posting: https://patchwork.ozlabs.org/patch/1126145
---
Changelog from v1:
In V1 cpu_to_chip_id was overloaded to fallback on nid. Michael Ellerman wasn't comfortable with nid being shown up as chip_id.
arch/powerpc/include/asm/topology.h | 3 +- arch/powerpc/kernel/smp.c | 46 +++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 4 deletions(-)
arch/powerpc/include/asm/topology.h +2 -1
@@ -134,7 +134,8 @@ static inline void shared_proc_topology_init(void) {}#ifdef CONFIG_PPC64 #include <asm/smp.h> -#define topology_physical_package_id (cpu) (cpu_to_chip_id(cpu)) +extern int get_physical_package_id (int ); +#define topology_physical_package_id (cpu) (get_physical_package_id(cpu))#define topology_sibling_cpumask (cpu) (per_cpu(cpu_sibling_map, cpu))#define topology_core_cpumask (cpu) (per_cpu(cpu_core_map, cpu))#define topology_core_id (cpu) (cpu_to_core_id(cpu))
arch/powerpc/kernel/smp.c +43 -3
64 lines not on this page · raw message
Signature · 1 line
2.17.1
Hey Michael,
Quoted 5 lines · Srikar Dronamraju
Package_idis to find out all cores that are part of the same chip. On PowerNV machines,package_iddefaults tochip_id. However ibm,chip_id property is not present in device-tree of PowerVM Lpars. Hence lscpu output shows one core per socket and multiple cores.
Can you let me know if you have any comments on this patch?
Signature · 2 lines
Thanks and Regards Srikar Dronamraju