Subject: Re: [PATCH 00/14] numa aware allocation for pacas, stacks, pagetables

From: Nicholas Piggin <[email-masked]>
Date: Thu, 29 Mar 2018 22:04:56 +1000

On Thu, 29 Mar 2018 17:18:12 +1100
Michael Ellerman <[email-masked]> wrote:

> Nicholas Piggin <[email-masked]> writes:
> > On Wed, 07 Mar 2018 21:50:04 +1100
> > Michael Ellerman <[email-masked]> wrote:  
> >> Nicholas Piggin <[email-masked]> writes:  
> >> > This series allows numa aware allocations for various early data
> >> > structures for radix. Hash still has a bolted SLB limitation that
> >> > prevents at least pacas and stacks from node-affine allocations.
> >> >
> >> > Fixed up a number of bugs, got pSeries working, added a couple more
> >> > cases where page tables can be allocated node-local.    
> >> 
> >> Few problems in here:
> >> 
> >> FAILURE kernel-build-linux » powerpc,gcc_ubuntu_be,pmac32
> >>   arch/powerpc/kernel/prom.c:748:2: error: implicit declaration of function 'allocate_paca_ptrs' [-Werror=implicit-function-declaration]
> >> 
> >> FAILURE kernel-build-linux » powerpc,gcc_ubuntu_le,powernv
> >>   arch/powerpc/include/asm/paca.h:49:33: error: 'struct paca_struct' has no member named 'lppaca_ptr'
> >>   arch/powerpc/include/asm/paca.h:49:33: error: 'struct paca_struct' has no member named 'lppaca_ptr'
> >> 
> >> Did I miss a follow-up or something?  
> >
> > Here's a patch that applies to "powerpc/64: defer paca allocation
> > until memory topology is discovered". The first hunk fixes the ppc32
> > issue, and the second hunk avoids freeing the cpu_to_phys_id array
> > if the platform didn't allocate it. But I've just realized that
> > should go into the previous patch (which is missing the
> > memblock_free).
> > --  
> ...
> > diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
> > index 56f7a2b793e0..2ba05acc2973 100644
> > --- a/arch/powerpc/kernel/setup-common.c
> > +++ b/arch/powerpc/kernel/setup-common.c
> > @@ -854,8 +854,10 @@ static void smp_setup_pacas(void)
> >  		set_hard_smp_processor_id(cpu, cpu_to_phys_id[cpu]);
> >  	}
> >  
> > -	memblock_free(__pa(cpu_to_phys_id), nr_cpu_ids * sizeof(u32));
> > -	cpu_to_phys_id = NULL;
> > +	if (cpu_to_phys_id) {
> > +		memblock_free(__pa(cpu_to_phys_id), nr_cpu_ids * sizeof(u32));
> > +		cpu_to_phys_id = NULL;
> > +	}
> >  }
> >  #endif  
>  
> Where did you want that?

Patch 8 should have

	if (cpu_to_phys_id) {
		memblock_free(__pa(cpu_to_phys_id), nr_cpu_ids * sizeof(u32));
		cpu_to_phys_id = NULL;
	}

Right after its ight after the set_hard_smp_processor_id() loop. Patch 9
moves it all to smp_setup_pacas plus the allocate_paca() call in the loop.

I think that makes sense.

Thanks for fixing it all up, had a few rough edges.