]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc: Avoid link stack corruption for MMU on exceptions
authorMichael Neuling <mikey@neuling.org>
Tue, 13 Aug 2013 05:54:52 +0000 (15:54 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 14 Aug 2013 05:33:18 +0000 (15:33 +1000)
commitcd9df41d03ddaaf832aae8d2cc212391a6d02134
treeff42417bf9a51e94058fce8aa2aa2339415d5d43
parent9c7824a550d7a3403f18f47599a43fac3f5be709
powerpc: Avoid link stack corruption for MMU on exceptions

When we have MMU on exceptions (POWER8) and a relocatable kernel, we
need to branch from the initial exception vectors at 0x0 to up high
where the kernel might be located.  Currently we do this using the link
register.

Unfortunately this corrupts the link stack and instead we should use the
count register.  We did this for the syscall entry path in:
  b14f24b powerpc: Avoid link stack corruption in MMU on syscall entry path
but I stupidly forgot to do the same for other exceptions.

This patch changes the initial exception vectors to use the count
register instead of the link register when we need to branch up to the
relocated kernel.

I have a dodgy userspace test which loops calling a function that reads
the PVR (mfpvr in userspace will be emulated by the kernel via the
program check exception).  On POWER8 and with CONFIG_RELOCATABLE=y, I
get a ~10% performance improvement with my userspace test with this
patch.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/exception-64s.h
arch/powerpc/include/asm/paca.h