ftrace: Have the callbacks receive a struct ftrace_regs instead of pt_regs
In preparation to have arguments of a function passed to callbacks attached to functions as default, change the default callback prototype to receive a struct ftrace_regs as the forth parameter instead of a pt_regs. For callbacks that set the FL_SAVE_REGS flag in their ftrace_ops flags, they will now need to get the pt_regs via a ftrace_get_regs() helper call. If this is called by a callback that their ftrace_ops did not have a FL_SAVE_REGS flag set, it that helper function will return NULL. This will allow the ftrace_regs to hold enough just to get the parameters and stack pointer, but without the worry that callbacks may have a pt_regs that is not completely filled. Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
parent
58954b3be8
commit
d19ad0775d
18 changed files with 71 additions and 45 deletions
|
|
@ -107,7 +107,7 @@ static int trace_selftest_test_probe1_cnt;
|
|||
static void trace_selftest_test_probe1_func(unsigned long ip,
|
||||
unsigned long pip,
|
||||
struct ftrace_ops *op,
|
||||
struct pt_regs *pt_regs)
|
||||
struct ftrace_regs *fregs)
|
||||
{
|
||||
trace_selftest_test_probe1_cnt++;
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ static int trace_selftest_test_probe2_cnt;
|
|||
static void trace_selftest_test_probe2_func(unsigned long ip,
|
||||
unsigned long pip,
|
||||
struct ftrace_ops *op,
|
||||
struct pt_regs *pt_regs)
|
||||
struct ftrace_regs *fregs)
|
||||
{
|
||||
trace_selftest_test_probe2_cnt++;
|
||||
}
|
||||
|
|
@ -125,7 +125,7 @@ static int trace_selftest_test_probe3_cnt;
|
|||
static void trace_selftest_test_probe3_func(unsigned long ip,
|
||||
unsigned long pip,
|
||||
struct ftrace_ops *op,
|
||||
struct pt_regs *pt_regs)
|
||||
struct ftrace_regs *fregs)
|
||||
{
|
||||
trace_selftest_test_probe3_cnt++;
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@ static int trace_selftest_test_global_cnt;
|
|||
static void trace_selftest_test_global_func(unsigned long ip,
|
||||
unsigned long pip,
|
||||
struct ftrace_ops *op,
|
||||
struct pt_regs *pt_regs)
|
||||
struct ftrace_regs *fregs)
|
||||
{
|
||||
trace_selftest_test_global_cnt++;
|
||||
}
|
||||
|
|
@ -143,7 +143,7 @@ static int trace_selftest_test_dyn_cnt;
|
|||
static void trace_selftest_test_dyn_func(unsigned long ip,
|
||||
unsigned long pip,
|
||||
struct ftrace_ops *op,
|
||||
struct pt_regs *pt_regs)
|
||||
struct ftrace_regs *fregs)
|
||||
{
|
||||
trace_selftest_test_dyn_cnt++;
|
||||
}
|
||||
|
|
@ -414,7 +414,7 @@ static int trace_selftest_recursion_cnt;
|
|||
static void trace_selftest_test_recursion_func(unsigned long ip,
|
||||
unsigned long pip,
|
||||
struct ftrace_ops *op,
|
||||
struct pt_regs *pt_regs)
|
||||
struct ftrace_regs *fregs)
|
||||
{
|
||||
/*
|
||||
* This function is registered without the recursion safe flag.
|
||||
|
|
@ -429,7 +429,7 @@ static void trace_selftest_test_recursion_func(unsigned long ip,
|
|||
static void trace_selftest_test_recursion_safe_func(unsigned long ip,
|
||||
unsigned long pip,
|
||||
struct ftrace_ops *op,
|
||||
struct pt_regs *pt_regs)
|
||||
struct ftrace_regs *fregs)
|
||||
{
|
||||
/*
|
||||
* We said we would provide our own recursion. By calling
|
||||
|
|
@ -548,9 +548,11 @@ static enum {
|
|||
static void trace_selftest_test_regs_func(unsigned long ip,
|
||||
unsigned long pip,
|
||||
struct ftrace_ops *op,
|
||||
struct pt_regs *pt_regs)
|
||||
struct ftrace_regs *fregs)
|
||||
{
|
||||
if (pt_regs)
|
||||
struct pt_regs *regs = ftrace_get_regs(fregs);
|
||||
|
||||
if (regs)
|
||||
trace_selftest_regs_stat = TRACE_SELFTEST_REGS_FOUND;
|
||||
else
|
||||
trace_selftest_regs_stat = TRACE_SELFTEST_REGS_NOT_FOUND;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue