[PATCH] powerpc/numa: Fix topology_physical_package_id() on pSeries

Cédric Le Goater clg at kaod.org
Tue Mar 16 23:28:16 AEDT 2021


On 3/16/21 12:28 PM, Srikar Dronamraju wrote:
> * C?dric Le Goater <clg at kaod.org> [2021-03-12 15:31:54]:
> 
>> Initial commit 15863ff3b8da ("powerpc: Make chip-id information
>> available to userspace") introduce a cpu_to_chip_id() routine for the
>> PowerNV platform using the "ibm,chip-id" property to query the chip id
>> of a CPU. But PAPR does not specify such a property and the node id
>> query is broken.
>>
>> Use cpu_to_node() instead which guarantees to have a correct value on
>> all platforms, PowerNV an pSeries.
>>
>> Cc: Nathan Lynch <nathanl at linux.ibm.com>
>> Cc: Srikar Dronamraju <srikar at linux.vnet.ibm.com>
>> Cc: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
>> Signed-off-by: Cédric Le Goater <clg at kaod.org>
>> ---
>>  arch/powerpc/include/asm/topology.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
> 
> (Sorry I somehow managed to mangle to-address. Hence resending this mail
> again)
> 
> While this looks good to me, @mpe had reservations on using nid as chip-id.
> https://lore.kernel.org/linuxppc-dev/87lfwhypv0.fsf@concordia.ellerman.id.au/t/#u

that was a different approach.

> He may be okay with using nid as a "virtual" package id in a pseries
> environment.

ibm,chip-id is only used in a couple of places in low level PowerNV
drivers. The CPU doesn't use this property. We should be fine on
all platforms.

> Reviewed-by: Srikar Dronamraju <srikar at linux.vnet.ibm.com>

Thanks,

C.
 
> [---=| TOFU protection by t-prot: 24 lines snipped |=---]
> 
> --
> Thanks and Regards
> Srikar Dronamraju
> 
> 
>> diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
>> index 3beeb030cd78..887c42a4e43d 100644
>> --- a/arch/powerpc/include/asm/topology.h
>> +++ b/arch/powerpc/include/asm/topology.h
>> @@ -123,7 +123,7 @@ static inline int cpu_to_coregroup_id(int cpu)
>>  #ifdef CONFIG_PPC64
>>  #include <asm/smp.h>
>>
>> -#define topology_physical_package_id(cpu)	(cpu_to_chip_id(cpu))
>> +#define topology_physical_package_id(cpu)	(cpu_to_node(cpu))
>>
>>  #define topology_sibling_cpumask(cpu)	(per_cpu(cpu_sibling_map, cpu))
>>  #define topology_core_cpumask(cpu)	(cpu_cpu_mask(cpu))
>> --
>> 2.26.2
>>
> 
> --
> Thanks and Regards
> Srikar Dronamraju
> 



More information about the Linuxppc-dev mailing list