From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Shaohua Li <shaohua.li@intel.com>,
ia64 <linux-ia64@vger.kernel.org>,
Tony Luck <tony.luck@intel.com>, Sam Ravnborg <sam@ravnborg.org>,
u.kleine-koenig@pengutronix.de,
Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 5/9] ftrace, ia64: IA64 static ftrace support
Date: Tue, 13 Jan 2009 01:11:15 -0500 [thread overview]
Message-ID: <20090113061147.944289231@goodmis.org> (raw)
In-Reply-To: 20090113061110.856268617@goodmis.org
[-- Attachment #1: 0005-ftrace-ia64-IA64-static-ftrace-support.patch --]
[-- Type: text/plain, Size: 3248 bytes --]
From: Shaohua Li <shaohua.li@intel.com>
IA64 ftrace suppport. In IA64, below code will be added in each function
if -pg is enabled.
alloc r40=ar.pfs,12,8,0
mov r43=r0;;
mov r42=b0
mov r41=r1
nop.i 0x0
br.call.sptk.many b0 = _mcount;;
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
arch/ia64/Kconfig | 1 +
arch/ia64/include/asm/ftrace.h | 15 ++++++++++++
arch/ia64/kernel/entry.S | 49 ++++++++++++++++++++++++++++++++++++++++
arch/ia64/kernel/ia64_ksyms.c | 6 +++++
4 files changed, 71 insertions(+), 0 deletions(-)
create mode 100644 arch/ia64/include/asm/ftrace.h
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 3d31636..b992ba4 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -21,6 +21,7 @@ config IA64
select HAVE_OPROFILE
select HAVE_KPROBES
select HAVE_KRETPROBES
+ select HAVE_FUNCTION_TRACER
select HAVE_DMA_ATTRS
select HAVE_KVM
select HAVE_ARCH_TRACEHOOK
diff --git a/arch/ia64/include/asm/ftrace.h b/arch/ia64/include/asm/ftrace.h
new file mode 100644
index 0000000..48694b3
--- /dev/null
+++ b/arch/ia64/include/asm/ftrace.h
@@ -0,0 +1,15 @@
+#ifndef _ASM_IA64_FTRACE_H
+#define _ASM_IA64_FTRACE_H
+
+#ifdef CONFIG_FUNCTION_TRACER
+#define MCOUNT_INSN_SIZE 32 /* sizeof mcount call */
+
+#ifndef __ASSEMBLY__
+extern void _mcount(unsigned long pfs, unsigned long r1, unsigned long b0, unsigned long r0);
+#define mcount _mcount
+
+#endif
+
+#endif /* CONFIG_FUNCTION_TRACER */
+
+#endif /* _ASM_IA64_FTRACE_H */
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index d435f4a..c2f7d79 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -47,6 +47,7 @@
#include <asm/processor.h>
#include <asm/thread_info.h>
#include <asm/unistd.h>
+#include <asm/ftrace.h>
#include "minstate.h"
@@ -1404,6 +1405,54 @@ GLOBAL_ENTRY(unw_init_running)
br.ret.sptk.many rp
END(unw_init_running)
+#ifdef CONFIG_FUNCTION_TRACER
+GLOBAL_ENTRY(_mcount)
+ movl r2 = ftrace_stub
+ movl r3 = ftrace_trace_function;;
+ ld8 r3 = [r3];;
+ ld8 r3 = [r3];;
+ cmp.eq p7,p0 = r2, r3
+(p7) br.sptk.many ftrace_stub
+ ;;
+
+ alloc loc0 = ar.pfs, 4, 4, 2, 0
+ ;;
+ mov loc1 = b0
+ mov out0 = b0
+ mov loc2 = r8
+ mov loc3 = r15
+ ;;
+ adds out0 = -MCOUNT_INSN_SIZE, out0
+ mov out1 = in2
+ mov b6 = r3
+
+ br.call.sptk.many b0 = b6
+ ;;
+ mov ar.pfs = loc0
+ mov b0 = loc1
+ mov r8 = loc2
+ mov r15 = loc3
+ br ftrace_stub
+ ;;
+END(_mcount)
+
+GLOBAL_ENTRY(ftrace_stub)
+ mov r3 = b0
+ movl r2 = _mcount_ret_helper
+ ;;
+ mov b6 = r2
+ mov b7 = r3
+ br.ret.sptk.many b6
+
+_mcount_ret_helper:
+ mov b0 = r42
+ mov r1 = r41
+ mov ar.pfs = r40
+ br b7
+END(ftrace_stub)
+
+#endif /* CONFIG_FUNCTION_TRACER */
+
.rodata
.align 8
.globl sys_call_table
diff --git a/arch/ia64/kernel/ia64_ksyms.c b/arch/ia64/kernel/ia64_ksyms.c
index 6da1f20..2d31186 100644
--- a/arch/ia64/kernel/ia64_ksyms.c
+++ b/arch/ia64/kernel/ia64_ksyms.c
@@ -112,3 +112,9 @@ EXPORT_SYMBOL_GPL(esi_call_phys);
#endif
extern char ia64_ivt[];
EXPORT_SYMBOL(ia64_ivt);
+
+#include <asm/ftrace.h>
+#ifdef CONFIG_FUNCTION_TRACER
+/* mcount is defined in assembly */
+EXPORT_SYMBOL(_mcount);
+#endif
--
1.5.6.5
--
next prev parent reply other threads:[~2009-01-13 6:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-13 6:11 [PATCH 0/9] ftrace: updates for tip Steven Rostedt
2009-01-13 6:11 ` [PATCH 1/9] ftrace, ia64: make recordmcount destinct module compile Steven Rostedt
2009-01-13 6:11 ` [PATCH 2/9] ftrace, ia64: explictly ignore a file in recordmcount.pl Steven Rostedt
2009-01-13 6:11 ` [PATCH 3/9] ftrace, ia64: Add macro for ftrace_caller Steven Rostedt
2009-01-13 6:11 ` [PATCH 4/9] ftrace, ia64: Add recordmcount for ia64 Steven Rostedt
2009-01-13 6:11 ` Steven Rostedt [this message]
2009-01-13 6:11 ` [PATCH 6/9] ftrace, ia64: IA64 dynamic ftrace support Steven Rostedt
2009-01-13 6:11 ` [PATCH 7/9] tracing/ftrace: separate events tracing and stats tracing engine Steven Rostedt
2009-01-13 6:11 ` [PATCH 8/9] tracing: add a new workqueue tracer Steven Rostedt
2009-01-13 6:11 ` [PATCH 9/9] ftrace, trivial: fix typo "resgister" -> "register" Steven Rostedt
2009-01-13 8:03 ` Uwe Kleine-König
2009-01-13 13:04 ` Steven Rostedt
2009-01-13 14:06 ` [PATCH 0/9] ftrace: updates for tip Steven Rostedt
2009-01-13 16:54 ` Steven Rostedt
2009-01-14 11:12 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090113061147.944289231@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=sam@ravnborg.org \
--cc=shaohua.li@intel.com \
--cc=srostedt@redhat.com \
--cc=tony.luck@intel.com \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox