Commit 297cf502 authored by Li Zhong's avatar Li Zhong Committed by Michael Ellerman

powerpc: some changes in numa_setup_cpu()

this patches changes some error handling logics in numa_setup_cpu(),
when cpu node is not found, so:

if the cpu is possible, but not present, -1 is kept in numa_cpu_lookup_table,
so later, if the cpu is added, we could set correct numa information for it.

if the cpu is present, then we set the first online node to
numa_cpu_lookup_table instead of 0 ( in case 0 might not be an online node? )

Cc: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: default avatarLi Zhong <zhong@linux.vnet.ibm.com>
Acked-by: default avatarNishanth Aravamudan <nacc@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent bc3c4327
...@@ -538,7 +538,7 @@ static int of_drconf_to_nid_single(struct of_drconf_cell *drmem, ...@@ -538,7 +538,7 @@ static int of_drconf_to_nid_single(struct of_drconf_cell *drmem,
*/ */
static int numa_setup_cpu(unsigned long lcpu) static int numa_setup_cpu(unsigned long lcpu)
{ {
int nid; int nid = -1;
struct device_node *cpu; struct device_node *cpu;
/* /*
...@@ -555,19 +555,21 @@ static int numa_setup_cpu(unsigned long lcpu) ...@@ -555,19 +555,21 @@ static int numa_setup_cpu(unsigned long lcpu)
if (!cpu) { if (!cpu) {
WARN_ON(1); WARN_ON(1);
nid = 0; if (cpu_present(lcpu))
goto out; goto out_present;
else
goto out;
} }
nid = of_node_to_nid_single(cpu); nid = of_node_to_nid_single(cpu);
out_present:
if (nid < 0 || !node_online(nid)) if (nid < 0 || !node_online(nid))
nid = first_online_node; nid = first_online_node;
out:
map_cpu_to_node(lcpu, nid);
map_cpu_to_node(lcpu, nid);
of_node_put(cpu); of_node_put(cpu);
out:
return nid; return nid;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment