mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 14:14:24 +08:00
s390/ftrace: enable HAVE_FUNCTION_GRAPH_RETVAL
Add support for tracing return values in the function graph tracer. This requires return_to_handler() to record gpr2 and the frame pointer Signed-off-by: Sven Schnelle <svens@linux.ibm.com> Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
parent
3325b4d857
commit
1256e70a08
@ -174,6 +174,7 @@ config S390
|
|||||||
select HAVE_FTRACE_MCOUNT_RECORD
|
select HAVE_FTRACE_MCOUNT_RECORD
|
||||||
select HAVE_FUNCTION_ARG_ACCESS_API
|
select HAVE_FUNCTION_ARG_ACCESS_API
|
||||||
select HAVE_FUNCTION_ERROR_INJECTION
|
select HAVE_FUNCTION_ERROR_INJECTION
|
||||||
|
select HAVE_FUNCTION_GRAPH_RETVAL
|
||||||
select HAVE_FUNCTION_GRAPH_TRACER
|
select HAVE_FUNCTION_GRAPH_TRACER
|
||||||
select HAVE_FUNCTION_TRACER
|
select HAVE_FUNCTION_TRACER
|
||||||
select HAVE_GCC_PLUGINS
|
select HAVE_GCC_PLUGINS
|
||||||
|
@ -54,6 +54,23 @@ static __always_inline struct pt_regs *arch_ftrace_get_regs(struct ftrace_regs *
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
||||||
|
struct fgraph_ret_regs {
|
||||||
|
unsigned long gpr2;
|
||||||
|
unsigned long fp;
|
||||||
|
};
|
||||||
|
|
||||||
|
static __always_inline unsigned long fgraph_ret_regs_return_value(struct fgraph_ret_regs *ret_regs)
|
||||||
|
{
|
||||||
|
return ret_regs->gpr2;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __always_inline unsigned long fgraph_ret_regs_frame_pointer(struct fgraph_ret_regs *ret_regs)
|
||||||
|
{
|
||||||
|
return ret_regs->fp;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
|
||||||
|
|
||||||
static __always_inline unsigned long
|
static __always_inline unsigned long
|
||||||
ftrace_regs_get_instruction_pointer(const struct ftrace_regs *fregs)
|
ftrace_regs_get_instruction_pointer(const struct ftrace_regs *fregs)
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/purgatory.h>
|
#include <linux/purgatory.h>
|
||||||
#include <linux/pgtable.h>
|
#include <linux/pgtable.h>
|
||||||
|
#include <linux/ftrace.h>
|
||||||
#include <asm/idle.h>
|
#include <asm/idle.h>
|
||||||
#include <asm/gmap.h>
|
#include <asm/gmap.h>
|
||||||
#include <asm/stacktrace.h>
|
#include <asm/stacktrace.h>
|
||||||
@ -177,5 +178,11 @@ int main(void)
|
|||||||
DEFINE(OLDMEM_SIZE, PARMAREA + offsetof(struct parmarea, oldmem_size));
|
DEFINE(OLDMEM_SIZE, PARMAREA + offsetof(struct parmarea, oldmem_size));
|
||||||
DEFINE(COMMAND_LINE, PARMAREA + offsetof(struct parmarea, command_line));
|
DEFINE(COMMAND_LINE, PARMAREA + offsetof(struct parmarea, command_line));
|
||||||
DEFINE(MAX_COMMAND_LINE_SIZE, PARMAREA + offsetof(struct parmarea, max_command_line_size));
|
DEFINE(MAX_COMMAND_LINE_SIZE, PARMAREA + offsetof(struct parmarea, max_command_line_size));
|
||||||
|
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
||||||
|
/* function graph return value tracing */
|
||||||
|
OFFSET(__FGRAPH_RET_GPR2, fgraph_ret_regs, gpr2);
|
||||||
|
OFFSET(__FGRAPH_RET_FP, fgraph_ret_regs, fp);
|
||||||
|
DEFINE(__FGRAPH_RET_SIZE, sizeof(struct fgraph_ret_regs));
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -128,10 +128,14 @@ SYM_CODE_END(ftrace_common)
|
|||||||
SYM_FUNC_START(return_to_handler)
|
SYM_FUNC_START(return_to_handler)
|
||||||
stmg %r2,%r5,32(%r15)
|
stmg %r2,%r5,32(%r15)
|
||||||
lgr %r1,%r15
|
lgr %r1,%r15
|
||||||
aghi %r15,-STACK_FRAME_OVERHEAD
|
aghi %r15,-(STACK_FRAME_OVERHEAD+__FGRAPH_RET_SIZE)
|
||||||
stg %r1,__SF_BACKCHAIN(%r15)
|
stg %r1,__SF_BACKCHAIN(%r15)
|
||||||
|
aghik %r3,%r15,STACK_FRAME_OVERHEAD
|
||||||
|
stg %r1,__FGRAPH_RET_FP(%r3)
|
||||||
|
stg %r2,__FGRAPH_RET_GPR2(%r3)
|
||||||
|
lgr %r2,%r3
|
||||||
brasl %r14,ftrace_return_to_handler
|
brasl %r14,ftrace_return_to_handler
|
||||||
aghi %r15,STACK_FRAME_OVERHEAD
|
aghi %r15,STACK_FRAME_OVERHEAD+__FGRAPH_RET_SIZE
|
||||||
lgr %r14,%r2
|
lgr %r14,%r2
|
||||||
lmg %r2,%r5,32(%r15)
|
lmg %r2,%r5,32(%r15)
|
||||||
BR_EX %r14
|
BR_EX %r14
|
||||||
|
Loading…
Reference in New Issue
Block a user