[PATCH 1/1] powerpc/smp: Set numa node before updating mask

Nathan Lynch nathanl at linux.ibm.com
Wed Apr 7 22:19:10 AEST 2021


Sorry for the delay in following up here.

Srikar Dronamraju <srikar at linux.vnet.ibm.com> writes:
>> > -	set_numa_node(numa_cpu_lookup_table[cpu]);
>> > -	set_numa_mem(local_memory_node(numa_cpu_lookup_table[cpu]));
>> > -
>> 
>> Regardless of your change: at boot time, this set of calls to
>> set_numa_node() and set_numa_mem() is redundant, right? Because
>> smp_prepare_cpus() has:
>> 
>> 	for_each_possible_cpu(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]));
>> 		}
>> 
>> I would rather that, when onlining a CPU that happens to have been
>> dynamically added after boot, we enter start_secondary() with conditions
>> equivalent to those at boot time. Or as close to that as is practical.
>> 
>> So I'd suggest that pseries_add_processor() be made to update
>> these things when the CPUs are marked present, before onlining them.
>
> In pseries_add_processor, we are only marking the cpu as present. i.e
> I believe numa_setup_cpu() would not have been called. So we may not have a
> way to associate the CPU to the node. Otherwise we will have to call
> numa_setup_cpu() or the hcall_vphn.
>
> We could try calling numa_setup_cpu() immediately after we set the
> CPU to be present, but that would be one more extra hcall + I dont know if
> there are any more steps needed before CPU being made present and
> associating the CPU to the node.

An additional hcall in this path doesn't seem too expensive.

> Are we sure the node is already online?

I see that dlpar_online_cpu() calls find_and_online_cpu_nid(), so yes I
think that's covered.

> For the numa_mem, we are better of if the zonelists for the node are
> built.
>
> or the other solution would be to call this in map_cpu_to_node().
> Here also we have to be sure the zonelists for the node are already
> built.


More information about the Linuxppc-dev mailing list