diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2014-08-15 12:33:46 +0200 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2014-09-09 08:53:28 +0200 |
commit | 2481a87b0250bbf429fc8cdc78331efbc44a0221 (patch) | |
tree | 0bf818ad656c2c12bbe4bc5b7882c99826439b93 /arch/s390/kernel/ftrace.c | |
parent | s390: pass march flag to assembly files as well (diff) | |
download | linux-2481a87b0250bbf429fc8cdc78331efbc44a0221.tar.xz linux-2481a87b0250bbf429fc8cdc78331efbc44a0221.zip |
s390/ftrace: optimize function graph caller code
When the function graph tracer is disabled we can skip three additional
instructions. So let's just do this.
So if function tracing is enabled but function graph tracing is
runtime disabled, we get away with a single unconditional branch.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/ftrace.c')
-rw-r--r-- | arch/s390/kernel/ftrace.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c index 54d6493c4a56..de55efa5b64e 100644 --- a/arch/s390/kernel/ftrace.c +++ b/arch/s390/kernel/ftrace.c @@ -170,6 +170,29 @@ out: * directly after the instructions. To enable the call we calculate * the original offset to prepare_ftrace_return and put it back. */ + +#ifdef CONFIG_64BIT + +int ftrace_enable_ftrace_graph_caller(void) +{ + static unsigned short offset = 0x0002; + + return probe_kernel_write((void *) ftrace_graph_caller + 2, + &offset, sizeof(offset)); +} + +int ftrace_disable_ftrace_graph_caller(void) +{ + unsigned short offset; + + offset = ((void *) &ftrace_graph_caller_end - + (void *) ftrace_graph_caller) / 2; + return probe_kernel_write((void *) ftrace_graph_caller + 2, + &offset, sizeof(offset)); +} + +#else /* CONFIG_64BIT */ + int ftrace_enable_ftrace_graph_caller(void) { unsigned short offset; @@ -188,5 +211,6 @@ int ftrace_disable_ftrace_graph_caller(void) &offset, sizeof(offset)); } +#endif /* CONFIG_64BIT */ #endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |