tile: use a more conservative __my_cpu_offset in CONFIG_PREEMPT
authorChris Metcalf <cmetcalf@tilera.com>
Thu, 26 Sep 2013 17:24:53 +0000 (13:24 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Oct 2013 22:42:50 +0000 (15:42 -0700)
commit5df7085368ce132b9d93e5cff406df4684615419
treecd0c84cfb4c100710180bc1d8718aa8a4dc3a17f
parentb55ef2eddc365446b824aa9d457dd9daf4d4d4be
tile: use a more conservative __my_cpu_offset in CONFIG_PREEMPT

commit f862eefec0b68e099a9fa58d3761ffb10bad97e1 upstream.

It turns out the kernel relies on barrier() to force a reload of the
percpu offset value.  Since we can't easily modify the definition of
barrier() to include "tp" as an output register, we instead provide a
definition of __my_cpu_offset as extended assembly that includes a fake
stack read to hazard against barrier(), forcing gcc to know that it
must reread "tp" and recompute anything based on "tp" after a barrier.

This fixes observed hangs in the slub allocator when we are looping
on a percpu cmpxchg_double.

A similar fix for ARMv7 was made in June in change 509eb76ebf97.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/tile/include/asm/percpu.h