split dev_queue
[cor.git] / kernel / trace / ftrace_internal.h
blob0456e0a3dab14374f540ed0473ec8fb1bc4af34d
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_KERNEL_FTRACE_INTERNAL_H
3 #define _LINUX_KERNEL_FTRACE_INTERNAL_H
5 #ifdef CONFIG_FUNCTION_TRACER
7 /*
8 * Traverse the ftrace_global_list, invoking all entries. The reason that we
9 * can use rcu_dereference_raw_check() is that elements removed from this list
10 * are simply leaked, so there is no need to interact with a grace-period
11 * mechanism. The rcu_dereference_raw_check() calls are needed to handle
12 * concurrent insertions into the ftrace_global_list.
14 * Silly Alpha and silly pointer-speculation compiler optimizations!
16 #define do_for_each_ftrace_op(op, list) \
17 op = rcu_dereference_raw_check(list); \
21 * Optimized for just a single item in the list (as that is the normal case).
23 #define while_for_each_ftrace_op(op) \
24 while (likely(op = rcu_dereference_raw_check((op)->next)) && \
25 unlikely((op) != &ftrace_list_end))
27 extern struct ftrace_ops __rcu *ftrace_ops_list;
28 extern struct ftrace_ops ftrace_list_end;
29 extern struct mutex ftrace_lock;
30 extern struct ftrace_ops global_ops;
32 #ifdef CONFIG_DYNAMIC_FTRACE
34 int ftrace_startup(struct ftrace_ops *ops, int command);
35 int ftrace_shutdown(struct ftrace_ops *ops, int command);
36 int ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs);
38 #else /* !CONFIG_DYNAMIC_FTRACE */
40 int __register_ftrace_function(struct ftrace_ops *ops);
41 int __unregister_ftrace_function(struct ftrace_ops *ops);
42 /* Keep as macros so we do not need to define the commands */
43 # define ftrace_startup(ops, command) \
44 ({ \
45 int ___ret = __register_ftrace_function(ops); \
46 if (!___ret) \
47 (ops)->flags |= FTRACE_OPS_FL_ENABLED; \
48 ___ret; \
50 # define ftrace_shutdown(ops, command) \
51 ({ \
52 int ___ret = __unregister_ftrace_function(ops); \
53 if (!___ret) \
54 (ops)->flags &= ~FTRACE_OPS_FL_ENABLED; \
55 ___ret; \
57 static inline int
58 ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs)
60 return 1;
62 #endif /* CONFIG_DYNAMIC_FTRACE */
64 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
65 extern int ftrace_graph_active;
66 void update_function_graph_func(void);
67 #else /* !CONFIG_FUNCTION_GRAPH_TRACER */
68 # define ftrace_graph_active 0
69 static inline void update_function_graph_func(void) { }
70 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
72 #else /* !CONFIG_FUNCTION_TRACER */
73 #endif /* CONFIG_FUNCTION_TRACER */
75 #endif