]>
Commit | Line | Data |
---|---|---|
bc0c38d1 SR |
1 | #ifndef _LINUX_KERNEL_TRACE_H |
2 | #define _LINUX_KERNEL_TRACE_H | |
3 | ||
4 | #include <linux/fs.h> | |
5 | #include <asm/atomic.h> | |
6 | #include <linux/sched.h> | |
7 | #include <linux/clocksource.h> | |
3928a8a2 | 8 | #include <linux/ring_buffer.h> |
bd8ac686 | 9 | #include <linux/mmiotrace.h> |
d13744cd | 10 | #include <linux/ftrace.h> |
3f5ec136 | 11 | #include <trace/boot.h> |
bc0c38d1 | 12 | |
72829bc3 TG |
13 | enum trace_type { |
14 | __TRACE_FIRST_TYPE = 0, | |
15 | ||
16 | TRACE_FN, | |
17 | TRACE_CTX, | |
18 | TRACE_WAKE, | |
dd0e545f | 19 | TRACE_CONT, |
72829bc3 | 20 | TRACE_STACK, |
dd0e545f | 21 | TRACE_PRINT, |
72829bc3 | 22 | TRACE_SPECIAL, |
bd8ac686 PP |
23 | TRACE_MMIO_RW, |
24 | TRACE_MMIO_MAP, | |
74239072 FW |
25 | TRACE_BOOT_CALL, |
26 | TRACE_BOOT_RET, | |
15e6cb36 | 27 | TRACE_FN_RET, |
72829bc3 TG |
28 | |
29 | __TRACE_LAST_TYPE | |
30 | }; | |
31 | ||
777e208d SR |
32 | /* |
33 | * The trace entry - the most basic unit of tracing. This is what | |
34 | * is printed in the end as a single line in the trace output, such as: | |
35 | * | |
36 | * bash-15816 [01] 235.197585: idle_cpu <- irq_enter | |
37 | */ | |
38 | struct trace_entry { | |
39 | unsigned char type; | |
40 | unsigned char cpu; | |
41 | unsigned char flags; | |
42 | unsigned char preempt_count; | |
43 | int pid; | |
44 | }; | |
45 | ||
bc0c38d1 SR |
46 | /* |
47 | * Function trace entry - function address and parent function addres: | |
48 | */ | |
49 | struct ftrace_entry { | |
777e208d | 50 | struct trace_entry ent; |
bc0c38d1 SR |
51 | unsigned long ip; |
52 | unsigned long parent_ip; | |
53 | }; | |
15e6cb36 FW |
54 | |
55 | /* Function return entry */ | |
56 | struct ftrace_ret_entry { | |
57 | struct trace_entry ent; | |
58 | unsigned long ip; | |
59 | unsigned long parent_ip; | |
60 | unsigned long long calltime; | |
61 | unsigned long long rettime; | |
62 | }; | |
d13744cd | 63 | extern struct tracer boot_tracer; |
bc0c38d1 SR |
64 | |
65 | /* | |
66 | * Context switch trace entry - which task (and prio) we switched from/to: | |
67 | */ | |
68 | struct ctx_switch_entry { | |
777e208d | 69 | struct trace_entry ent; |
bc0c38d1 SR |
70 | unsigned int prev_pid; |
71 | unsigned char prev_prio; | |
72 | unsigned char prev_state; | |
73 | unsigned int next_pid; | |
74 | unsigned char next_prio; | |
bac524d3 | 75 | unsigned char next_state; |
80b5e940 | 76 | unsigned int next_cpu; |
bc0c38d1 SR |
77 | }; |
78 | ||
f0a920d5 IM |
79 | /* |
80 | * Special (free-form) trace entry: | |
81 | */ | |
82 | struct special_entry { | |
777e208d | 83 | struct trace_entry ent; |
f0a920d5 IM |
84 | unsigned long arg1; |
85 | unsigned long arg2; | |
86 | unsigned long arg3; | |
87 | }; | |
88 | ||
86387f7e IM |
89 | /* |
90 | * Stack-trace entry: | |
91 | */ | |
92 | ||
74f4e369 | 93 | #define FTRACE_STACK_ENTRIES 8 |
86387f7e IM |
94 | |
95 | struct stack_entry { | |
777e208d | 96 | struct trace_entry ent; |
86387f7e IM |
97 | unsigned long caller[FTRACE_STACK_ENTRIES]; |
98 | }; | |
99 | ||
dd0e545f SR |
100 | /* |
101 | * ftrace_printk entry: | |
102 | */ | |
103 | struct print_entry { | |
777e208d | 104 | struct trace_entry ent; |
dd0e545f SR |
105 | unsigned long ip; |
106 | char buf[]; | |
107 | }; | |
108 | ||
777e208d SR |
109 | #define TRACE_OLD_SIZE 88 |
110 | ||
111 | struct trace_field_cont { | |
112 | unsigned char type; | |
113 | /* Temporary till we get rid of this completely */ | |
114 | char buf[TRACE_OLD_SIZE - 1]; | |
115 | }; | |
116 | ||
117 | struct trace_mmiotrace_rw { | |
118 | struct trace_entry ent; | |
119 | struct mmiotrace_rw rw; | |
120 | }; | |
121 | ||
122 | struct trace_mmiotrace_map { | |
123 | struct trace_entry ent; | |
124 | struct mmiotrace_map map; | |
125 | }; | |
126 | ||
74239072 | 127 | struct trace_boot_call { |
777e208d | 128 | struct trace_entry ent; |
74239072 FW |
129 | struct boot_trace_call boot_call; |
130 | }; | |
131 | ||
132 | struct trace_boot_ret { | |
133 | struct trace_entry ent; | |
134 | struct boot_trace_ret boot_ret; | |
777e208d SR |
135 | }; |
136 | ||
fc5e27ae PP |
137 | /* |
138 | * trace_flag_type is an enumeration that holds different | |
139 | * states when a trace occurs. These are: | |
9244489a SR |
140 | * IRQS_OFF - interrupts were disabled |
141 | * IRQS_NOSUPPORT - arch does not support irqs_disabled_flags | |
142 | * NEED_RESCED - reschedule is requested | |
143 | * HARDIRQ - inside an interrupt handler | |
144 | * SOFTIRQ - inside a softirq handler | |
145 | * CONT - multiple entries hold the trace item | |
fc5e27ae PP |
146 | */ |
147 | enum trace_flag_type { | |
148 | TRACE_FLAG_IRQS_OFF = 0x01, | |
9244489a SR |
149 | TRACE_FLAG_IRQS_NOSUPPORT = 0x02, |
150 | TRACE_FLAG_NEED_RESCHED = 0x04, | |
151 | TRACE_FLAG_HARDIRQ = 0x08, | |
152 | TRACE_FLAG_SOFTIRQ = 0x10, | |
153 | TRACE_FLAG_CONT = 0x20, | |
fc5e27ae PP |
154 | }; |
155 | ||
5bf9a1ee | 156 | #define TRACE_BUF_SIZE 1024 |
bc0c38d1 SR |
157 | |
158 | /* | |
159 | * The CPU trace array - it consists of thousands of trace entries | |
160 | * plus some other descriptor data: (for example which task started | |
161 | * the trace, etc.) | |
162 | */ | |
163 | struct trace_array_cpu { | |
bc0c38d1 | 164 | atomic_t disabled; |
4e3c3333 | 165 | |
c7aafc54 | 166 | /* these fields get copied into max-trace: */ |
c7aafc54 | 167 | unsigned long trace_idx; |
53d0aa77 | 168 | unsigned long overrun; |
bc0c38d1 SR |
169 | unsigned long saved_latency; |
170 | unsigned long critical_start; | |
171 | unsigned long critical_end; | |
172 | unsigned long critical_sequence; | |
173 | unsigned long nice; | |
174 | unsigned long policy; | |
175 | unsigned long rt_priority; | |
176 | cycle_t preempt_timestamp; | |
177 | pid_t pid; | |
178 | uid_t uid; | |
179 | char comm[TASK_COMM_LEN]; | |
180 | }; | |
181 | ||
182 | struct trace_iterator; | |
183 | ||
184 | /* | |
185 | * The trace array - an array of per-CPU trace arrays. This is the | |
186 | * highest level data structure that individual tracers deal with. | |
187 | * They have on/off state as well: | |
188 | */ | |
189 | struct trace_array { | |
3928a8a2 | 190 | struct ring_buffer *buffer; |
bc0c38d1 | 191 | unsigned long entries; |
bc0c38d1 SR |
192 | int cpu; |
193 | cycle_t time_start; | |
b3806b43 | 194 | struct task_struct *waiter; |
bc0c38d1 SR |
195 | struct trace_array_cpu *data[NR_CPUS]; |
196 | }; | |
197 | ||
7104f300 SR |
198 | #define FTRACE_CMP_TYPE(var, type) \ |
199 | __builtin_types_compatible_p(typeof(var), type *) | |
200 | ||
201 | #undef IF_ASSIGN | |
202 | #define IF_ASSIGN(var, entry, etype, id) \ | |
203 | if (FTRACE_CMP_TYPE(var, etype)) { \ | |
204 | var = (typeof(var))(entry); \ | |
205 | WARN_ON(id && (entry)->type != id); \ | |
206 | break; \ | |
207 | } | |
208 | ||
209 | /* Will cause compile errors if type is not found. */ | |
210 | extern void __ftrace_bad_type(void); | |
211 | ||
212 | /* | |
213 | * The trace_assign_type is a verifier that the entry type is | |
214 | * the same as the type being assigned. To add new types simply | |
215 | * add a line with the following format: | |
216 | * | |
217 | * IF_ASSIGN(var, ent, type, id); | |
218 | * | |
219 | * Where "type" is the trace type that includes the trace_entry | |
220 | * as the "ent" item. And "id" is the trace identifier that is | |
221 | * used in the trace_type enum. | |
222 | * | |
223 | * If the type can have more than one id, then use zero. | |
224 | */ | |
225 | #define trace_assign_type(var, ent) \ | |
226 | do { \ | |
227 | IF_ASSIGN(var, ent, struct ftrace_entry, TRACE_FN); \ | |
228 | IF_ASSIGN(var, ent, struct ctx_switch_entry, 0); \ | |
229 | IF_ASSIGN(var, ent, struct trace_field_cont, TRACE_CONT); \ | |
230 | IF_ASSIGN(var, ent, struct stack_entry, TRACE_STACK); \ | |
231 | IF_ASSIGN(var, ent, struct print_entry, TRACE_PRINT); \ | |
232 | IF_ASSIGN(var, ent, struct special_entry, 0); \ | |
233 | IF_ASSIGN(var, ent, struct trace_mmiotrace_rw, \ | |
234 | TRACE_MMIO_RW); \ | |
235 | IF_ASSIGN(var, ent, struct trace_mmiotrace_map, \ | |
236 | TRACE_MMIO_MAP); \ | |
74239072 FW |
237 | IF_ASSIGN(var, ent, struct trace_boot_call, TRACE_BOOT_CALL);\ |
238 | IF_ASSIGN(var, ent, struct trace_boot_ret, TRACE_BOOT_RET);\ | |
239 | IF_ASSIGN(var, ent, struct ftrace_ret_entry, TRACE_FN_RET);\ | |
7104f300 SR |
240 | __ftrace_bad_type(); \ |
241 | } while (0) | |
2c4f035f FW |
242 | |
243 | /* Return values for print_line callback */ | |
244 | enum print_line_t { | |
245 | TRACE_TYPE_PARTIAL_LINE = 0, /* Retry after flushing the seq */ | |
246 | TRACE_TYPE_HANDLED = 1, | |
247 | TRACE_TYPE_UNHANDLED = 2 /* Relay to other output functions */ | |
248 | }; | |
249 | ||
bc0c38d1 SR |
250 | /* |
251 | * A specific tracer, represented by methods that operate on a trace array: | |
252 | */ | |
253 | struct tracer { | |
254 | const char *name; | |
255 | void (*init)(struct trace_array *tr); | |
256 | void (*reset)(struct trace_array *tr); | |
9036990d SR |
257 | void (*start)(struct trace_array *tr); |
258 | void (*stop)(struct trace_array *tr); | |
bc0c38d1 | 259 | void (*open)(struct trace_iterator *iter); |
107bad8b | 260 | void (*pipe_open)(struct trace_iterator *iter); |
bc0c38d1 | 261 | void (*close)(struct trace_iterator *iter); |
107bad8b SR |
262 | ssize_t (*read)(struct trace_iterator *iter, |
263 | struct file *filp, char __user *ubuf, | |
264 | size_t cnt, loff_t *ppos); | |
60a11774 SR |
265 | #ifdef CONFIG_FTRACE_STARTUP_TEST |
266 | int (*selftest)(struct tracer *trace, | |
267 | struct trace_array *tr); | |
268 | #endif | |
2c4f035f | 269 | enum print_line_t (*print_line)(struct trace_iterator *iter); |
bc0c38d1 SR |
270 | struct tracer *next; |
271 | int print_max; | |
272 | }; | |
273 | ||
214023c3 SR |
274 | struct trace_seq { |
275 | unsigned char buffer[PAGE_SIZE]; | |
276 | unsigned int len; | |
6c6c2796 | 277 | unsigned int readpos; |
214023c3 SR |
278 | }; |
279 | ||
bc0c38d1 SR |
280 | /* |
281 | * Trace iterator - used by printout routines who present trace | |
282 | * results to users and which routines might sleep, etc: | |
283 | */ | |
284 | struct trace_iterator { | |
285 | struct trace_array *tr; | |
286 | struct tracer *trace; | |
107bad8b | 287 | void *private; |
3928a8a2 | 288 | struct ring_buffer_iter *buffer_iter[NR_CPUS]; |
4e3c3333 | 289 | |
53d0aa77 SR |
290 | /* The below is zeroed out in pipe_read */ |
291 | struct trace_seq seq; | |
bc0c38d1 | 292 | struct trace_entry *ent; |
4e3c3333 | 293 | int cpu; |
3928a8a2 | 294 | u64 ts; |
4e3c3333 | 295 | |
bc0c38d1 SR |
296 | unsigned long iter_flags; |
297 | loff_t pos; | |
4c11d7ae | 298 | long idx; |
a309720c SR |
299 | |
300 | cpumask_t started; | |
bc0c38d1 SR |
301 | }; |
302 | ||
9036990d | 303 | int tracing_is_enabled(void); |
45dcd8b8 | 304 | void trace_wake_up(void); |
3928a8a2 | 305 | void tracing_reset(struct trace_array *tr, int cpu); |
bc0c38d1 SR |
306 | int tracing_open_generic(struct inode *inode, struct file *filp); |
307 | struct dentry *tracing_init_dentry(void); | |
d618b3e6 IM |
308 | void init_tracer_sysprof_debugfs(struct dentry *d_tracer); |
309 | ||
45dcd8b8 PP |
310 | struct trace_entry *tracing_get_trace_entry(struct trace_array *tr, |
311 | struct trace_array_cpu *data); | |
312 | void tracing_generic_entry_update(struct trace_entry *entry, | |
38697053 SR |
313 | unsigned long flags, |
314 | int pc); | |
45dcd8b8 | 315 | |
bc0c38d1 SR |
316 | void ftrace(struct trace_array *tr, |
317 | struct trace_array_cpu *data, | |
318 | unsigned long ip, | |
319 | unsigned long parent_ip, | |
38697053 | 320 | unsigned long flags, int pc); |
bc0c38d1 SR |
321 | void tracing_sched_switch_trace(struct trace_array *tr, |
322 | struct trace_array_cpu *data, | |
323 | struct task_struct *prev, | |
324 | struct task_struct *next, | |
38697053 | 325 | unsigned long flags, int pc); |
bc0c38d1 | 326 | void tracing_record_cmdline(struct task_struct *tsk); |
57422797 IM |
327 | |
328 | void tracing_sched_wakeup_trace(struct trace_array *tr, | |
329 | struct trace_array_cpu *data, | |
330 | struct task_struct *wakee, | |
331 | struct task_struct *cur, | |
38697053 | 332 | unsigned long flags, int pc); |
f0a920d5 IM |
333 | void trace_special(struct trace_array *tr, |
334 | struct trace_array_cpu *data, | |
335 | unsigned long arg1, | |
336 | unsigned long arg2, | |
38697053 | 337 | unsigned long arg3, int pc); |
6fb44b71 SR |
338 | void trace_function(struct trace_array *tr, |
339 | struct trace_array_cpu *data, | |
340 | unsigned long ip, | |
341 | unsigned long parent_ip, | |
38697053 | 342 | unsigned long flags, int pc); |
15e6cb36 FW |
343 | void |
344 | trace_function_return(struct ftrace_retfunc *trace); | |
bc0c38d1 | 345 | |
41bc8144 SR |
346 | void tracing_start_cmdline_record(void); |
347 | void tracing_stop_cmdline_record(void); | |
e168e051 SR |
348 | void tracing_sched_switch_assign_trace(struct trace_array *tr); |
349 | void tracing_stop_sched_switch_record(void); | |
350 | void tracing_start_sched_switch_record(void); | |
bc0c38d1 SR |
351 | int register_tracer(struct tracer *type); |
352 | void unregister_tracer(struct tracer *type); | |
353 | ||
354 | extern unsigned long nsecs_to_usecs(unsigned long nsecs); | |
355 | ||
356 | extern unsigned long tracing_max_latency; | |
357 | extern unsigned long tracing_thresh; | |
358 | ||
359 | void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu); | |
360 | void update_max_tr_single(struct trace_array *tr, | |
361 | struct task_struct *tsk, int cpu); | |
362 | ||
e309b41d | 363 | extern cycle_t ftrace_now(int cpu); |
bc0c38d1 | 364 | |
606576ce | 365 | #ifdef CONFIG_FUNCTION_TRACER |
001b6767 SR |
366 | void tracing_start_function_trace(void); |
367 | void tracing_stop_function_trace(void); | |
368 | #else | |
369 | # define tracing_start_function_trace() do { } while (0) | |
370 | # define tracing_stop_function_trace() do { } while (0) | |
371 | #endif | |
372 | ||
bc0c38d1 SR |
373 | #ifdef CONFIG_CONTEXT_SWITCH_TRACER |
374 | typedef void | |
375 | (*tracer_switch_func_t)(void *private, | |
5b82a1b0 | 376 | void *__rq, |
bc0c38d1 SR |
377 | struct task_struct *prev, |
378 | struct task_struct *next); | |
379 | ||
380 | struct tracer_switch_ops { | |
381 | tracer_switch_func_t func; | |
382 | void *private; | |
383 | struct tracer_switch_ops *next; | |
384 | }; | |
385 | ||
bc0c38d1 SR |
386 | #endif /* CONFIG_CONTEXT_SWITCH_TRACER */ |
387 | ||
388 | #ifdef CONFIG_DYNAMIC_FTRACE | |
389 | extern unsigned long ftrace_update_tot_cnt; | |
d05cdb25 SR |
390 | #define DYN_FTRACE_TEST_NAME trace_selftest_dynamic_test_func |
391 | extern int DYN_FTRACE_TEST_NAME(void); | |
bc0c38d1 SR |
392 | #endif |
393 | ||
60a11774 | 394 | #ifdef CONFIG_FTRACE_STARTUP_TEST |
60a11774 SR |
395 | extern int trace_selftest_startup_function(struct tracer *trace, |
396 | struct trace_array *tr); | |
60a11774 SR |
397 | extern int trace_selftest_startup_irqsoff(struct tracer *trace, |
398 | struct trace_array *tr); | |
60a11774 SR |
399 | extern int trace_selftest_startup_preemptoff(struct tracer *trace, |
400 | struct trace_array *tr); | |
60a11774 SR |
401 | extern int trace_selftest_startup_preemptirqsoff(struct tracer *trace, |
402 | struct trace_array *tr); | |
60a11774 SR |
403 | extern int trace_selftest_startup_wakeup(struct tracer *trace, |
404 | struct trace_array *tr); | |
fb1b6d8b SN |
405 | extern int trace_selftest_startup_nop(struct tracer *trace, |
406 | struct trace_array *tr); | |
60a11774 SR |
407 | extern int trace_selftest_startup_sched_switch(struct tracer *trace, |
408 | struct trace_array *tr); | |
a6dd24f8 IM |
409 | extern int trace_selftest_startup_sysprof(struct tracer *trace, |
410 | struct trace_array *tr); | |
60a11774 SR |
411 | #endif /* CONFIG_FTRACE_STARTUP_TEST */ |
412 | ||
c7aafc54 | 413 | extern void *head_page(struct trace_array_cpu *data); |
72829bc3 | 414 | extern int trace_seq_printf(struct trace_seq *s, const char *fmt, ...); |
fc5e27ae PP |
415 | extern void trace_seq_print_cont(struct trace_seq *s, |
416 | struct trace_iterator *iter); | |
15e6cb36 FW |
417 | |
418 | extern int | |
419 | seq_print_ip_sym(struct trace_seq *s, unsigned long ip, | |
420 | unsigned long sym_flags); | |
6c6c2796 PP |
421 | extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, |
422 | size_t cnt); | |
72829bc3 | 423 | extern long ns2usecs(cycle_t nsec); |
801fe400 | 424 | extern int trace_vprintk(unsigned long ip, const char *fmt, va_list args); |
c7aafc54 | 425 | |
4e655519 IM |
426 | extern unsigned long trace_flags; |
427 | ||
15e6cb36 FW |
428 | /* Standard output formatting function used for function return traces */ |
429 | #ifdef CONFIG_FUNCTION_RET_TRACER | |
430 | extern enum print_line_t print_return_function(struct trace_iterator *iter); | |
431 | #else | |
432 | static inline enum print_line_t | |
433 | print_return_function(struct trace_iterator *iter) | |
434 | { | |
435 | return TRACE_TYPE_UNHANDLED; | |
436 | } | |
437 | #endif | |
438 | ||
4fcdae83 SR |
439 | /* |
440 | * trace_iterator_flags is an enumeration that defines bit | |
441 | * positions into trace_flags that controls the output. | |
442 | * | |
443 | * NOTE: These bits must match the trace_options array in | |
444 | * trace.c. | |
445 | */ | |
4e655519 IM |
446 | enum trace_iterator_flags { |
447 | TRACE_ITER_PRINT_PARENT = 0x01, | |
448 | TRACE_ITER_SYM_OFFSET = 0x02, | |
449 | TRACE_ITER_SYM_ADDR = 0x04, | |
450 | TRACE_ITER_VERBOSE = 0x08, | |
451 | TRACE_ITER_RAW = 0x10, | |
452 | TRACE_ITER_HEX = 0x20, | |
453 | TRACE_ITER_BIN = 0x40, | |
454 | TRACE_ITER_BLOCK = 0x80, | |
455 | TRACE_ITER_STACKTRACE = 0x100, | |
4ac3ba41 | 456 | TRACE_ITER_SCHED_TREE = 0x200, |
f09ce573 | 457 | TRACE_ITER_PRINTK = 0x400, |
b2a866f9 | 458 | TRACE_ITER_PREEMPTONLY = 0x800, |
4e655519 IM |
459 | }; |
460 | ||
15e6cb36 FW |
461 | /* |
462 | * TRACE_ITER_SYM_MASK masks the options in trace_flags that | |
463 | * control the output of kernel symbols. | |
464 | */ | |
465 | #define TRACE_ITER_SYM_MASK \ | |
466 | (TRACE_ITER_PRINT_PARENT|TRACE_ITER_SYM_OFFSET|TRACE_ITER_SYM_ADDR) | |
467 | ||
43a15386 FW |
468 | extern struct tracer nop_trace; |
469 | ||
8f0a056f SR |
470 | /** |
471 | * ftrace_preempt_disable - disable preemption scheduler safe | |
472 | * | |
473 | * When tracing can happen inside the scheduler, there exists | |
474 | * cases that the tracing might happen before the need_resched | |
475 | * flag is checked. If this happens and the tracer calls | |
476 | * preempt_enable (after a disable), a schedule might take place | |
477 | * causing an infinite recursion. | |
478 | * | |
479 | * To prevent this, we read the need_recshed flag before | |
480 | * disabling preemption. When we want to enable preemption we | |
481 | * check the flag, if it is set, then we call preempt_enable_no_resched. | |
482 | * Otherwise, we call preempt_enable. | |
483 | * | |
484 | * The rational for doing the above is that if need resched is set | |
485 | * and we have yet to reschedule, we are either in an atomic location | |
486 | * (where we do not need to check for scheduling) or we are inside | |
487 | * the scheduler and do not want to resched. | |
488 | */ | |
489 | static inline int ftrace_preempt_disable(void) | |
490 | { | |
491 | int resched; | |
492 | ||
493 | resched = need_resched(); | |
494 | preempt_disable_notrace(); | |
495 | ||
496 | return resched; | |
497 | } | |
498 | ||
499 | /** | |
500 | * ftrace_preempt_enable - enable preemption scheduler safe | |
501 | * @resched: the return value from ftrace_preempt_disable | |
502 | * | |
503 | * This is a scheduler safe way to enable preemption and not miss | |
504 | * any preemption checks. The disabled saved the state of preemption. | |
505 | * If resched is set, then we were either inside an atomic or | |
506 | * are inside the scheduler (we would have already scheduled | |
507 | * otherwise). In this case, we do not want to call normal | |
508 | * preempt_enable, but preempt_enable_no_resched instead. | |
509 | */ | |
510 | static inline void ftrace_preempt_enable(int resched) | |
511 | { | |
512 | if (resched) | |
513 | preempt_enable_no_resched_notrace(); | |
514 | else | |
515 | preempt_enable_notrace(); | |
516 | } | |
517 | ||
bc0c38d1 | 518 | #endif /* _LINUX_KERNEL_TRACE_H */ |