linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] function:stacktrace/mips: Fix function:stacktrace for mips
@ 2020-05-28 12:36 YuanJunQing
  2020-05-29  9:29 ` yuanjunqing
  0 siblings, 1 reply; 5+ messages in thread
From: YuanJunQing @ 2020-05-28 12:36 UTC (permalink / raw)
  To: tsbogend
  Cc: paulburton, chenhc, linux-mips, linux-kernel, liulichao,
	YuanJunQing

ftrace_call as global symbol in ftrace_caller(), this
will cause function:stacktrace can not work well.
i.e. echo do_IRQ:stacktrace > set_ftrace_filte

Signed-off-by: YuanJunQing <yuanjunqing66@163.com>
---
 arch/mips/kernel/mcount.S | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index cff52b283e03..cd5545764e5f 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -87,8 +87,15 @@ EXPORT_SYMBOL(_mcount)
 	PTR_LA   t1, _etext
 	sltu     t3, t1, a0	/* t3 = (a0 > _etext) */
 	or       t1, t2, t3
+	PTR_LA	 t2, stlab-4 	/* t2: "function:stacktrace" return address */
+	move	 a1, AT		/* arg2: parent's return address */
 	beqz     t1, ftrace_call
-	 nop
+	 nop			/* "function:stacktrace" return address */
+stlab:
+	PTR_LA	t2, stlab-4
+	/* ftrace_call_end: ftrace_call return address */
+	beq	t2,ra, ftrace_call_end
+	nop
 #if defined(KBUILD_MCOUNT_RA_ADDRESS) && defined(CONFIG_32BIT)
 	PTR_SUBU a0, a0, 16	/* arg1: adjust to module's recorded callsite */
 #else
@@ -98,7 +105,9 @@ EXPORT_SYMBOL(_mcount)
 	.globl ftrace_call
 ftrace_call:
 	nop	/* a placeholder for the call to a real tracing function */
-	 move	a1, AT		/* arg2: parent's return address */
+	move	ra, t2		/* t2: "function:stacktrace" return address */
+
+ftrace_call_end:
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 	.globl ftrace_graph_call
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-04  3:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-28 12:36 [PATCH] function:stacktrace/mips: Fix function:stacktrace for mips YuanJunQing
2020-05-29  9:29 ` yuanjunqing
2020-05-29  9:41   ` WANG Xuerui
2020-06-04  1:17     ` Maciej W. Rozycki
2020-06-04  3:25       ` yuanjunqing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).