@@ -103,7 +103,7 @@ static struct ftrace_ops control_ops;
103103
104104#if ARCH_SUPPORTS_FTRACE_OPS
105105static void ftrace_ops_list_func (unsigned long ip , unsigned long parent_ip ,
106- struct ftrace_ops * op );
106+ struct ftrace_ops * op , struct pt_regs * regs );
107107#else
108108/* See comment below, where ftrace_ops_list_func is defined */
109109static void ftrace_ops_no_ops (unsigned long ip , unsigned long parent_ip );
@@ -121,27 +121,27 @@ static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip);
121121 */
122122static void
123123ftrace_global_list_func (unsigned long ip , unsigned long parent_ip ,
124- struct ftrace_ops * op )
124+ struct ftrace_ops * op , struct pt_regs * regs )
125125{
126126 if (unlikely (trace_recursion_test (TRACE_GLOBAL_BIT )))
127127 return ;
128128
129129 trace_recursion_set (TRACE_GLOBAL_BIT );
130130 op = rcu_dereference_raw (ftrace_global_list ); /*see above*/
131131 while (op != & ftrace_list_end ) {
132- op -> func (ip , parent_ip , op );
132+ op -> func (ip , parent_ip , op , regs );
133133 op = rcu_dereference_raw (op -> next ); /*see above*/
134134 };
135135 trace_recursion_clear (TRACE_GLOBAL_BIT );
136136}
137137
138138static void ftrace_pid_func (unsigned long ip , unsigned long parent_ip ,
139- struct ftrace_ops * op )
139+ struct ftrace_ops * op , struct pt_regs * regs )
140140{
141141 if (!test_tsk_trace_trace (current ))
142142 return ;
143143
144- ftrace_pid_function (ip , parent_ip , op );
144+ ftrace_pid_function (ip , parent_ip , op , regs );
145145}
146146
147147static void set_ftrace_pid_function (ftrace_func_t func )
@@ -763,7 +763,7 @@ ftrace_profile_alloc(struct ftrace_profile_stat *stat, unsigned long ip)
763763
764764static void
765765function_profile_call (unsigned long ip , unsigned long parent_ip ,
766- struct ftrace_ops * ops )
766+ struct ftrace_ops * ops , struct pt_regs * regs )
767767{
768768 struct ftrace_profile_stat * stat ;
769769 struct ftrace_profile * rec ;
@@ -793,7 +793,7 @@ function_profile_call(unsigned long ip, unsigned long parent_ip,
793793#ifdef CONFIG_FUNCTION_GRAPH_TRACER
794794static int profile_graph_entry (struct ftrace_graph_ent * trace )
795795{
796- function_profile_call (trace -> func , 0 , NULL );
796+ function_profile_call (trace -> func , 0 , NULL , NULL );
797797 return 1 ;
798798}
799799
@@ -2771,7 +2771,7 @@ static int __init ftrace_mod_cmd_init(void)
27712771device_initcall (ftrace_mod_cmd_init );
27722772
27732773static void function_trace_probe_call (unsigned long ip , unsigned long parent_ip ,
2774- struct ftrace_ops * op )
2774+ struct ftrace_ops * op , struct pt_regs * pt_regs )
27752775{
27762776 struct ftrace_func_probe * entry ;
27772777 struct hlist_head * hhd ;
@@ -3923,7 +3923,7 @@ ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip)
39233923
39243924static void
39253925ftrace_ops_control_func (unsigned long ip , unsigned long parent_ip ,
3926- struct ftrace_ops * op )
3926+ struct ftrace_ops * op , struct pt_regs * regs )
39273927{
39283928 if (unlikely (trace_recursion_test (TRACE_CONTROL_BIT )))
39293929 return ;
@@ -3938,7 +3938,7 @@ ftrace_ops_control_func(unsigned long ip, unsigned long parent_ip,
39383938 while (op != & ftrace_list_end ) {
39393939 if (!ftrace_function_local_disabled (op ) &&
39403940 ftrace_ops_test (op , ip ))
3941- op -> func (ip , parent_ip , op );
3941+ op -> func (ip , parent_ip , op , regs );
39423942
39433943 op = rcu_dereference_raw (op -> next );
39443944 };
@@ -3952,7 +3952,7 @@ static struct ftrace_ops control_ops = {
39523952
39533953static inline void
39543954__ftrace_ops_list_func (unsigned long ip , unsigned long parent_ip ,
3955- struct ftrace_ops * ignored )
3955+ struct ftrace_ops * ignored , struct pt_regs * regs )
39563956{
39573957 struct ftrace_ops * op ;
39583958
@@ -3971,7 +3971,7 @@ __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,
39713971 op = rcu_dereference_raw (ftrace_ops_list );
39723972 while (op != & ftrace_list_end ) {
39733973 if (ftrace_ops_test (op , ip ))
3974- op -> func (ip , parent_ip , op );
3974+ op -> func (ip , parent_ip , op , regs );
39753975 op = rcu_dereference_raw (op -> next );
39763976 };
39773977 preempt_enable_notrace ();
@@ -3983,17 +3983,24 @@ __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,
39833983 * the list function ignores the op parameter, we do not want any
39843984 * C side effects, where a function is called without the caller
39853985 * sending a third parameter.
3986+ * Archs are to support both the regs and ftrace_ops at the same time.
3987+ * If they support ftrace_ops, it is assumed they support regs.
3988+ * If call backs want to use regs, they must either check for regs
3989+ * being NULL, or ARCH_SUPPORTS_FTRACE_SAVE_REGS.
3990+ * Note, ARCH_SUPPORT_SAVE_REGS expects a full regs to be saved.
3991+ * An architecture can pass partial regs with ftrace_ops and still
3992+ * set the ARCH_SUPPORT_FTARCE_OPS.
39863993 */
39873994#if ARCH_SUPPORTS_FTRACE_OPS
39883995static void ftrace_ops_list_func (unsigned long ip , unsigned long parent_ip ,
3989- struct ftrace_ops * op )
3996+ struct ftrace_ops * op , struct pt_regs * regs )
39903997{
3991- __ftrace_ops_list_func (ip , parent_ip , NULL );
3998+ __ftrace_ops_list_func (ip , parent_ip , NULL , regs );
39923999}
39934000#else
39944001static void ftrace_ops_no_ops (unsigned long ip , unsigned long parent_ip )
39954002{
3996- __ftrace_ops_list_func (ip , parent_ip , NULL );
4003+ __ftrace_ops_list_func (ip , parent_ip , NULL , NULL );
39974004}
39984005#endif
39994006
0 commit comments