[RFC PATCH v3 2/3] powerpc: Only set numa node information for present cpus at boottime

Cyril Bur cyril.bur at au1.ibm.com
Thu Sep 4 13:53:04 EST 2014



On 03/09/14 13:02, Nishanth Aravamudan wrote:
> On 27.08.2014 [17:34:00 +0800], Li Zhong wrote:
>> As Nish suggested, it makes more sense to init the numa node informatiion
>> for present cpus at boottime, which could also avoid WARN_ON(1) in
>> numa_setup_cpu().
Hit this on a Power8 LPAR. With the patchset applied the warnings no 
longer present.
>>
>> With this change, we also need to change the smp_prepare_cpus() to set up
>> numa information only on present cpus.
>>
>> For those possible, but not present cpus, their numa information
>> will be set up after they are started, as the original code did before commit
>> 2fabf084b6ad.
>>
>> Cc: Nishanth Aravamudan <nacc at linux.vnet.ibm.com>
>> Cc: Nathan Fontenot <nfont at linux.vnet.ibm.com>
>> Signed-off-by: Li Zhong <zhong at linux.vnet.ibm.com>
>
> Acked-by: Nishanth Aravamudan <nacc at linux.vnet.ibm.com>

Tested-by: Cyril Bur <cyril.bur at au1.ibm.com>
>> ---
>>   arch/powerpc/kernel/smp.c | 10 ++++++++--
>>   arch/powerpc/mm/numa.c    |  2 +-
>>   2 files changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
>> index a0738af..dc0e774 100644
>> --- a/arch/powerpc/kernel/smp.c
>> +++ b/arch/powerpc/kernel/smp.c
>> @@ -379,8 +379,11 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
>>   		/*
>>   		 * numa_node_id() works after this.
>>   		 */
>> -		set_cpu_numa_node(cpu, numa_cpu_lookup_table[cpu]);
>> -		set_cpu_numa_mem(cpu, local_memory_node(numa_cpu_lookup_table[cpu]));
>> +		if (cpu_present(cpu)) {
>> +			set_cpu_numa_node(cpu, numa_cpu_lookup_table[cpu]);
>> +			set_cpu_numa_mem(cpu,
>> +				local_memory_node(numa_cpu_lookup_table[cpu]));
>> +		}
>>   	}
>>
>>   	cpumask_set_cpu(boot_cpuid, cpu_sibling_mask(boot_cpuid));
>> @@ -728,6 +731,9 @@ void start_secondary(void *unused)
>>   	}
>>   	traverse_core_siblings(cpu, true);
>>
>> +	set_numa_node(numa_cpu_lookup_table[cpu]);
>> +	set_numa_mem(local_memory_node(numa_cpu_lookup_table[cpu]));
>> +
>>   	smp_wmb();
>>   	notify_cpu_starting(cpu);
>>   	set_cpu_online(cpu, true);
>> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
>> index 9918c02..3a9061e 100644
>> --- a/arch/powerpc/mm/numa.c
>> +++ b/arch/powerpc/mm/numa.c
>> @@ -1127,7 +1127,7 @@ void __init do_init_bootmem(void)
>>   	 * even before we online them, so that we can use cpu_to_{node,mem}
>>   	 * early in boot, cf. smp_prepare_cpus().
>>   	 */
>> -	for_each_possible_cpu(cpu) {
>> +	for_each_present_cpu(cpu) {
>>   		numa_setup_cpu((unsigned long)cpu);
>>   	}
>>   }
>> --
>> 1.9.1
>>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



More information about the Linuxppc-dev mailing list