Commit 6398eaa2 authored by Srikar Dronamraju's avatar Srikar Dronamraju Committed by Michael Ellerman
Browse files

powerpc/numa: Prefer node id queried from vphn



Node id queried from the static device tree may not
be correct. For example: it may always show 0 on a shared processor.
Hence prefer the node id queried from vphn and fallback on the device tree
based node id if vphn query fails.

Signed-off-by: default avatarSrikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200818081104.57888-3-srikar@linux.vnet.ibm.com
parent a874f100
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -728,20 +728,21 @@ static int __init parse_numa_properties(void)
	 */
	for_each_present_cpu(i) {
		struct device_node *cpu;
		int nid;

		cpu = of_get_cpu_node(i, NULL);
		BUG_ON(!cpu);
		nid = of_node_to_nid_single(cpu);
		of_node_put(cpu);
		int nid = vphn_get_nid(i);

		/*
		 * Don't fall back to default_nid yet -- we will plug
		 * cpus into nodes once the memory scan has discovered
		 * the topology.
		 */
		if (nid < 0)
			continue;
		if (nid == NUMA_NO_NODE) {
			cpu = of_get_cpu_node(i, NULL);
			BUG_ON(!cpu);
			nid = of_node_to_nid_single(cpu);
			of_node_put(cpu);
		}

		if (likely(nid > 0))
			node_set_online(nid);
	}