]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc: Work around gcc bug in current_thread_info()
authorMichael Ellerman <mpe@ellerman.id.au>
Thu, 8 Jan 2015 04:30:08 +0000 (15:30 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 12 Jan 2015 05:40:02 +0000 (16:40 +1100)
commit6dcd8baed7bfef40ea193af06fb3757161181207
treef6ff82304f0c2b8d2c1e91ba39096f72559d4dfe
parentf949556ae1d25d4d7b018d3398ec92094f78fed1
powerpc: Work around gcc bug in current_thread_info()

In commit 4db7f98a3e5d "powerpc: Don't use local named register variable
in current_thread_info" Anton changed the way we did current_thread_info()
to accommodate LLVM, and it was not meant to have any effect elsewhere.

Unfortunately it has exposed a gcc bug, where r1 gets copied into
another register and then gcc uses that register to restore the toc
after a function call, even when that register is volatile and has been
clobbered by the function call.

We could revert Anton's patch, but it's not clear the original code is
safe either, we may just have been lucky.

The cleanest solution is to just use the existing CURRENT_THREAD_INFO()
asm macro, and call it using inline asm.

Segher points out we don't need volatile on the asm, if the result of
the shift is unused it's fine for the compiler to elide it.

Fixes: 4db7f98a3e5d ("powerpc: Don't use local named register variable in current_thread_info")
Reported-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/thread_info.h