Commit 0bffbb55 authored by Matthias Schiffer's avatar Matthias Schiffer Committed by Stefan Bader

mips: ftrace: fix static function graph tracing

BugLink: https://bugs.launchpad.net/bugs/1784382

commit 6fb86566 upstream.

ftrace_graph_caller was never run after calling ftrace_trace_function,
breaking the function graph tracer. Fix this, bringing it in line with the
x86 implementation.

While we're at it, also streamline the control flow of _mcount a bit to
reduce the number of branches.

This issue was reported before:
https://www.linux-mips.org/archives/linux-mips/2014-11/msg00295.htmlSigned-off-by: default avatarMatthias Schiffer <mschiffer@universe-factory.net>
Tested-by: default avatarMatt Redfearn <matt.redfearn@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/18929/Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
Cc: stable@vger.kernel.org # v3.17+
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 56d67c08
...@@ -116,10 +116,20 @@ ftrace_stub: ...@@ -116,10 +116,20 @@ ftrace_stub:
NESTED(_mcount, PT_SIZE, ra) NESTED(_mcount, PT_SIZE, ra)
PTR_LA t1, ftrace_stub PTR_LA t1, ftrace_stub
PTR_L t2, ftrace_trace_function /* Prepare t2 for (1) */ PTR_L t2, ftrace_trace_function /* Prepare t2 for (1) */
bne t1, t2, static_trace beq t1, t2, fgraph_trace
nop nop
MCOUNT_SAVE_REGS
move a0, ra /* arg1: self return address */
jalr t2 /* (1) call *ftrace_trace_function */
move a1, AT /* arg2: parent's return address */
MCOUNT_RESTORE_REGS
fgraph_trace:
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
PTR_LA t1, ftrace_stub
PTR_L t3, ftrace_graph_return PTR_L t3, ftrace_graph_return
bne t1, t3, ftrace_graph_caller bne t1, t3, ftrace_graph_caller
nop nop
...@@ -128,24 +138,11 @@ NESTED(_mcount, PT_SIZE, ra) ...@@ -128,24 +138,11 @@ NESTED(_mcount, PT_SIZE, ra)
bne t1, t3, ftrace_graph_caller bne t1, t3, ftrace_graph_caller
nop nop
#endif #endif
b ftrace_stub
#ifdef CONFIG_32BIT
addiu sp, sp, 8
#else
nop
#endif
static_trace:
MCOUNT_SAVE_REGS
move a0, ra /* arg1: self return address */
jalr t2 /* (1) call *ftrace_trace_function */
move a1, AT /* arg2: parent's return address */
MCOUNT_RESTORE_REGS
#ifdef CONFIG_32BIT #ifdef CONFIG_32BIT
addiu sp, sp, 8 addiu sp, sp, 8
#endif #endif
.globl ftrace_stub .globl ftrace_stub
ftrace_stub: ftrace_stub:
RETURN_BACK RETURN_BACK
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment