Subject: Re: Node 0 not necessary for powerpc?

From: Nishanth Aravamudan <[email-masked]>
Date: Tue, 10 Jun 2014 16:31:57 -0700

On 09.06.2014 [14:47:57 -0700], David Rientjes wrote:
> On Wed, 21 May 2014, Nishanth Aravamudan wrote:
> 
> > For context: I was looking at why N_ONLINE was statically setting Node 0
> > to be online, whether or not the topology is that way -- I've been
> > getting several bugs lately where Node 0 is online, but has no CPUs and
> > no memory on it, on powerpc. 
> > 
> > On powerpc, setup_per_cpu_areas calls into ___alloc_bootmem_node using
> > NODE_DATA(cpu_to_node(cpu)).
> > 
> > Currently, cpu_to_node() in arch/powerpc/include/asm/topology.h does:
> > 
> >         /*
> >          * During early boot, the numa-cpu lookup table might not have been
> >          * setup for all CPUs yet. In such cases, default to node 0.
> >          */
> >         return (nid < 0) ? 0 : nid;
> > 
> > And so early at boot, if node 0 is not present, we end up accessing an
> > unitialized NODE_DATA(). So this seems buggy (I'll contact the powerpc
> > deveopers separately on that).
> > 
> 
> I think what this really wants to do is NODE_DATA(cpu_to_mem(cpu)) and I 
> thought ppc had the cpu-to-local-memory-node mappings correct?

Except cpu_to_mem relies on the mapping being defined, but early in
boot, specifically, it isn't yet (at least not necessarily).

-Nish