ftrace: remove printks from irqsoff trace
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / ftrace.h
CommitLineData
16444a8a
ACM
1#ifndef _LINUX_FTRACE_H
2#define _LINUX_FTRACE_H
3
4#ifdef CONFIG_FTRACE
5
6#include <linux/linkage.h>
d49dbf33 7#include <linux/fs.h>
16444a8a 8
b0fc494f
SR
9extern int ftrace_enabled;
10extern int
11ftrace_enable_sysctl(struct ctl_table *table, int write,
12 struct file *filp, void __user *buffer, size_t *lenp,
13 loff_t *ppos);
14
16444a8a
ACM
15typedef void (*ftrace_func_t)(unsigned long ip, unsigned long parent_ip);
16
17struct ftrace_ops {
18 ftrace_func_t func;
19 struct ftrace_ops *next;
20};
21
22/*
23 * The ftrace_ops must be a static and should also
24 * be read_mostly. These functions do modify read_mostly variables
25 * so use them sparely. Never free an ftrace_op or modify the
26 * next pointer after it has been registered. Even after unregistering
27 * it, the next pointer may still be used internally.
28 */
29int register_ftrace_function(struct ftrace_ops *ops);
30int unregister_ftrace_function(struct ftrace_ops *ops);
31void clear_ftrace_function(void);
32
33extern void ftrace_stub(unsigned long a0, unsigned long a1);
34extern void mcount(void);
35
36#else /* !CONFIG_FTRACE */
37# define register_ftrace_function(ops) do { } while (0)
38# define unregister_ftrace_function(ops) do { } while (0)
39# define clear_ftrace_function(ops) do { } while (0)
40#endif /* CONFIG_FTRACE */
352ad25a 41
3d083395
SR
42#ifdef CONFIG_DYNAMIC_FTRACE
43# define FTRACE_HASHBITS 10
44# define FTRACE_HASHSIZE (1<<FTRACE_HASHBITS)
45
3c1720f0 46enum {
37ad5084
SR
47 FTRACE_FL_FREE = (1 << 0),
48 FTRACE_FL_FAILED = (1 << 1),
49 FTRACE_FL_FILTER = (1 << 2),
50 FTRACE_FL_ENABLED = (1 << 3),
3c1720f0
SR
51};
52
3d083395
SR
53struct dyn_ftrace {
54 struct hlist_node node;
55 unsigned long ip;
3c1720f0 56 unsigned long flags;
3d083395
SR
57};
58
e1c08bdd 59int ftrace_force_update(void);
77a2b37d 60void ftrace_set_filter(unsigned char *buf, int len, int reset);
e1c08bdd 61
3d083395 62/* defined in arch */
3c1720f0
SR
63extern int ftrace_ip_converted(unsigned long ip);
64extern unsigned char *ftrace_nop_replace(void);
65extern unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr);
d61f82d0
SR
66extern int ftrace_dyn_arch_init(void *data);
67extern int ftrace_mcount_set(unsigned long *data);
3c1720f0
SR
68extern int ftrace_modify_code(unsigned long ip, unsigned char *old_code,
69 unsigned char *new_code);
d61f82d0
SR
70extern int ftrace_update_ftrace_func(ftrace_func_t func);
71extern void ftrace_caller(void);
72extern void ftrace_call(void);
73extern void mcount_call(void);
e1c08bdd 74#else
aeaee8a2
IM
75# define ftrace_force_update() ({ 0; })
76# define ftrace_set_filter(buf, len, reset) do { } while (0)
3d083395 77#endif
352ad25a 78
aeaee8a2
IM
79/* totally disable ftrace - can not re-enable after this */
80void ftrace_kill(void);
81
f43fdad8
IM
82static inline void tracer_disable(void)
83{
84#ifdef CONFIG_FTRACE
85 ftrace_enabled = 0;
86#endif
87}
88
352ad25a
SR
89#ifdef CONFIG_FRAME_POINTER
90/* TODO: need to fix this for ARM */
91# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
92# define CALLER_ADDR1 ((unsigned long)__builtin_return_address(1))
93# define CALLER_ADDR2 ((unsigned long)__builtin_return_address(2))
94# define CALLER_ADDR3 ((unsigned long)__builtin_return_address(3))
95# define CALLER_ADDR4 ((unsigned long)__builtin_return_address(4))
96# define CALLER_ADDR5 ((unsigned long)__builtin_return_address(5))
86387f7e 97# define CALLER_ADDR6 ((unsigned long)__builtin_return_address(6))
352ad25a
SR
98#else
99# define CALLER_ADDR0 ((unsigned long)__builtin_return_address(0))
100# define CALLER_ADDR1 0UL
101# define CALLER_ADDR2 0UL
102# define CALLER_ADDR3 0UL
103# define CALLER_ADDR4 0UL
104# define CALLER_ADDR5 0UL
86387f7e 105# define CALLER_ADDR6 0UL
352ad25a
SR
106#endif
107
81d68a96 108#ifdef CONFIG_IRQSOFF_TRACER
489f1396
IM
109 extern void time_hardirqs_on(unsigned long a0, unsigned long a1);
110 extern void time_hardirqs_off(unsigned long a0, unsigned long a1);
81d68a96
SR
111#else
112# define time_hardirqs_on(a0, a1) do { } while (0)
113# define time_hardirqs_off(a0, a1) do { } while (0)
114#endif
115
6cd8a4bb 116#ifdef CONFIG_PREEMPT_TRACER
489f1396
IM
117 extern void trace_preempt_on(unsigned long a0, unsigned long a1);
118 extern void trace_preempt_off(unsigned long a0, unsigned long a1);
6cd8a4bb
SR
119#else
120# define trace_preempt_on(a0, a1) do { } while (0)
121# define trace_preempt_off(a0, a1) do { } while (0)
122#endif
123
74f4e369
IM
124#ifdef CONFIG_CONTEXT_SWITCH_TRACER
125extern void
126ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3);
127#else
128static inline void
129ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) { }
130#endif
131
16444a8a 132#endif /* _LINUX_FTRACE_H */