Commit 82fc9677 authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] ppc64: Fix for cpu hotplug + NUMA

It was possible to hotplug add a new cpu that was larger than numnode.
This meant we had a cpu with a node id that didnt have any NODE_DATA()
backing it.

The following patch catches this in numa_setup_cpu and forces the node to
0.  We also make a pass through all cpus at boot to look for the maximum
node id - this catches the case at boot.  As for hotplug, since the node
doesnt have any memory backing it (otherwise the node would have been
onlined) then we can assume the machine isnt configured for performance and
just force the cpu into node 0.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 39c04aeb
......@@ -216,7 +216,7 @@ static int numa_setup_cpu(unsigned long lcpu)
numa_domain = of_node_numa_domain(cpu);
if (numa_domain >= MAX_NUMNODES) {
if (numa_domain >= numnodes) {
/*
* POWER4 LPAR uses 0xffff as invalid node,
* dont warn in this case.
......@@ -265,6 +265,7 @@ static int cpu_numa_callback(struct notifier_block *nfb,
static int __init parse_numa_properties(void)
{
struct device_node *cpu = NULL;
struct device_node *memory = NULL;
int max_domain = 0;
long entries = lmb_end_of_DRAM() >> MEMORY_INCREMENT_SHIFT;
......@@ -290,6 +291,28 @@ static int __init parse_numa_properties(void)
max_domain = numa_setup_cpu(boot_cpuid);
/*
* Even though we connect cpus to numa domains later in SMP init,
* we need to know the maximum node id now. This is because each
* node id must have NODE_DATA etc backing it.
* As a result of hotplug we could still have cpus appear later on
* with larger node ids. In that case we force the cpu into node 0.
*/
for_each_cpu(i) {
int numa_domain;
cpu = find_cpu_node(i);
if (cpu) {
numa_domain = of_node_numa_domain(cpu);
of_node_put(cpu);
if (numa_domain < MAX_NUMNODES &&
max_domain < numa_domain)
max_domain = numa_domain;
}
}
memory = NULL;
while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
unsigned long start;
......
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