[PATCH] ARM: implement optimized percpu variable access

Will Deacon will.deacon at arm.com
Mon Nov 12 08:28:12 EST 2012


On Mon, Nov 12, 2012 at 01:03:12PM +0000, Rob Herring wrote:
> On 11/12/2012 04:23 AM, Will Deacon wrote:
> >> +static inline void set_my_cpu_offset(unsigned long off)
> >> +{
> >> +	asm volatile("mcr p15, 0, %0, c13, c0, 4	@ set TPIDRPRW" : : "r" (off) : "cc" );
> >> +}
> > 
> > You don't need the "cc" here.
> 
> You would think so, but the compiler drops this instruction if you
> don't. set_cr does the same thing.

Whoa, that sounds suspicious... if the thing is marked volatile GCC
shouldn't optimise it away if it's reachable. Which toolchain are you
using?

Will




More information about the linux-arm-kernel mailing list