]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/ftrace: Separate the heuristics for checking call sites
authorMichael Ellerman <mpe@ellerman.id.au>
Tue, 19 Jul 2016 04:48:30 +0000 (14:48 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 21 Jul 2016 10:10:37 +0000 (20:10 +1000)
commit90b6496d9513039d4006e787efb5387ba370a928
tree321f23e7a84c48b008f5996238d67e6db1dc07fd
parent1cee4230b07fac96206a0755b2d13c9869738797
powerpc/ftrace: Separate the heuristics for checking call sites

In __ftrace_make_nop() (the 64-bit version), we have code to deal with
two ftrace ABIs. There is the original ABI, which looks mostly like a
function call, and then the mprofile-kernel ABI which is just a branch.

The code tries to handle both cases, by looking for the presence of a
load to restore the TOC pointer (PPC_INST_LD_TOC). If we detect the TOC
load, we assume the call site is for an mcount() call using the old ABI.
That means we patch the mcount() call with a b +8, to branch over the
TOC load.

However if the kernel was built with mprofile-kernel, then there will
never be a call site using the original ftrace ABI. If for some reason
we do see a TOC load, then it's there for a good reason, and we should
not jump over it.

So split the code, using the existing CC_USING_MPROFILE_KERNEL. Kernels
built with mprofile-kernel will only look for, and expect, the new ABI,
and similarly for the original ABI.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/ftrace.c