[PATCH v2] ARM: implement optimized percpu variable access

Russell King - ARM Linux linux at arm.linux.org.uk
Thu Nov 29 10:53:03 EST 2012


On Thu, Nov 29, 2012 at 10:45:50AM -0500, Nicolas Pitre wrote:
> On Thu, 29 Nov 2012, Rob Herring wrote:
> > Signed-off-by: Rob Herring <rob.herring at calxeda.com>
> > Acked-by: Will Deacon <will.deacon at arm.com>
> 
> With the above, and moving the call to cpu_init() after the call to 
> cpu_switch_mm(mm->pgd, mm) to fix Will's concerns (personally I'd put it 
> right after local_flush_tlb_all())... 

You're confused.  We were suggesting before the printk().

The reasoning is: printk() is not guaranteed not to access per-cpu
variables, so it needs to be before the first printk.  It can't be
before cpu_switch_mm(), and putting it before the TLB flush does
_not_ guarantee that TLB/MMU isn't going to still be seeing the
strongly-ordered attribute - so it _must_ be after the TLB flush.

As for the setup of the active MM, that's something that I still
think should come as early as possible (even before the per-cpu
stuff) because that is getting everything properly initialized and
setup for this new thread; there's a risk that a fault occuring
before that point may cause issues, specially if active_mm were NULL.

So, between cpumask_set_cpu() and printk() please.



More information about the linux-arm-kernel mailing list