History

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.

Steven Rostedt (VMware) committed 6 years ago

Commit d19ad071 parent 58954b318 files · +71 −45Browse files

Unified · Split

18 files
  1. arch/csky/kernel/probes/ftrace.c +3 −1
  2. arch/nds32/kernel/ftrace.c +2 −2
  3. arch/parisc/kernel/ftrace.c +5 −3
  4. arch/powerpc/kernel/kprobes-ftrace.c +3 −1
  5. arch/s390/kernel/ftrace.c +3 −1
  6. arch/x86/kernel/kprobes/ftrace.c +2 −1
  7. fs/pstore/ftrace.c +1 −1
  8. include/linux/ftrace.h +14 −2
  9. include/linux/kprobes.h +1 −1
  10. kernel/livepatch/patch.c +2 −1
  11. kernel/trace/ftrace.c +15 −12
  12. kernel/trace/trace_event_perf.c +1 −1
  13. kernel/trace/trace_events.c +1 −1
  14. kernel/trace/trace_functions.c +4 −5
  15. kernel/trace/trace_irqsoff.c +1 −1
  16. kernel/trace/trace_sched_wakeup.c +1 −1
  17. kernel/trace/trace_selftest.c +11 −9
  18. kernel/trace/trace_stack.c +1 −1
arch/csky/kernel/probes/ftrace.c+3−1
@@ -11,17 +11,19 @@ int arch_check_ftrace_location(struct kprobe *p) · 10 unmodified lines
11 11
12/* Ftrace callback handler for kprobes -- called under preepmt disabed */12/* Ftrace callback handler for kprobes -- called under preepmt disabed */
13void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,13void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
14 struct ftrace_ops *ops, struct pt_regs *regs)14 struct ftrace_ops *ops, struct ftrace_regs *fregs)
15{15{
16 int bit;16 int bit;
17 bool lr_saver = false;17 bool lr_saver = false;
18 struct kprobe *p;18 struct kprobe *p;
19 struct kprobe_ctlblk *kcb;19 struct kprobe_ctlblk *kcb;
20 struct pt_regs *regs;
20 21
21 bit = ftrace_test_recursion_trylock(ip, parent_ip);22 bit = ftrace_test_recursion_trylock(ip, parent_ip);
22 if (bit < 0)23 if (bit < 0)
23 return;24 return;
24 25
26 regs = ftrace_get_regs(fregs);
25 preempt_disable_notrace();27 preempt_disable_notrace();
26 p = get_kprobe((kprobe_opcode_t *)ip);28 p = get_kprobe((kprobe_opcode_t *)ip);
27 if (!p) {29 if (!p) {
arch/nds32/kernel/ftrace.c+2−2
@@ -10,7 +10,7 @@ extern void (*ftrace_trace_function)(unsigned long, unsigned long, · 9 unmodified lines
10extern void ftrace_graph_caller(void);10extern void ftrace_graph_caller(void);
11 11
12noinline void __naked ftrace_stub(unsigned long ip, unsigned long parent_ip,12noinline void __naked ftrace_stub(unsigned long ip, unsigned long parent_ip,
13 struct ftrace_ops *op, struct pt_regs *regs)13 struct ftrace_ops *op, struct ftrace_regs *fregs)
14{14{
15 __asm__ (""); /* avoid to optimize as pure function */15 __asm__ (""); /* avoid to optimize as pure function */
16}16}
@@ -38,7 +38,7 @@ EXPORT_SYMBOL(_mcount); · 21 unmodified lines
38#else /* CONFIG_DYNAMIC_FTRACE */38#else /* CONFIG_DYNAMIC_FTRACE */
39 39
40noinline void __naked ftrace_stub(unsigned long ip, unsigned long parent_ip,40noinline void __naked ftrace_stub(unsigned long ip, unsigned long parent_ip,
41 struct ftrace_ops *op, struct pt_regs *regs)41 struct ftrace_ops *op, struct ftrace_regs *fregs)
42{42{
43 __asm__ (""); /* avoid to optimize as pure function */43 __asm__ (""); /* avoid to optimize as pure function */
44}44}
arch/parisc/kernel/ftrace.c+5−3
@@ -51,7 +51,7 @@ static void __hot prepare_ftrace_return(unsigned long *parent, · 50 unmodified lines
51void notrace __hot ftrace_function_trampoline(unsigned long parent,51void notrace __hot ftrace_function_trampoline(unsigned long parent,
52 unsigned long self_addr,52 unsigned long self_addr,
53 unsigned long org_sp_gr3,53 unsigned long org_sp_gr3,
54 struct pt_regs *regs)54 struct ftrace_regs *fregs)
55{55{
56#ifndef CONFIG_DYNAMIC_FTRACE56#ifndef CONFIG_DYNAMIC_FTRACE
57 extern ftrace_func_t ftrace_trace_function;57 extern ftrace_func_t ftrace_trace_function;
@@ -61,7 +61,7 @@ void notrace __hot ftrace_function_trampoline(unsigned long parent, · 3 unmodified lines
61 if (function_trace_op->flags & FTRACE_OPS_FL_ENABLED &&61 if (function_trace_op->flags & FTRACE_OPS_FL_ENABLED &&
62 ftrace_trace_function != ftrace_stub)62 ftrace_trace_function != ftrace_stub)
63 ftrace_trace_function(self_addr, parent,63 ftrace_trace_function(self_addr, parent,
64 function_trace_op, regs);64 function_trace_op, fregs);
65 65
66#ifdef CONFIG_FUNCTION_GRAPH_TRACER66#ifdef CONFIG_FUNCTION_GRAPH_TRACER
67 if (dereference_function_descriptor(ftrace_graph_return) !=67 if (dereference_function_descriptor(ftrace_graph_return) !=
@@ -204,9 +204,10 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec, · 136 unmodified lines
204 204
205#ifdef CONFIG_KPROBES_ON_FTRACE205#ifdef CONFIG_KPROBES_ON_FTRACE
206void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,206void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
207 struct ftrace_ops *ops, struct pt_regs *regs)207 struct ftrace_ops *ops, struct ftrace_regs *fregs)
208{208{
209 struct kprobe_ctlblk *kcb;209 struct kprobe_ctlblk *kcb;
210 struct pt_regs *regs;
210 struct kprobe *p;211 struct kprobe *p;
211 int bit;212 int bit;
212 213
@@ -214,6 +215,7 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, · 1 unmodified line
214 if (bit < 0)215 if (bit < 0)
215 return;216 return;
216 217
218 regs = ftrace_get_regs(fregs);
217 preempt_disable_notrace();219 preempt_disable_notrace();
218 p = get_kprobe((kprobe_opcode_t *)ip);220 p = get_kprobe((kprobe_opcode_t *)ip);
219 if (unlikely(!p) || kprobe_disabled(p))221 if (unlikely(!p) || kprobe_disabled(p))
arch/powerpc/kernel/kprobes-ftrace.c+3−1
@@ -14,16 +14,18 @@ · 13 unmodified lines
14 14
15/* Ftrace callback handler for kprobes */15/* Ftrace callback handler for kprobes */
16void kprobe_ftrace_handler(unsigned long nip, unsigned long parent_nip,16void kprobe_ftrace_handler(unsigned long nip, unsigned long parent_nip,
17 struct ftrace_ops *ops, struct pt_regs *regs)17 struct ftrace_ops *ops, struct ftrace_regs *fregs)
18{18{
19 struct kprobe *p;19 struct kprobe *p;
20 struct kprobe_ctlblk *kcb;20 struct kprobe_ctlblk *kcb;
21 struct pt_regs *regs;
21 int bit;22 int bit;
22 23
23 bit = ftrace_test_recursion_trylock(nip, parent_nip);24 bit = ftrace_test_recursion_trylock(nip, parent_nip);
24 if (bit < 0)25 if (bit < 0)
25 return;26 return;
26 27
28 regs = ftrace_get_regs(fregs);
27 preempt_disable_notrace();29 preempt_disable_notrace();
28 p = get_kprobe((kprobe_opcode_t *)nip);30 p = get_kprobe((kprobe_opcode_t *)nip);
29 if (unlikely(!p) || kprobe_disabled(p))31 if (unlikely(!p) || kprobe_disabled(p))
arch/s390/kernel/ftrace.c+3−1
@@ -198,9 +198,10 @@ int ftrace_disable_ftrace_graph_caller(void) · 197 unmodified lines
198 198
199#ifdef CONFIG_KPROBES_ON_FTRACE199#ifdef CONFIG_KPROBES_ON_FTRACE
200void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,200void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
201 struct ftrace_ops *ops, struct pt_regs *regs)201 struct ftrace_ops *ops, struct ftrace_regs *fregs)
202{202{
203 struct kprobe_ctlblk *kcb;203 struct kprobe_ctlblk *kcb;
204 struct pt_regs *regs;
204 struct kprobe *p;205 struct kprobe *p;
205 int bit;206 int bit;
206 207
@@ -208,6 +209,7 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip, · 1 unmodified line
208 if (bit < 0)209 if (bit < 0)
209 return;210 return;
210 211
212 regs = ftrace_get_regs(fregs);
211 preempt_disable_notrace();213 preempt_disable_notrace();
212 p = get_kprobe((kprobe_opcode_t *)ip);214 p = get_kprobe((kprobe_opcode_t *)ip);
213 if (unlikely(!p) || kprobe_disabled(p))215 if (unlikely(!p) || kprobe_disabled(p))
arch/x86/kernel/kprobes/ftrace.c+2−1
@@ -14,8 +14,9 @@ · 13 unmodified lines
14 14
15/* Ftrace callback handler for kprobes -- called under preepmt disabed */15/* Ftrace callback handler for kprobes -- called under preepmt disabed */
16void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,16void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
17 struct ftrace_ops *ops, struct pt_regs *regs)17 struct ftrace_ops *ops, struct ftrace_regs *fregs)
18{18{
19 struct pt_regs *regs = ftrace_get_regs(fregs);
19 struct kprobe *p;20 struct kprobe *p;
20 struct kprobe_ctlblk *kcb;21 struct kprobe_ctlblk *kcb;
21 int bit;22 int bit;
fs/pstore/ftrace.c+1−1
@@ -26,7 +26,7 @@ static u64 pstore_ftrace_stamp; · 25 unmodified lines
26static void notrace pstore_ftrace_call(unsigned long ip,26static void notrace pstore_ftrace_call(unsigned long ip,
27 unsigned long parent_ip,27 unsigned long parent_ip,
28 struct ftrace_ops *op,28 struct ftrace_ops *op,
29 struct pt_regs *regs)29 struct ftrace_regs *fregs)
30{30{
31 int bit;31 int bit;
32 unsigned long flags;32 unsigned long flags;
include/linux/ftrace.h+14−2
@@ -90,8 +90,20 @@ ftrace_enable_sysctl(struct ctl_table *table, int write, · 89 unmodified lines
90 90
91struct ftrace_ops;91struct ftrace_ops;
92 92
93struct ftrace_regs {
94 struct pt_regs regs;
95};
96
97static __always_inline struct pt_regs *ftrace_get_regs(struct ftrace_regs *fregs)
98{
99 if (!fregs)
100 return NULL;
101
102 return &fregs->regs;
103}
104
93typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,105typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
94 struct ftrace_ops *op, struct pt_regs *regs);106 struct ftrace_ops *op, struct ftrace_regs *fregs);
95 107
96ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops);108ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops);
97 109
@@ -259,7 +271,7 @@ int register_ftrace_function(struct ftrace_ops *ops); · 161 unmodified lines
259int unregister_ftrace_function(struct ftrace_ops *ops);271int unregister_ftrace_function(struct ftrace_ops *ops);
260 272
261extern void ftrace_stub(unsigned long a0, unsigned long a1,273extern void ftrace_stub(unsigned long a0, unsigned long a1,
262 struct ftrace_ops *op, struct pt_regs *regs);274 struct ftrace_ops *op, struct ftrace_regs *fregs);
263 275
264#else /* !CONFIG_FUNCTION_TRACER */276#else /* !CONFIG_FUNCTION_TRACER */
265/*277/*
include/linux/kprobes.h+1−1
@@ -345,7 +345,7 @@ static inline void wait_for_kprobe_optimizer(void) { } · 344 unmodified lines
345#endif /* CONFIG_OPTPROBES */345#endif /* CONFIG_OPTPROBES */
346#ifdef CONFIG_KPROBES_ON_FTRACE346#ifdef CONFIG_KPROBES_ON_FTRACE
347extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,347extern void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
348 struct ftrace_ops *ops, struct pt_regs *regs);348 struct ftrace_ops *ops, struct ftrace_regs *fregs);
349extern int arch_prepare_kprobe_ftrace(struct kprobe *p);349extern int arch_prepare_kprobe_ftrace(struct kprobe *p);
350#endif350#endif
351 351
kernel/livepatch/patch.c+2−1
@@ -40,8 +40,9 @@ struct klp_ops *klp_find_ops(void *old_func) · 39 unmodified lines
40static void notrace klp_ftrace_handler(unsigned long ip,40static void notrace klp_ftrace_handler(unsigned long ip,
41 unsigned long parent_ip,41 unsigned long parent_ip,
42 struct ftrace_ops *fops,42 struct ftrace_ops *fops,
43 struct pt_regs *regs)43 struct ftrace_regs *fregs)
44{44{
45 struct pt_regs *regs = ftrace_get_regs(fregs);
45 struct klp_ops *ops;46 struct klp_ops *ops;
46 struct klp_func *func;47 struct klp_func *func;
47 int patch_state;48 int patch_state;
kernel/trace/ftrace.c+15−12
@@ -121,7 +121,7 @@ struct ftrace_ops global_ops; · 120 unmodified lines
121 121
122#if ARCH_SUPPORTS_FTRACE_OPS122#if ARCH_SUPPORTS_FTRACE_OPS
123static void ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,123static void ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,
124 struct ftrace_ops *op, struct pt_regs *regs);124 struct ftrace_ops *op, struct ftrace_regs *fregs);
125#else125#else
126/* See comment below, where ftrace_ops_list_func is defined */126/* See comment below, where ftrace_ops_list_func is defined */
127static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip);127static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip);
@@ -140,7 +140,7 @@ static inline void ftrace_ops_init(struct ftrace_ops *ops) · 12 unmodified lines
140}140}
141 141
142static void ftrace_pid_func(unsigned long ip, unsigned long parent_ip,142static void ftrace_pid_func(unsigned long ip, unsigned long parent_ip,
143 struct ftrace_ops *op, struct pt_regs *regs)143 struct ftrace_ops *op, struct ftrace_regs *fregs)
144{144{
145 struct trace_array *tr = op->private;145 struct trace_array *tr = op->private;
146 int pid;146 int pid;
@@ -154,7 +154,7 @@ static void ftrace_pid_func(unsigned long ip, unsigned long parent_ip, · 7 unmodified lines
154 return;154 return;
155 }155 }
156 156
157 op->saved_func(ip, parent_ip, op, regs);157 op->saved_func(ip, parent_ip, op, fregs);
158}158}
159 159
160static void ftrace_sync_ipi(void *data)160static void ftrace_sync_ipi(void *data)
@@ -754,7 +754,7 @@ ftrace_profile_alloc(struct ftrace_profile_stat *stat, unsigned long ip) · 593 unmodified lines
754 754
755static void755static void
756function_profile_call(unsigned long ip, unsigned long parent_ip,756function_profile_call(unsigned long ip, unsigned long parent_ip,
757 struct ftrace_ops *ops, struct pt_regs *regs)757 struct ftrace_ops *ops, struct ftrace_regs *fregs)
758{758{
759 struct ftrace_profile_stat *stat;759 struct ftrace_profile_stat *stat;
760 struct ftrace_profile *rec;760 struct ftrace_profile *rec;
@@ -2143,6 +2143,7 @@ static int ftrace_check_record(struct dyn_ftrace *rec, bool enable, bool update) · 1382 unmodified lines
2143 else2143 else
2144 rec->flags &= ~FTRACE_FL_TRAMP_EN;2144 rec->flags &= ~FTRACE_FL_TRAMP_EN;
2145 }2145 }
2146
2146 if (flag & FTRACE_FL_DIRECT) {2147 if (flag & FTRACE_FL_DIRECT) {
2147 /*2148 /*
2148 * If there's only one user (direct_ops helper)2149 * If there's only one user (direct_ops helper)
@@ -2368,8 +2369,9 @@ unsigned long ftrace_find_rec_direct(unsigned long ip) · 219 unmodified lines
2368}2369}
2369 2370
2370static void call_direct_funcs(unsigned long ip, unsigned long pip,2371static void call_direct_funcs(unsigned long ip, unsigned long pip,
2371 struct ftrace_ops *ops, struct pt_regs *regs)2372 struct ftrace_ops *ops, struct ftrace_regs *fregs)
2372{2373{
2374 struct pt_regs *regs = ftrace_get_regs(fregs);
2373 unsigned long addr;2375 unsigned long addr;
2374 2376
2375 addr = ftrace_find_rec_direct(ip);2377 addr = ftrace_find_rec_direct(ip);
@@ -4292,7 +4294,7 @@ static int __init ftrace_mod_cmd_init(void) · 1916 unmodified lines
4292core_initcall(ftrace_mod_cmd_init);4294core_initcall(ftrace_mod_cmd_init);
4293 4295
4294static void function_trace_probe_call(unsigned long ip, unsigned long parent_ip,4296static void function_trace_probe_call(unsigned long ip, unsigned long parent_ip,
4295 struct ftrace_ops *op, struct pt_regs *pt_regs)4297 struct ftrace_ops *op, struct ftrace_regs *fregs)
4296{4298{
4297 struct ftrace_probe_ops *probe_ops;4299 struct ftrace_probe_ops *probe_ops;
4298 struct ftrace_func_probe *probe;4300 struct ftrace_func_probe *probe;
@@ -6911,8 +6913,9 @@ void ftrace_reset_array_ops(struct trace_array *tr) · 2612 unmodified lines
6911 6913
6912static nokprobe_inline void6914static nokprobe_inline void
6913__ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,6915__ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,
6914 struct ftrace_ops *ignored, struct pt_regs *regs)6916 struct ftrace_ops *ignored, struct ftrace_regs *fregs)
6915{6917{
6918 struct pt_regs *regs = ftrace_get_regs(fregs);
6916 struct ftrace_ops *op;6919 struct ftrace_ops *op;
6917 int bit;6920 int bit;
6918 6921
@@ -6945,7 +6948,7 @@ __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, · 26 unmodified lines
6945 pr_warn("op=%p %pS\n", op, op);6948 pr_warn("op=%p %pS\n", op, op);
6946 goto out;6949 goto out;
6947 }6950 }
6948 op->func(ip, parent_ip, op, regs);6951 op->func(ip, parent_ip, op, fregs);
6949 }6952 }
6950 } while_for_each_ftrace_op(op);6953 } while_for_each_ftrace_op(op);
6951out:6954out:
@@ -6968,9 +6971,9 @@ out: · 16 unmodified lines
6968 */6971 */
6969#if ARCH_SUPPORTS_FTRACE_OPS6972#if ARCH_SUPPORTS_FTRACE_OPS
6970static void ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,6973static void ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip,
6971 struct ftrace_ops *op, struct pt_regs *regs)6974 struct ftrace_ops *op, struct ftrace_regs *fregs)
6972{6975{
6973 __ftrace_ops_list_func(ip, parent_ip, NULL, regs);6976 __ftrace_ops_list_func(ip, parent_ip, NULL, fregs);
6974}6977}
6975NOKPROBE_SYMBOL(ftrace_ops_list_func);6978NOKPROBE_SYMBOL(ftrace_ops_list_func);
6976#else6979#else
@@ -6987,7 +6990,7 @@ NOKPROBE_SYMBOL(ftrace_ops_no_ops); · 10 unmodified lines
6987 * this function will be called by the mcount trampoline.6990 * this function will be called by the mcount trampoline.
6988 */6991 */
6989static void ftrace_ops_assist_func(unsigned long ip, unsigned long parent_ip,6992static void ftrace_ops_assist_func(unsigned long ip, unsigned long parent_ip,
6990 struct ftrace_ops *op, struct pt_regs *regs)6993 struct ftrace_ops *op, struct ftrace_regs *fregs)
6991{6994{
6992 int bit;6995 int bit;
6993 6996
@@ -6998,7 +7001,7 @@ static void ftrace_ops_assist_func(unsigned long ip, unsigned long parent_ip, · 4 unmodified lines
6998 preempt_disable_notrace();7001 preempt_disable_notrace();
6999 7002
7000 if (!(op->flags & FTRACE_OPS_FL_RCU) || rcu_is_watching())7003 if (!(op->flags & FTRACE_OPS_FL_RCU) || rcu_is_watching())
7001 op->func(ip, parent_ip, op, regs);7004 op->func(ip, parent_ip, op, fregs);
7002 7005
7003 preempt_enable_notrace();7006 preempt_enable_notrace();
7004 trace_clear_recursion(bit);7007 trace_clear_recursion(bit);
kernel/trace/trace_event_perf.c+1−1
@@ -432,7 +432,7 @@ NOKPROBE_SYMBOL(perf_trace_buf_update); · 431 unmodified lines
432#ifdef CONFIG_FUNCTION_TRACER432#ifdef CONFIG_FUNCTION_TRACER
433static void433static void
434perf_ftrace_function_call(unsigned long ip, unsigned long parent_ip,434perf_ftrace_function_call(unsigned long ip, unsigned long parent_ip,
435 struct ftrace_ops *ops, struct pt_regs *pt_regs)435 struct ftrace_ops *ops, struct ftrace_regs *fregs)
436{436{
437 struct ftrace_entry *entry;437 struct ftrace_entry *entry;
438 struct perf_event *event;438 struct perf_event *event;
kernel/trace/trace_events.c+1−1
@@ -3673,7 +3673,7 @@ static struct trace_event_file event_trace_file __initdata; · 3672 unmodified lines
3673 3673
3674static void __init3674static void __init
3675function_test_events_call(unsigned long ip, unsigned long parent_ip,3675function_test_events_call(unsigned long ip, unsigned long parent_ip,
3676 struct ftrace_ops *op, struct pt_regs *pt_regs)3676 struct ftrace_ops *op, struct ftrace_regs *regs)
3677{3677{
3678 struct trace_buffer *buffer;3678 struct trace_buffer *buffer;
3679 struct ring_buffer_event *event;3679 struct ring_buffer_event *event;
kernel/trace/trace_functions.c+4−5
@@ -23,10 +23,10 @@ static void tracing_start_function_trace(struct trace_array *tr); · 22 unmodified lines
23static void tracing_stop_function_trace(struct trace_array *tr);23static void tracing_stop_function_trace(struct trace_array *tr);
24static void24static void
25function_trace_call(unsigned long ip, unsigned long parent_ip,25function_trace_call(unsigned long ip, unsigned long parent_ip,
26 struct ftrace_ops *op, struct pt_regs *pt_regs);26 struct ftrace_ops *op, struct ftrace_regs *fregs);
27static void27static void
28function_stack_trace_call(unsigned long ip, unsigned long parent_ip,28function_stack_trace_call(unsigned long ip, unsigned long parent_ip,
29 struct ftrace_ops *op, struct pt_regs *pt_regs);29 struct ftrace_ops *op, struct ftrace_regs *fregs);
30static struct tracer_flags func_flags;30static struct tracer_flags func_flags;
31 31
32/* Our option */32/* Our option */
@@ -89,7 +89,6 @@ void ftrace_destroy_function_files(struct trace_array *tr) · 56 unmodified lines
89static int function_trace_init(struct trace_array *tr)89static int function_trace_init(struct trace_array *tr)
90{90{
91 ftrace_func_t func;91 ftrace_func_t func;
92
93 /*92 /*
94 * Instance trace_arrays get their ops allocated93 * Instance trace_arrays get their ops allocated
95 * at instance creation. Unless it failed94 * at instance creation. Unless it failed
@@ -129,7 +128,7 @@ static void function_trace_start(struct trace_array *tr) · 33 unmodified lines
129 128
130static void129static void
131function_trace_call(unsigned long ip, unsigned long parent_ip,130function_trace_call(unsigned long ip, unsigned long parent_ip,
132 struct ftrace_ops *op, struct pt_regs *pt_regs)131 struct ftrace_ops *op, struct ftrace_regs *fregs)
133{132{
134 struct trace_array *tr = op->private;133 struct trace_array *tr = op->private;
135 struct trace_array_cpu *data;134 struct trace_array_cpu *data;
@@ -178,7 +177,7 @@ function_trace_call(unsigned long ip, unsigned long parent_ip, · 42 unmodified lines
178 177
179static void178static void
180function_stack_trace_call(unsigned long ip, unsigned long parent_ip,179function_stack_trace_call(unsigned long ip, unsigned long parent_ip,
181 struct ftrace_ops *op, struct pt_regs *pt_regs)180 struct ftrace_ops *op, struct ftrace_regs *fregs)
182{181{
183 struct trace_array *tr = op->private;182 struct trace_array *tr = op->private;
184 struct trace_array_cpu *data;183 struct trace_array_cpu *data;
kernel/trace/trace_irqsoff.c+1−1
@@ -138,7 +138,7 @@ static int func_prolog_dec(struct trace_array *tr, · 137 unmodified lines
138 */138 */
139static void139static void
140irqsoff_tracer_call(unsigned long ip, unsigned long parent_ip,140irqsoff_tracer_call(unsigned long ip, unsigned long parent_ip,
141 struct ftrace_ops *op, struct pt_regs *pt_regs)141 struct ftrace_ops *op, struct ftrace_regs *fregs)
142{142{
143 struct trace_array *tr = irqsoff_trace;143 struct trace_array *tr = irqsoff_trace;
144 struct trace_array_cpu *data;144 struct trace_array_cpu *data;
kernel/trace/trace_sched_wakeup.c+1−1
@@ -212,7 +212,7 @@ static void wakeup_print_header(struct seq_file *s) · 211 unmodified lines
212 */212 */
213static void213static void
214wakeup_tracer_call(unsigned long ip, unsigned long parent_ip,214wakeup_tracer_call(unsigned long ip, unsigned long parent_ip,
215 struct ftrace_ops *op, struct pt_regs *pt_regs)215 struct ftrace_ops *op, struct ftrace_regs *fregs)
216{216{
217 struct trace_array *tr = wakeup_trace;217 struct trace_array *tr = wakeup_trace;
218 struct trace_array_cpu *data;218 struct trace_array_cpu *data;
kernel/trace/trace_selftest.c+11−9
@@ -107,7 +107,7 @@ static int trace_selftest_test_probe1_cnt; · 106 unmodified lines
107static void trace_selftest_test_probe1_func(unsigned long ip,107static void trace_selftest_test_probe1_func(unsigned long ip,
108 unsigned long pip,108 unsigned long pip,
109 struct ftrace_ops *op,109 struct ftrace_ops *op,
110 struct pt_regs *pt_regs)110 struct ftrace_regs *fregs)
111{111{
112 trace_selftest_test_probe1_cnt++;112 trace_selftest_test_probe1_cnt++;
113}113}
@@ -116,7 +116,7 @@ static int trace_selftest_test_probe2_cnt; · 2 unmodified lines
116static void trace_selftest_test_probe2_func(unsigned long ip,116static void trace_selftest_test_probe2_func(unsigned long ip,
117 unsigned long pip,117 unsigned long pip,
118 struct ftrace_ops *op,118 struct ftrace_ops *op,
119 struct pt_regs *pt_regs)119 struct ftrace_regs *fregs)
120{120{
121 trace_selftest_test_probe2_cnt++;121 trace_selftest_test_probe2_cnt++;
122}122}
@@ -125,7 +125,7 @@ static int trace_selftest_test_probe3_cnt; · 2 unmodified lines
125static void trace_selftest_test_probe3_func(unsigned long ip,125static void trace_selftest_test_probe3_func(unsigned long ip,
126 unsigned long pip,126 unsigned long pip,
127 struct ftrace_ops *op,127 struct ftrace_ops *op,
128 struct pt_regs *pt_regs)128 struct ftrace_regs *fregs)
129{129{
130 trace_selftest_test_probe3_cnt++;130 trace_selftest_test_probe3_cnt++;
131}131}
@@ -134,7 +134,7 @@ static int trace_selftest_test_global_cnt; · 2 unmodified lines
134static void trace_selftest_test_global_func(unsigned long ip,134static void trace_selftest_test_global_func(unsigned long ip,
135 unsigned long pip,135 unsigned long pip,
136 struct ftrace_ops *op,136 struct ftrace_ops *op,
137 struct pt_regs *pt_regs)137 struct ftrace_regs *fregs)
138{138{
139 trace_selftest_test_global_cnt++;139 trace_selftest_test_global_cnt++;
140}140}
@@ -143,7 +143,7 @@ static int trace_selftest_test_dyn_cnt; · 2 unmodified lines
143static void trace_selftest_test_dyn_func(unsigned long ip,143static void trace_selftest_test_dyn_func(unsigned long ip,
144 unsigned long pip,144 unsigned long pip,
145 struct ftrace_ops *op,145 struct ftrace_ops *op,
146 struct pt_regs *pt_regs)146 struct ftrace_regs *fregs)
147{147{
148 trace_selftest_test_dyn_cnt++;148 trace_selftest_test_dyn_cnt++;
149}149}
@@ -414,7 +414,7 @@ static int trace_selftest_recursion_cnt; · 264 unmodified lines
414static void trace_selftest_test_recursion_func(unsigned long ip,414static void trace_selftest_test_recursion_func(unsigned long ip,
415 unsigned long pip,415 unsigned long pip,
416 struct ftrace_ops *op,416 struct ftrace_ops *op,
417 struct pt_regs *pt_regs)417 struct ftrace_regs *fregs)
418{418{
419 /*419 /*
420 * This function is registered without the recursion safe flag.420 * This function is registered without the recursion safe flag.
@@ -429,7 +429,7 @@ static void trace_selftest_test_recursion_func(unsigned long ip, · 8 unmodified lines
429static void trace_selftest_test_recursion_safe_func(unsigned long ip,429static void trace_selftest_test_recursion_safe_func(unsigned long ip,
430 unsigned long pip,430 unsigned long pip,
431 struct ftrace_ops *op,431 struct ftrace_ops *op,
432 struct pt_regs *pt_regs)432 struct ftrace_regs *fregs)
433{433{
434 /*434 /*
435 * We said we would provide our own recursion. By calling435 * We said we would provide our own recursion. By calling
@@ -548,9 +548,11 @@ static enum { · 112 unmodified lines
548static void trace_selftest_test_regs_func(unsigned long ip,548static void trace_selftest_test_regs_func(unsigned long ip,
549 unsigned long pip,549 unsigned long pip,
550 struct ftrace_ops *op,550 struct ftrace_ops *op,
551 struct pt_regs *pt_regs)551 struct ftrace_regs *fregs)
552{552{
553 if (pt_regs)553 struct pt_regs *regs = ftrace_get_regs(fregs);
554
555 if (regs)
554 trace_selftest_regs_stat = TRACE_SELFTEST_REGS_FOUND;556 trace_selftest_regs_stat = TRACE_SELFTEST_REGS_FOUND;
555 else557 else
556 trace_selftest_regs_stat = TRACE_SELFTEST_REGS_NOT_FOUND;558 trace_selftest_regs_stat = TRACE_SELFTEST_REGS_NOT_FOUND;
kernel/trace/trace_stack.c+1−1
@@ -290,7 +290,7 @@ static void check_stack(unsigned long ip, unsigned long *stack) · 289 unmodified lines
290 290
291static void291static void
292stack_trace_call(unsigned long ip, unsigned long parent_ip,292stack_trace_call(unsigned long ip, unsigned long parent_ip,
293 struct ftrace_ops *op, struct pt_regs *pt_regs)293 struct ftrace_ops *op, struct ftrace_regs *fregs)
294{294{
295 unsigned long stack;295 unsigned long stack;
296 296