aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2015-01-09 07:08:28 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2015-01-29 03:19:25 -0500
commite6d60b368b45b9be3aa068f8e5fa98c3487c9d4e (patch)
treeabe83543f72b5cd5d5de309dab8551f93c34f023 /arch/s390/include
parent61f552141c9c0e88b3fdc7046265781ffd8fa68a (diff)
s390/ftrace: hotpatch support for function tracing
Make use of gcc's hotpatch support to generate better code for ftrace function tracing. The generated code now contains only a six byte nop in each function prologue instead of a 24 byte code block which will be runtime patched to support function tracing. With the new code generation the runtime overhead for supporting function tracing is close to zero, while the original code did show a significant performance impact. Acked-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/include')
-rw-r--r--arch/s390/include/asm/ftrace.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/s390/include/asm/ftrace.h b/arch/s390/include/asm/ftrace.h
index abb618f1ead2..836c56290499 100644
--- a/arch/s390/include/asm/ftrace.h
+++ b/arch/s390/include/asm/ftrace.h
@@ -3,8 +3,12 @@
3 3
4#define ARCH_SUPPORTS_FTRACE_OPS 1 4#define ARCH_SUPPORTS_FTRACE_OPS 1
5 5
6#ifdef CC_USING_HOTPATCH
7#define MCOUNT_INSN_SIZE 6
8#else
6#define MCOUNT_INSN_SIZE 24 9#define MCOUNT_INSN_SIZE 24
7#define MCOUNT_RETURN_FIXUP 18 10#define MCOUNT_RETURN_FIXUP 18
11#endif
8 12
9#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
10 14
@@ -37,18 +41,29 @@ struct ftrace_insn {
37static inline void ftrace_generate_nop_insn(struct ftrace_insn *insn) 41static inline void ftrace_generate_nop_insn(struct ftrace_insn *insn)
38{ 42{
39#ifdef CONFIG_FUNCTION_TRACER 43#ifdef CONFIG_FUNCTION_TRACER
44#ifdef CC_USING_HOTPATCH
45 /* brcl 0,0 */
46 insn->opc = 0xc004;
47 insn->disp = 0;
48#else
40 /* jg .+24 */ 49 /* jg .+24 */
41 insn->opc = 0xc0f4; 50 insn->opc = 0xc0f4;
42 insn->disp = MCOUNT_INSN_SIZE / 2; 51 insn->disp = MCOUNT_INSN_SIZE / 2;
43#endif 52#endif
53#endif
44} 54}
45 55
46static inline int is_ftrace_nop(struct ftrace_insn *insn) 56static inline int is_ftrace_nop(struct ftrace_insn *insn)
47{ 57{
48#ifdef CONFIG_FUNCTION_TRACER 58#ifdef CONFIG_FUNCTION_TRACER
59#ifdef CC_USING_HOTPATCH
60 if (insn->disp == 0)
61 return 1;
62#else
49 if (insn->disp == MCOUNT_INSN_SIZE / 2) 63 if (insn->disp == MCOUNT_INSN_SIZE / 2)
50 return 1; 64 return 1;
51#endif 65#endif
66#endif
52 return 0; 67 return 0;
53} 68}
54 69