ftrace: Pass ftrace_ops as third parameter to function trace callback
[profile/ivi/kernel-adaptation-intel-automotive.git] / include / linux / ftrace.h
1 /*
2  * Ftrace header.  For implementation details beyond the random comments
3  * scattered below, see: Documentation/trace/ftrace-design.txt
4  */
5
6 #ifndef _LINUX_FTRACE_H
7 #define _LINUX_FTRACE_H
8
9 #include <linux/trace_clock.h>
10 #include <linux/kallsyms.h>
11 #include <linux/linkage.h>
12 #include <linux/bitops.h>
13 #include <linux/ktime.h>
14 #include <linux/sched.h>
15 #include <linux/types.h>
16 #include <linux/init.h>
17 #include <linux/fs.h>
18
19 #include <asm/ftrace.h>
20
21 /*
22  * If the arch supports passing the variable contents of
23  * function_trace_op as the third parameter back from the
24  * mcount call, then the arch should define this as 1.
25  */
26 #ifndef ARCH_SUPPORTS_FTRACE_OPS
27 #define ARCH_SUPPORTS_FTRACE_OPS 0
28 #endif
29
30 struct module;
31 struct ftrace_hash;
32
33 #ifdef CONFIG_FUNCTION_TRACER
34
35 extern int ftrace_enabled;
36 extern int
37 ftrace_enable_sysctl(struct ctl_table *table, int write,
38                      void __user *buffer, size_t *lenp,
39                      loff_t *ppos);
40
41 struct ftrace_ops;
42
43 typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip,
44                               struct ftrace_ops *op);
45
46 /*
47  * FTRACE_OPS_FL_* bits denote the state of ftrace_ops struct and are
48  * set in the flags member.
49  *
50  * ENABLED - set/unset when ftrace_ops is registered/unregistered
51  * GLOBAL  - set manualy by ftrace_ops user to denote the ftrace_ops
52  *           is part of the global tracers sharing the same filter
53  *           via set_ftrace_* debugfs files.
54  * DYNAMIC - set when ftrace_ops is registered to denote dynamically
55  *           allocated ftrace_ops which need special care
56  * CONTROL - set manualy by ftrace_ops user to denote the ftrace_ops
57  *           could be controled by following calls:
58  *             ftrace_function_local_enable
59  *             ftrace_function_local_disable
60  */
61 enum {
62         FTRACE_OPS_FL_ENABLED           = 1 << 0,
63         FTRACE_OPS_FL_GLOBAL            = 1 << 1,
64         FTRACE_OPS_FL_DYNAMIC           = 1 << 2,
65         FTRACE_OPS_FL_CONTROL           = 1 << 3,
66 };
67
68 struct ftrace_ops {
69         ftrace_func_t                   func;
70         struct ftrace_ops               *next;
71         unsigned long                   flags;
72         int __percpu                    *disabled;
73 #ifdef CONFIG_DYNAMIC_FTRACE
74         struct ftrace_hash              *notrace_hash;
75         struct ftrace_hash              *filter_hash;
76 #endif
77 };
78
79 extern int function_trace_stop;
80
81 /*
82  * Type of the current tracing.
83  */
84 enum ftrace_tracing_type_t {
85         FTRACE_TYPE_ENTER = 0, /* Hook the call of the function */
86         FTRACE_TYPE_RETURN,     /* Hook the return of the function */
87 };
88
89 /* Current tracing type, default is FTRACE_TYPE_ENTER */
90 extern enum ftrace_tracing_type_t ftrace_tracing_type;
91
92 /**
93  * ftrace_stop - stop function tracer.
94  *
95  * A quick way to stop the function tracer. Note this an on off switch,
96  * it is not something that is recursive like preempt_disable.
97  * This does not disable the calling of mcount, it only stops the
98  * calling of functions from mcount.
99  */
100 static inline void ftrace_stop(void)
101 {
102         function_trace_stop = 1;
103 }
104
105 /**
106  * ftrace_start - start the function tracer.
107  *
108  * This function is the inverse of ftrace_stop. This does not enable
109  * the function tracing if the function tracer is disabled. This only
110  * sets the function tracer flag to continue calling the functions
111  * from mcount.
112  */
113 static inline void ftrace_start(void)
114 {
115         function_trace_stop = 0;
116 }
117
118 /*
119  * The ftrace_ops must be a static and should also
120  * be read_mostly.  These functions do modify read_mostly variables
121  * so use them sparely. Never free an ftrace_op or modify the
122  * next pointer after it has been registered. Even after unregistering
123  * it, the next pointer may still be used internally.
124  */
125 int register_ftrace_function(struct ftrace_ops *ops);
126 int unregister_ftrace_function(struct ftrace_ops *ops);
127 void clear_ftrace_function(void);
128
129 /**
130  * ftrace_function_local_enable - enable controlled ftrace_ops on current cpu
131  *
132  * This function enables tracing on current cpu by decreasing
133  * the per cpu control variable.
134  * It must be called with preemption disabled and only on ftrace_ops
135  * registered with FTRACE_OPS_FL_CONTROL. If called without preemption
136  * disabled, this_cpu_ptr will complain when CONFIG_DEBUG_PREEMPT is enabled.
137  */
138 static inline void ftrace_function_local_enable(struct ftrace_ops *ops)
139 {
140         if (WARN_ON_ONCE(!(ops->flags & FTRACE_OPS_FL_CONTROL)))
141                 return;
142
143         (*this_cpu_ptr(ops->disabled))--;
144 }
145
146 /**
147  * ftrace_function_local_disable - enable controlled ftrace_ops on current cpu
148  *
149  * This function enables tracing on current cpu by decreasing
150  * the per cpu control variable.
151  * It must be called with preemption disabled and only on ftrace_ops
152  * registered with FTRACE_OPS_FL_CONTROL. If called without preemption
153  * disabled, this_cpu_ptr will complain when CONFIG_DEBUG_PREEMPT is enabled.
154  */
155 static inline void ftrace_function_local_disable(struct ftrace_ops *ops)
156 {
157         if (WARN_ON_ONCE(!(ops->flags & FTRACE_OPS_FL_CONTROL)))
158                 return;
159
160         (*this_cpu_ptr(ops->disabled))++;
161 }
162
163 /**
164  * ftrace_function_local_disabled - returns ftrace_ops disabled value
165  *                                  on current cpu
166  *
167  * This function returns value of ftrace_ops::disabled on current cpu.
168  * It must be called with preemption disabled and only on ftrace_ops
169  * registered with FTRACE_OPS_FL_CONTROL. If called without preemption
170  * disabled, this_cpu_ptr will complain when CONFIG_DEBUG_PREEMPT is enabled.
171  */
172 static inline int ftrace_function_local_disabled(struct ftrace_ops *ops)
173 {
174         WARN_ON_ONCE(!(ops->flags & FTRACE_OPS_FL_CONTROL));
175         return *this_cpu_ptr(ops->disabled);
176 }
177
178 extern void ftrace_stub(unsigned long a0, unsigned long a1, struct ftrace_ops *op);
179
180 #else /* !CONFIG_FUNCTION_TRACER */
181 /*
182  * (un)register_ftrace_function must be a macro since the ops parameter
183  * must not be evaluated.
184  */
185 #define register_ftrace_function(ops) ({ 0; })
186 #define unregister_ftrace_function(ops) ({ 0; })
187 static inline void clear_ftrace_function(void) { }
188 static inline void ftrace_kill(void) { }
189 static inline void ftrace_stop(void) { }
190 static inline void ftrace_start(void) { }
191 #endif /* CONFIG_FUNCTION_TRACER */
192
193 #ifdef CONFIG_STACK_TRACER
194 extern int stack_tracer_enabled;
195 int
196 stack_trace_sysctl(struct ctl_table *table, int write,
197                    void __user *buffer, size_t *lenp,
198                    loff_t *ppos);
199 #endif
200
201 struct ftrace_func_command {
202         struct list_head        list;
203         char                    *name;
204         int                     (*func)(struct ftrace_hash *hash,
205                                         char *func, char *cmd,
206                                         char *params, int enable);
207 };
208
209 #ifdef CONFIG_DYNAMIC_FTRACE
210
211 int ftrace_arch_code_modify_prepare(void);
212 int ftrace_arch_code_modify_post_process(void);
213
214 void ftrace_bug(int err, unsigned long ip);
215
216 struct seq_file;
217
218 struct ftrace_probe_ops {
219         void                    (*func)(unsigned long ip,
220                                         unsigned long parent_ip,
221                                         void **data);
222         int                     (*callback)(unsigned long ip, void **data);
223         void                    (*free)(void **data);
224         int                     (*print)(struct seq_file *m,
225                                          unsigned long ip,
226                                          struct ftrace_probe_ops *ops,
227                                          void *data);
228 };
229
230 extern int
231 register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
232                               void *data);
233 extern void
234 unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,
235                                 void *data);
236 extern void
237 unregister_ftrace_function_probe_func(char *glob, struct ftrace_probe_ops *ops);
238 extern void unregister_ftrace_function_probe_all(char *glob);
239
240 extern int ftrace_text_reserved(void *start, void *end);
241
242 enum {
243         FTRACE_FL_ENABLED       = (1 << 30),
244 };
245
246 #define FTRACE_FL_MASK          (0x3UL << 30)
247 #define FTRACE_REF_MAX          ((1 << 30) - 1)
248
249 struct dyn_ftrace {
250         union {
251                 unsigned long           ip; /* address of mcount call-site */
252                 struct dyn_ftrace       *freelist;
253         };
254         unsigned long           flags;
255         struct dyn_arch_ftrace          arch;
256 };
257
258 int ftrace_force_update(void);
259 int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf,
260                        int len, int reset);
261 int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf,
262                         int len, int reset);
263 void ftrace_set_global_filter(unsigned char *buf, int len, int reset);
264 void ftrace_set_global_notrace(unsigned char *buf, int len, int reset);
265 void ftrace_free_filter(struct ftrace_ops *ops);
266
267 int register_ftrace_command(struct ftrace_func_command *cmd);
268 int unregister_ftrace_command(struct ftrace_func_command *cmd);
269
270 enum {
271         FTRACE_UPDATE_CALLS             = (1 << 0),
272         FTRACE_DISABLE_CALLS            = (1 << 1),
273         FTRACE_UPDATE_TRACE_FUNC        = (1 << 2),
274         FTRACE_START_FUNC_RET           = (1 << 3),
275         FTRACE_STOP_FUNC_RET            = (1 << 4),
276 };
277
278 enum {
279         FTRACE_UPDATE_IGNORE,
280         FTRACE_UPDATE_MAKE_CALL,
281         FTRACE_UPDATE_MAKE_NOP,
282 };
283
284 enum {
285         FTRACE_ITER_FILTER      = (1 << 0),
286         FTRACE_ITER_NOTRACE     = (1 << 1),
287         FTRACE_ITER_PRINTALL    = (1 << 2),
288         FTRACE_ITER_DO_HASH     = (1 << 3),
289         FTRACE_ITER_HASH        = (1 << 4),
290         FTRACE_ITER_ENABLED     = (1 << 5),
291 };
292
293 void arch_ftrace_update_code(int command);
294
295 struct ftrace_rec_iter;
296
297 struct ftrace_rec_iter *ftrace_rec_iter_start(void);
298 struct ftrace_rec_iter *ftrace_rec_iter_next(struct ftrace_rec_iter *iter);
299 struct dyn_ftrace *ftrace_rec_iter_record(struct ftrace_rec_iter *iter);
300
301 #define for_ftrace_rec_iter(iter)               \
302         for (iter = ftrace_rec_iter_start();    \
303              iter;                              \
304              iter = ftrace_rec_iter_next(iter))
305
306
307 int ftrace_update_record(struct dyn_ftrace *rec, int enable);
308 int ftrace_test_record(struct dyn_ftrace *rec, int enable);
309 void ftrace_run_stop_machine(int command);
310 unsigned long ftrace_location(unsigned long ip);
311
312 extern ftrace_func_t ftrace_trace_function;
313
314 int ftrace_regex_open(struct ftrace_ops *ops, int flag,
315                   struct inode *inode, struct file *file);
316 ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf,
317                             size_t cnt, loff_t *ppos);
318 ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
319                              size_t cnt, loff_t *ppos);
320 loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int origin);
321 int ftrace_regex_release(struct inode *inode, struct file *file);
322
323 void __init
324 ftrace_set_early_filter(struct ftrace_ops *ops, char *buf, int enable);
325
326 /* defined in arch */
327 extern int ftrace_ip_converted(unsigned long ip);
328 extern int ftrace_dyn_arch_init(void *data);
329 extern void ftrace_replace_code(int enable);
330 extern int ftrace_update_ftrace_func(ftrace_func_t func);
331 extern void ftrace_caller(void);
332 extern void ftrace_call(void);
333 extern void mcount_call(void);
334
335 void ftrace_modify_all_code(int command);
336
337 #ifndef FTRACE_ADDR
338 #define FTRACE_ADDR ((unsigned long)ftrace_caller)
339 #endif
340 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
341 extern void ftrace_graph_caller(void);
342 extern int ftrace_enable_ftrace_graph_caller(void);
343 extern int ftrace_disable_ftrace_graph_caller(void);
344 #else
345 static inline int ftrace_enable_ftrace_graph_caller(void) { return 0; }
346 static inline int ftrace_disable_ftrace_graph_caller(void) { return 0; }
347 #endif
348
349 /**
350  * ftrace_make_nop - convert code into nop
351  * @mod: module structure if called by module load initialization
352  * @rec: the mcount call site record
353  * @addr: the address that the call site should be calling
354  *
355  * This is a very sensitive operation and great care needs
356  * to be taken by the arch.  The operation should carefully
357  * read the location, check to see if what is read is indeed
358  * what we expect it to be, and then on success of the compare,
359  * it should write to the location.
360  *
361  * The code segment at @rec->ip should be a caller to @addr
362  *
363  * Return must be:
364  *  0 on success
365  *  -EFAULT on error reading the location
366  *  -EINVAL on a failed compare of the contents
367  *  -EPERM  on error writing to the location
368  * Any other value will be considered a failure.
369  */
370 extern int ftrace_make_nop(struct module *mod,
371                            struct dyn_ftrace *rec, unsigned long addr);
372
373 /**
374  * ftrace_make_call - convert a nop call site into a call to addr
375  * @rec: the mcount call site record
376  * @addr: the address that the call site should call
377  *
378  * This is a very sensitive operation and great care needs
379  * to be taken by the arch.  The operation should carefully
380  * read the location, check to see if what is read is indeed
381  * what we expect it to be, and then on success of the compare,
382  * it should write to the location.
383  *
384  * The code segment at @rec->ip should be a nop
385  *
386  * Return must be:
387  *  0 on success
388  *  -EFAULT on error reading the location
389  *  -EINVAL on a failed compare of the contents
390  *  -EPERM  on error writing to the location
391  * Any other value will be considered a failure.
392  */
393 extern int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr);
394
395 /* May be defined in arch */
396 extern int ftrace_arch_read_dyn_info(char *buf, int size);
397
398 extern int skip_trace(unsigned long ip);
399
400 extern void ftrace_disable_daemon(void);
401 extern void ftrace_enable_daemon(void);
402 #else
403 static inline int skip_trace(unsigned long ip) { return 0; }
404 static inline int ftrace_force_update(void) { return 0; }
405 static inline void ftrace_disable_daemon(void) { }
406 static inline void ftrace_enable_daemon(void) { }
407 static inline void ftrace_release_mod(struct module *mod) {}
408 static inline int register_ftrace_command(struct ftrace_func_command *cmd)
409 {
410         return -EINVAL;
411 }
412 static inline int unregister_ftrace_command(char *cmd_name)
413 {
414         return -EINVAL;
415 }
416 static inline int ftrace_text_reserved(void *start, void *end)
417 {
418         return 0;
419 }
420
421 /*
422  * Again users of functions that have ftrace_ops may not
423  * have them defined when ftrace is not enabled, but these
424  * functions may still be called. Use a macro instead of inline.
425  */
426 #define ftrace_regex_open(ops, flag, inod, file) ({ -ENODEV; })
427 #define ftrace_set_early_filter(ops, buf, enable) do { } while (0)
428 #define ftrace_set_filter(ops, buf, len, reset) ({ -ENODEV; })
429 #define ftrace_set_notrace(ops, buf, len, reset) ({ -ENODEV; })
430 #define ftrace_free_filter(ops) do { } while (0)
431
432 static inline ssize_t ftrace_filter_write(struct file *file, const char __user *ubuf,
433                             size_t cnt, loff_t *ppos) { return -ENODEV; }
434 static inline ssize_t ftrace_notrace_write(struct file *file, const char __user *ubuf,
435                              size_t cnt, loff_t *ppos) { return -ENODEV; }
436 static inline loff_t ftrace_regex_lseek(struct file *file, loff_t offset, int origin)
437 {
438         return -ENODEV;
439 }
440 static inline int
441 ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; }
442 #endif /* CONFIG_DYNAMIC_FTRACE */
443
444 /* totally disable ftrace - can not re-enable after this */
445 void ftrace_kill(void);
446
447 static inline void tracer_disable(void)
448 {
449 #ifdef CONFIG_FUNCTION_TRACER
450         ftrace_enabled = 0;
451 #endif
452 }
453
454 /*
455  * Ftrace disable/restore without lock. Some synchronization mechanism
456  * must be used to prevent ftrace_enabled to be changed between
457  * disable/restore.
458  */
459 static inline int __ftrace_enabled_save(void)
460 {
461 #ifdef CONFIG_FUNCTION_TRACER
462         int saved_ftrace_enabled = ftrace_enabled;
463         ftrace_enabled = 0;
464         return saved_ftrace_enabled;
465 #else
466         return 0;
467 #endif
468 }
469
470 static inline void __ftrace_enabled_restore(int enabled)
471 {
472 #ifdef CONFIG_FUNCTION_TRACER
473         ftrace_enabled = enabled;
474 #endif
475 }
476
477 #ifndef HAVE_ARCH_CALLER_ADDR
478 # ifdef CONFIG_FRAME_POINTER
479 #  define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
480 #  define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1))
481 #  define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2))
482 #  define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3))
483 #  define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4))
484 #  define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5))
485 #  define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6))
486 # else
487 #  define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
488 #  define CALLER_ADDR1 0UL
489 #  define CALLER_ADDR2 0UL
490 #  define CALLER_ADDR3 0UL
491 #  define CALLER_ADDR4 0UL
492 #  define CALLER_ADDR5 0UL
493 #  define CALLER_ADDR6 0UL
494 # endif
495 #endif /* ifndef HAVE_ARCH_CALLER_ADDR */
496
497 #ifdef CONFIG_IRQSOFF_TRACER
498   extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
499   extern void time_hardirqs_off(unsigned long a0, unsigned long a1);
500 #else
501   static inline void time_hardirqs_on(unsigned long a0, unsigned long a1) { }
502   static inline void time_hardirqs_off(unsigned long a0, unsigned long a1) { }
503 #endif
504
505 #ifdef CONFIG_PREEMPT_TRACER
506   extern void trace_preempt_on(unsigned long a0, unsigned long a1);
507   extern void trace_preempt_off(unsigned long a0, unsigned long a1);
508 #else
509 /*
510  * Use defines instead of static inlines because some arches will make code out
511  * of the CALLER_ADDR, when we really want these to be a real nop.
512  */
513 # define trace_preempt_on(a0, a1) do { } while (0)
514 # define trace_preempt_off(a0, a1) do { } while (0)
515 #endif
516
517 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
518 extern void ftrace_init(void);
519 #else
520 static inline void ftrace_init(void) { }
521 #endif
522
523 /*
524  * Structure that defines an entry function trace.
525  */
526 struct ftrace_graph_ent {
527         unsigned long func; /* Current function */
528         int depth;
529 };
530
531 /*
532  * Structure that defines a return function trace.
533  */
534 struct ftrace_graph_ret {
535         unsigned long func; /* Current function */
536         unsigned long long calltime;
537         unsigned long long rettime;
538         /* Number of functions that overran the depth limit for current task */
539         unsigned long overrun;
540         int depth;
541 };
542
543 /* Type of the callback handlers for tracing function graph*/
544 typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *); /* return */
545 typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *); /* entry */
546
547 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
548
549 /* for init task */
550 #define INIT_FTRACE_GRAPH               .ret_stack = NULL,
551
552 /*
553  * Stack of return addresses for functions
554  * of a thread.
555  * Used in struct thread_info
556  */
557 struct ftrace_ret_stack {
558         unsigned long ret;
559         unsigned long func;
560         unsigned long long calltime;
561         unsigned long long subtime;
562         unsigned long fp;
563 };
564
565 /*
566  * Primary handler of a function return.
567  * It relays on ftrace_return_to_handler.
568  * Defined in entry_32/64.S
569  */
570 extern void return_to_handler(void);
571
572 extern int
573 ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth,
574                          unsigned long frame_pointer);
575
576 /*
577  * Sometimes we don't want to trace a function with the function
578  * graph tracer but we want them to keep traced by the usual function
579  * tracer if the function graph tracer is not configured.
580  */
581 #define __notrace_funcgraph             notrace
582
583 /*
584  * We want to which function is an entrypoint of a hardirq.
585  * That will help us to put a signal on output.
586  */
587 #define __irq_entry              __attribute__((__section__(".irqentry.text")))
588
589 /* Limits of hardirq entrypoints */
590 extern char __irqentry_text_start[];
591 extern char __irqentry_text_end[];
592
593 #define FTRACE_RETFUNC_DEPTH 50
594 #define FTRACE_RETSTACK_ALLOC_SIZE 32
595 extern int register_ftrace_graph(trace_func_graph_ret_t retfunc,
596                                 trace_func_graph_ent_t entryfunc);
597
598 extern void ftrace_graph_stop(void);
599
600 /* The current handlers in use */
601 extern trace_func_graph_ret_t ftrace_graph_return;
602 extern trace_func_graph_ent_t ftrace_graph_entry;
603
604 extern void unregister_ftrace_graph(void);
605
606 extern void ftrace_graph_init_task(struct task_struct *t);
607 extern void ftrace_graph_exit_task(struct task_struct *t);
608 extern void ftrace_graph_init_idle_task(struct task_struct *t, int cpu);
609
610 static inline int task_curr_ret_stack(struct task_struct *t)
611 {
612         return t->curr_ret_stack;
613 }
614
615 static inline void pause_graph_tracing(void)
616 {
617         atomic_inc(&current->tracing_graph_pause);
618 }
619
620 static inline void unpause_graph_tracing(void)
621 {
622         atomic_dec(&current->tracing_graph_pause);
623 }
624 #else /* !CONFIG_FUNCTION_GRAPH_TRACER */
625
626 #define __notrace_funcgraph
627 #define __irq_entry
628 #define INIT_FTRACE_GRAPH
629
630 static inline void ftrace_graph_init_task(struct task_struct *t) { }
631 static inline void ftrace_graph_exit_task(struct task_struct *t) { }
632 static inline void ftrace_graph_init_idle_task(struct task_struct *t, int cpu) { }
633
634 static inline int register_ftrace_graph(trace_func_graph_ret_t retfunc,
635                           trace_func_graph_ent_t entryfunc)
636 {
637         return -1;
638 }
639 static inline void unregister_ftrace_graph(void) { }
640
641 static inline int task_curr_ret_stack(struct task_struct *tsk)
642 {
643         return -1;
644 }
645
646 static inline void pause_graph_tracing(void) { }
647 static inline void unpause_graph_tracing(void) { }
648 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
649
650 #ifdef CONFIG_TRACING
651
652 /* flags for current->trace */
653 enum {
654         TSK_TRACE_FL_TRACE_BIT  = 0,
655         TSK_TRACE_FL_GRAPH_BIT  = 1,
656 };
657 enum {
658         TSK_TRACE_FL_TRACE      = 1 << TSK_TRACE_FL_TRACE_BIT,
659         TSK_TRACE_FL_GRAPH      = 1 << TSK_TRACE_FL_GRAPH_BIT,
660 };
661
662 static inline void set_tsk_trace_trace(struct task_struct *tsk)
663 {
664         set_bit(TSK_TRACE_FL_TRACE_BIT, &tsk->trace);
665 }
666
667 static inline void clear_tsk_trace_trace(struct task_struct *tsk)
668 {
669         clear_bit(TSK_TRACE_FL_TRACE_BIT, &tsk->trace);
670 }
671
672 static inline int test_tsk_trace_trace(struct task_struct *tsk)
673 {
674         return tsk->trace & TSK_TRACE_FL_TRACE;
675 }
676
677 static inline void set_tsk_trace_graph(struct task_struct *tsk)
678 {
679         set_bit(TSK_TRACE_FL_GRAPH_BIT, &tsk->trace);
680 }
681
682 static inline void clear_tsk_trace_graph(struct task_struct *tsk)
683 {
684         clear_bit(TSK_TRACE_FL_GRAPH_BIT, &tsk->trace);
685 }
686
687 static inline int test_tsk_trace_graph(struct task_struct *tsk)
688 {
689         return tsk->trace & TSK_TRACE_FL_GRAPH;
690 }
691
692 enum ftrace_dump_mode;
693
694 extern enum ftrace_dump_mode ftrace_dump_on_oops;
695
696 #ifdef CONFIG_PREEMPT
697 #define INIT_TRACE_RECURSION            .trace_recursion = 0,
698 #endif
699
700 #endif /* CONFIG_TRACING */
701
702 #ifndef INIT_TRACE_RECURSION
703 #define INIT_TRACE_RECURSION
704 #endif
705
706 #ifdef CONFIG_FTRACE_SYSCALLS
707
708 unsigned long arch_syscall_addr(int nr);
709
710 #endif /* CONFIG_FTRACE_SYSCALLS */
711
712 #endif /* _LINUX_FTRACE_H */