[PATCH 1/1] arch/powerpc: Rework local_paca to avoid LTO warnings

Alastair D'Silva alastair at au1.ibm.com
Thu Mar 14 14:09:22 AEDT 2019


On Thu, 2019-03-14 at 10:54 +1100, Daniel Axtens wrote:
> "Alastair D'Silva" <alastair at au1.ibm.com> writes:
> 
> > From: Alastair D'Silva <alastair at d-silva.org>
> > 
> > When building an LTO kernel, the existing code generates warnings:
> >     ./arch/powerpc/include/asm/paca.h:37:30: warning: register of
> >         ‘local_paca’ used for multiple global register variables
> >      register struct paca_struct *local_paca asm("r13");
> >                               ^
> >     ./arch/powerpc/include/asm/paca.h:37:30: note: conflicts with
> >         ‘local_paca’
> > 
> > This patch reworks local_paca into an inline getter & setter
> > function,
> > which addresses the warning.
> > 
> > Generated ASM from this patch is broadly similar (addresses have
> > changed and the compiler uses different GPRs in some places).
> 
> Ditto to Christophe's comment; I'd love to know how to build this so
> I
> can actually see the differences. Perhaps you could bundle up all the
> required changes and send it as a patch series with a cover letter
> explaining this?

The differences are visible in a normal build, but if you want to play
with LTO, see my comments to Christophe.

> 
> > +static inline struct paca_struct *get_paca_no_preempt_check(void)
> > +{
> > +	register struct paca_struct *paca asm("r13");
> > +	return paca;
> > +}
> 
> Isn't the convention to have the { on the same line as the function,
> or
> am I horrible mis-remembering things?
> 
You are :)

> Should these functions be __always_inline?
> 

Yes, they should, I'll add that to V3.

-- 
Alastair D'Silva
Open Source Developer
Linux Technology Centre, IBM Australia
mob: 0423 762 819



More information about the Linuxppc-dev mailing list