powerpc/ftrace: Pass the correct stack pointer for DYNAMIC_FTRACE_WITH_REGS
authorNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Thu, 1 Jun 2017 10:48:16 +0000 (16:18 +0530)
committerpopcornmix <popcornmix@gmail.com>
Fri, 6 Oct 2017 12:06:50 +0000 (13:06 +0100)
commit0e8f09b18e2c54af1f5ffcabdd5b2232028cef33
tree1b86ee5f6ac70baa46e32f0a8b9100245677ddbd
parentba7d9a2b1246b56ebd3f28ba45bfac86ea8064e8
powerpc/ftrace: Pass the correct stack pointer for DYNAMIC_FTRACE_WITH_REGS

commit a4979a7e71eb8da976cbe4a0a1fa50636e76b04f upstream.

For DYNAMIC_FTRACE_WITH_REGS, we should be passing-in the original set
of registers in pt_regs, to capture the state _before_ ftrace_caller.
However, we are instead passing the stack pointer *after* allocating a
stack frame in ftrace_caller. Fix this by saving the proper value of r1
in pt_regs. Also, use SAVE_10GPRS() to simplify the code.

Fixes: 153086644fd1 ("powerpc/ftrace: Add support for -mprofile-kernel ftrace ABI")
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kernel/entry_64.S