diff options
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r-- | kernel/trace/trace.h | 179 |
1 files changed, 139 insertions, 40 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 4d3d381bfd95..8beff03fda68 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #include <linux/mmiotrace.h> | 9 | #include <linux/mmiotrace.h> |
10 | #include <linux/ftrace.h> | 10 | #include <linux/ftrace.h> |
11 | #include <trace/boot.h> | 11 | #include <trace/boot.h> |
12 | #include <trace/kmemtrace.h> | ||
13 | #include <trace/power.h> | ||
12 | 14 | ||
13 | enum trace_type { | 15 | enum trace_type { |
14 | __TRACE_FIRST_TYPE = 0, | 16 | __TRACE_FIRST_TYPE = 0, |
@@ -16,7 +18,6 @@ enum trace_type { | |||
16 | TRACE_FN, | 18 | TRACE_FN, |
17 | TRACE_CTX, | 19 | TRACE_CTX, |
18 | TRACE_WAKE, | 20 | TRACE_WAKE, |
19 | TRACE_CONT, | ||
20 | TRACE_STACK, | 21 | TRACE_STACK, |
21 | TRACE_PRINT, | 22 | TRACE_PRINT, |
22 | TRACE_SPECIAL, | 23 | TRACE_SPECIAL, |
@@ -29,9 +30,12 @@ enum trace_type { | |||
29 | TRACE_GRAPH_ENT, | 30 | TRACE_GRAPH_ENT, |
30 | TRACE_USER_STACK, | 31 | TRACE_USER_STACK, |
31 | TRACE_HW_BRANCHES, | 32 | TRACE_HW_BRANCHES, |
33 | TRACE_KMEM_ALLOC, | ||
34 | TRACE_KMEM_FREE, | ||
32 | TRACE_POWER, | 35 | TRACE_POWER, |
36 | TRACE_BLK, | ||
33 | 37 | ||
34 | __TRACE_LAST_TYPE | 38 | __TRACE_LAST_TYPE, |
35 | }; | 39 | }; |
36 | 40 | ||
37 | /* | 41 | /* |
@@ -42,7 +46,6 @@ enum trace_type { | |||
42 | */ | 46 | */ |
43 | struct trace_entry { | 47 | struct trace_entry { |
44 | unsigned char type; | 48 | unsigned char type; |
45 | unsigned char cpu; | ||
46 | unsigned char flags; | 49 | unsigned char flags; |
47 | unsigned char preempt_count; | 50 | unsigned char preempt_count; |
48 | int pid; | 51 | int pid; |
@@ -60,13 +63,13 @@ struct ftrace_entry { | |||
60 | 63 | ||
61 | /* Function call entry */ | 64 | /* Function call entry */ |
62 | struct ftrace_graph_ent_entry { | 65 | struct ftrace_graph_ent_entry { |
63 | struct trace_entry ent; | 66 | struct trace_entry ent; |
64 | struct ftrace_graph_ent graph_ent; | 67 | struct ftrace_graph_ent graph_ent; |
65 | }; | 68 | }; |
66 | 69 | ||
67 | /* Function return entry */ | 70 | /* Function return entry */ |
68 | struct ftrace_graph_ret_entry { | 71 | struct ftrace_graph_ret_entry { |
69 | struct trace_entry ent; | 72 | struct trace_entry ent; |
70 | struct ftrace_graph_ret ret; | 73 | struct ftrace_graph_ret ret; |
71 | }; | 74 | }; |
72 | extern struct tracer boot_tracer; | 75 | extern struct tracer boot_tracer; |
@@ -112,7 +115,7 @@ struct userstack_entry { | |||
112 | }; | 115 | }; |
113 | 116 | ||
114 | /* | 117 | /* |
115 | * ftrace_printk entry: | 118 | * trace_printk entry: |
116 | */ | 119 | */ |
117 | struct print_entry { | 120 | struct print_entry { |
118 | struct trace_entry ent; | 121 | struct trace_entry ent; |
@@ -170,6 +173,24 @@ struct trace_power { | |||
170 | struct power_trace state_data; | 173 | struct power_trace state_data; |
171 | }; | 174 | }; |
172 | 175 | ||
176 | struct kmemtrace_alloc_entry { | ||
177 | struct trace_entry ent; | ||
178 | enum kmemtrace_type_id type_id; | ||
179 | unsigned long call_site; | ||
180 | const void *ptr; | ||
181 | size_t bytes_req; | ||
182 | size_t bytes_alloc; | ||
183 | gfp_t gfp_flags; | ||
184 | int node; | ||
185 | }; | ||
186 | |||
187 | struct kmemtrace_free_entry { | ||
188 | struct trace_entry ent; | ||
189 | enum kmemtrace_type_id type_id; | ||
190 | unsigned long call_site; | ||
191 | const void *ptr; | ||
192 | }; | ||
193 | |||
173 | /* | 194 | /* |
174 | * trace_flag_type is an enumeration that holds different | 195 | * trace_flag_type is an enumeration that holds different |
175 | * states when a trace occurs. These are: | 196 | * states when a trace occurs. These are: |
@@ -178,7 +199,6 @@ struct trace_power { | |||
178 | * NEED_RESCED - reschedule is requested | 199 | * NEED_RESCED - reschedule is requested |
179 | * HARDIRQ - inside an interrupt handler | 200 | * HARDIRQ - inside an interrupt handler |
180 | * SOFTIRQ - inside a softirq handler | 201 | * SOFTIRQ - inside a softirq handler |
181 | * CONT - multiple entries hold the trace item | ||
182 | */ | 202 | */ |
183 | enum trace_flag_type { | 203 | enum trace_flag_type { |
184 | TRACE_FLAG_IRQS_OFF = 0x01, | 204 | TRACE_FLAG_IRQS_OFF = 0x01, |
@@ -186,7 +206,6 @@ enum trace_flag_type { | |||
186 | TRACE_FLAG_NEED_RESCHED = 0x04, | 206 | TRACE_FLAG_NEED_RESCHED = 0x04, |
187 | TRACE_FLAG_HARDIRQ = 0x08, | 207 | TRACE_FLAG_HARDIRQ = 0x08, |
188 | TRACE_FLAG_SOFTIRQ = 0x10, | 208 | TRACE_FLAG_SOFTIRQ = 0x10, |
189 | TRACE_FLAG_CONT = 0x20, | ||
190 | }; | 209 | }; |
191 | 210 | ||
192 | #define TRACE_BUF_SIZE 1024 | 211 | #define TRACE_BUF_SIZE 1024 |
@@ -198,6 +217,7 @@ enum trace_flag_type { | |||
198 | */ | 217 | */ |
199 | struct trace_array_cpu { | 218 | struct trace_array_cpu { |
200 | atomic_t disabled; | 219 | atomic_t disabled; |
220 | void *buffer_page; /* ring buffer spare */ | ||
201 | 221 | ||
202 | /* these fields get copied into max-trace: */ | 222 | /* these fields get copied into max-trace: */ |
203 | unsigned long trace_idx; | 223 | unsigned long trace_idx; |
@@ -262,7 +282,6 @@ extern void __ftrace_bad_type(void); | |||
262 | do { \ | 282 | do { \ |
263 | IF_ASSIGN(var, ent, struct ftrace_entry, TRACE_FN); \ | 283 | IF_ASSIGN(var, ent, struct ftrace_entry, TRACE_FN); \ |
264 | IF_ASSIGN(var, ent, struct ctx_switch_entry, 0); \ | 284 | IF_ASSIGN(var, ent, struct ctx_switch_entry, 0); \ |
265 | IF_ASSIGN(var, ent, struct trace_field_cont, TRACE_CONT); \ | ||
266 | IF_ASSIGN(var, ent, struct stack_entry, TRACE_STACK); \ | 285 | IF_ASSIGN(var, ent, struct stack_entry, TRACE_STACK); \ |
267 | IF_ASSIGN(var, ent, struct userstack_entry, TRACE_USER_STACK);\ | 286 | IF_ASSIGN(var, ent, struct userstack_entry, TRACE_USER_STACK);\ |
268 | IF_ASSIGN(var, ent, struct print_entry, TRACE_PRINT); \ | 287 | IF_ASSIGN(var, ent, struct print_entry, TRACE_PRINT); \ |
@@ -280,6 +299,10 @@ extern void __ftrace_bad_type(void); | |||
280 | TRACE_GRAPH_RET); \ | 299 | TRACE_GRAPH_RET); \ |
281 | IF_ASSIGN(var, ent, struct hw_branch_entry, TRACE_HW_BRANCHES);\ | 300 | IF_ASSIGN(var, ent, struct hw_branch_entry, TRACE_HW_BRANCHES);\ |
282 | IF_ASSIGN(var, ent, struct trace_power, TRACE_POWER); \ | 301 | IF_ASSIGN(var, ent, struct trace_power, TRACE_POWER); \ |
302 | IF_ASSIGN(var, ent, struct kmemtrace_alloc_entry, \ | ||
303 | TRACE_KMEM_ALLOC); \ | ||
304 | IF_ASSIGN(var, ent, struct kmemtrace_free_entry, \ | ||
305 | TRACE_KMEM_FREE); \ | ||
283 | __ftrace_bad_type(); \ | 306 | __ftrace_bad_type(); \ |
284 | } while (0) | 307 | } while (0) |
285 | 308 | ||
@@ -287,7 +310,8 @@ extern void __ftrace_bad_type(void); | |||
287 | enum print_line_t { | 310 | enum print_line_t { |
288 | TRACE_TYPE_PARTIAL_LINE = 0, /* Retry after flushing the seq */ | 311 | TRACE_TYPE_PARTIAL_LINE = 0, /* Retry after flushing the seq */ |
289 | TRACE_TYPE_HANDLED = 1, | 312 | TRACE_TYPE_HANDLED = 1, |
290 | TRACE_TYPE_UNHANDLED = 2 /* Relay to other output functions */ | 313 | TRACE_TYPE_UNHANDLED = 2, /* Relay to other output functions */ |
314 | TRACE_TYPE_NO_CONSUME = 3 /* Handled but ask to not consume */ | ||
291 | }; | 315 | }; |
292 | 316 | ||
293 | 317 | ||
@@ -313,22 +337,45 @@ struct tracer_flags { | |||
313 | /* Makes more easy to define a tracer opt */ | 337 | /* Makes more easy to define a tracer opt */ |
314 | #define TRACER_OPT(s, b) .name = #s, .bit = b | 338 | #define TRACER_OPT(s, b) .name = #s, .bit = b |
315 | 339 | ||
316 | /* | 340 | |
317 | * A specific tracer, represented by methods that operate on a trace array: | 341 | /** |
342 | * struct tracer - a specific tracer and its callbacks to interact with debugfs | ||
343 | * @name: the name chosen to select it on the available_tracers file | ||
344 | * @init: called when one switches to this tracer (echo name > current_tracer) | ||
345 | * @reset: called when one switches to another tracer | ||
346 | * @start: called when tracing is unpaused (echo 1 > tracing_enabled) | ||
347 | * @stop: called when tracing is paused (echo 0 > tracing_enabled) | ||
348 | * @open: called when the trace file is opened | ||
349 | * @pipe_open: called when the trace_pipe file is opened | ||
350 | * @wait_pipe: override how the user waits for traces on trace_pipe | ||
351 | * @close: called when the trace file is released | ||
352 | * @read: override the default read callback on trace_pipe | ||
353 | * @splice_read: override the default splice_read callback on trace_pipe | ||
354 | * @selftest: selftest to run on boot (see trace_selftest.c) | ||
355 | * @print_headers: override the first lines that describe your columns | ||
356 | * @print_line: callback that prints a trace | ||
357 | * @set_flag: signals one of your private flags changed (trace_options file) | ||
358 | * @flags: your private flags | ||
318 | */ | 359 | */ |
319 | struct tracer { | 360 | struct tracer { |
320 | const char *name; | 361 | const char *name; |
321 | /* Your tracer should raise a warning if init fails */ | ||
322 | int (*init)(struct trace_array *tr); | 362 | int (*init)(struct trace_array *tr); |
323 | void (*reset)(struct trace_array *tr); | 363 | void (*reset)(struct trace_array *tr); |
324 | void (*start)(struct trace_array *tr); | 364 | void (*start)(struct trace_array *tr); |
325 | void (*stop)(struct trace_array *tr); | 365 | void (*stop)(struct trace_array *tr); |
326 | void (*open)(struct trace_iterator *iter); | 366 | void (*open)(struct trace_iterator *iter); |
327 | void (*pipe_open)(struct trace_iterator *iter); | 367 | void (*pipe_open)(struct trace_iterator *iter); |
368 | void (*wait_pipe)(struct trace_iterator *iter); | ||
328 | void (*close)(struct trace_iterator *iter); | 369 | void (*close)(struct trace_iterator *iter); |
329 | ssize_t (*read)(struct trace_iterator *iter, | 370 | ssize_t (*read)(struct trace_iterator *iter, |
330 | struct file *filp, char __user *ubuf, | 371 | struct file *filp, char __user *ubuf, |
331 | size_t cnt, loff_t *ppos); | 372 | size_t cnt, loff_t *ppos); |
373 | ssize_t (*splice_read)(struct trace_iterator *iter, | ||
374 | struct file *filp, | ||
375 | loff_t *ppos, | ||
376 | struct pipe_inode_info *pipe, | ||
377 | size_t len, | ||
378 | unsigned int flags); | ||
332 | #ifdef CONFIG_FTRACE_STARTUP_TEST | 379 | #ifdef CONFIG_FTRACE_STARTUP_TEST |
333 | int (*selftest)(struct tracer *trace, | 380 | int (*selftest)(struct tracer *trace, |
334 | struct trace_array *tr); | 381 | struct trace_array *tr); |
@@ -340,6 +387,7 @@ struct tracer { | |||
340 | struct tracer *next; | 387 | struct tracer *next; |
341 | int print_max; | 388 | int print_max; |
342 | struct tracer_flags *flags; | 389 | struct tracer_flags *flags; |
390 | struct tracer_stat *stats; | ||
343 | }; | 391 | }; |
344 | 392 | ||
345 | struct trace_seq { | 393 | struct trace_seq { |
@@ -348,6 +396,16 @@ struct trace_seq { | |||
348 | unsigned int readpos; | 396 | unsigned int readpos; |
349 | }; | 397 | }; |
350 | 398 | ||
399 | static inline void | ||
400 | trace_seq_init(struct trace_seq *s) | ||
401 | { | ||
402 | s->len = 0; | ||
403 | s->readpos = 0; | ||
404 | } | ||
405 | |||
406 | |||
407 | #define TRACE_PIPE_ALL_CPU -1 | ||
408 | |||
351 | /* | 409 | /* |
352 | * Trace iterator - used by printout routines who present trace | 410 | * Trace iterator - used by printout routines who present trace |
353 | * results to users and which routines might sleep, etc: | 411 | * results to users and which routines might sleep, etc: |
@@ -356,6 +414,8 @@ struct trace_iterator { | |||
356 | struct trace_array *tr; | 414 | struct trace_array *tr; |
357 | struct tracer *trace; | 415 | struct tracer *trace; |
358 | void *private; | 416 | void *private; |
417 | int cpu_file; | ||
418 | struct mutex mutex; | ||
359 | struct ring_buffer_iter *buffer_iter[NR_CPUS]; | 419 | struct ring_buffer_iter *buffer_iter[NR_CPUS]; |
360 | 420 | ||
361 | /* The below is zeroed out in pipe_read */ | 421 | /* The below is zeroed out in pipe_read */ |
@@ -371,6 +431,7 @@ struct trace_iterator { | |||
371 | cpumask_var_t started; | 431 | cpumask_var_t started; |
372 | }; | 432 | }; |
373 | 433 | ||
434 | int tracer_init(struct tracer *t, struct trace_array *tr); | ||
374 | int tracing_is_enabled(void); | 435 | int tracing_is_enabled(void); |
375 | void trace_wake_up(void); | 436 | void trace_wake_up(void); |
376 | void tracing_reset(struct trace_array *tr, int cpu); | 437 | void tracing_reset(struct trace_array *tr, int cpu); |
@@ -379,26 +440,48 @@ int tracing_open_generic(struct inode *inode, struct file *filp); | |||
379 | struct dentry *tracing_init_dentry(void); | 440 | struct dentry *tracing_init_dentry(void); |
380 | void init_tracer_sysprof_debugfs(struct dentry *d_tracer); | 441 | void init_tracer_sysprof_debugfs(struct dentry *d_tracer); |
381 | 442 | ||
443 | struct ring_buffer_event; | ||
444 | |||
445 | struct ring_buffer_event *trace_buffer_lock_reserve(struct trace_array *tr, | ||
446 | unsigned char type, | ||
447 | unsigned long len, | ||
448 | unsigned long flags, | ||
449 | int pc); | ||
450 | void trace_buffer_unlock_commit(struct trace_array *tr, | ||
451 | struct ring_buffer_event *event, | ||
452 | unsigned long flags, int pc); | ||
453 | |||
454 | struct ring_buffer_event * | ||
455 | trace_current_buffer_lock_reserve(unsigned char type, unsigned long len, | ||
456 | unsigned long flags, int pc); | ||
457 | void trace_current_buffer_unlock_commit(struct ring_buffer_event *event, | ||
458 | unsigned long flags, int pc); | ||
459 | |||
382 | struct trace_entry *tracing_get_trace_entry(struct trace_array *tr, | 460 | struct trace_entry *tracing_get_trace_entry(struct trace_array *tr, |
383 | struct trace_array_cpu *data); | 461 | struct trace_array_cpu *data); |
462 | |||
463 | struct trace_entry *trace_find_next_entry(struct trace_iterator *iter, | ||
464 | int *ent_cpu, u64 *ent_ts); | ||
465 | |||
384 | void tracing_generic_entry_update(struct trace_entry *entry, | 466 | void tracing_generic_entry_update(struct trace_entry *entry, |
385 | unsigned long flags, | 467 | unsigned long flags, |
386 | int pc); | 468 | int pc); |
387 | 469 | ||
470 | void default_wait_pipe(struct trace_iterator *iter); | ||
471 | void poll_wait_pipe(struct trace_iterator *iter); | ||
472 | |||
388 | void ftrace(struct trace_array *tr, | 473 | void ftrace(struct trace_array *tr, |
389 | struct trace_array_cpu *data, | 474 | struct trace_array_cpu *data, |
390 | unsigned long ip, | 475 | unsigned long ip, |
391 | unsigned long parent_ip, | 476 | unsigned long parent_ip, |
392 | unsigned long flags, int pc); | 477 | unsigned long flags, int pc); |
393 | void tracing_sched_switch_trace(struct trace_array *tr, | 478 | void tracing_sched_switch_trace(struct trace_array *tr, |
394 | struct trace_array_cpu *data, | ||
395 | struct task_struct *prev, | 479 | struct task_struct *prev, |
396 | struct task_struct *next, | 480 | struct task_struct *next, |
397 | unsigned long flags, int pc); | 481 | unsigned long flags, int pc); |
398 | void tracing_record_cmdline(struct task_struct *tsk); | 482 | void tracing_record_cmdline(struct task_struct *tsk); |
399 | 483 | ||
400 | void tracing_sched_wakeup_trace(struct trace_array *tr, | 484 | void tracing_sched_wakeup_trace(struct trace_array *tr, |
401 | struct trace_array_cpu *data, | ||
402 | struct task_struct *wakee, | 485 | struct task_struct *wakee, |
403 | struct task_struct *cur, | 486 | struct task_struct *cur, |
404 | unsigned long flags, int pc); | 487 | unsigned long flags, int pc); |
@@ -408,14 +491,12 @@ void trace_special(struct trace_array *tr, | |||
408 | unsigned long arg2, | 491 | unsigned long arg2, |
409 | unsigned long arg3, int pc); | 492 | unsigned long arg3, int pc); |
410 | void trace_function(struct trace_array *tr, | 493 | void trace_function(struct trace_array *tr, |
411 | struct trace_array_cpu *data, | ||
412 | unsigned long ip, | 494 | unsigned long ip, |
413 | unsigned long parent_ip, | 495 | unsigned long parent_ip, |
414 | unsigned long flags, int pc); | 496 | unsigned long flags, int pc); |
415 | 497 | ||
416 | void trace_graph_return(struct ftrace_graph_ret *trace); | 498 | void trace_graph_return(struct ftrace_graph_ret *trace); |
417 | int trace_graph_entry(struct ftrace_graph_ent *trace); | 499 | int trace_graph_entry(struct ftrace_graph_ent *trace); |
418 | void trace_hw_branch(struct trace_array *tr, u64 from, u64 to); | ||
419 | 500 | ||
420 | void tracing_start_cmdline_record(void); | 501 | void tracing_start_cmdline_record(void); |
421 | void tracing_stop_cmdline_record(void); | 502 | void tracing_stop_cmdline_record(void); |
@@ -434,15 +515,11 @@ void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu); | |||
434 | void update_max_tr_single(struct trace_array *tr, | 515 | void update_max_tr_single(struct trace_array *tr, |
435 | struct task_struct *tsk, int cpu); | 516 | struct task_struct *tsk, int cpu); |
436 | 517 | ||
437 | extern cycle_t ftrace_now(int cpu); | 518 | void __trace_stack(struct trace_array *tr, |
519 | unsigned long flags, | ||
520 | int skip, int pc); | ||
438 | 521 | ||
439 | #ifdef CONFIG_FUNCTION_TRACER | 522 | extern cycle_t ftrace_now(int cpu); |
440 | void tracing_start_function_trace(void); | ||
441 | void tracing_stop_function_trace(void); | ||
442 | #else | ||
443 | # define tracing_start_function_trace() do { } while (0) | ||
444 | # define tracing_stop_function_trace() do { } while (0) | ||
445 | #endif | ||
446 | 523 | ||
447 | #ifdef CONFIG_CONTEXT_SWITCH_TRACER | 524 | #ifdef CONFIG_CONTEXT_SWITCH_TRACER |
448 | typedef void | 525 | typedef void |
@@ -456,10 +533,10 @@ struct tracer_switch_ops { | |||
456 | void *private; | 533 | void *private; |
457 | struct tracer_switch_ops *next; | 534 | struct tracer_switch_ops *next; |
458 | }; | 535 | }; |
459 | |||
460 | char *trace_find_cmdline(int pid); | ||
461 | #endif /* CONFIG_CONTEXT_SWITCH_TRACER */ | 536 | #endif /* CONFIG_CONTEXT_SWITCH_TRACER */ |
462 | 537 | ||
538 | extern char *trace_find_cmdline(int pid); | ||
539 | |||
463 | #ifdef CONFIG_DYNAMIC_FTRACE | 540 | #ifdef CONFIG_DYNAMIC_FTRACE |
464 | extern unsigned long ftrace_update_tot_cnt; | 541 | extern unsigned long ftrace_update_tot_cnt; |
465 | #define DYN_FTRACE_TEST_NAME trace_selftest_dynamic_test_func | 542 | #define DYN_FTRACE_TEST_NAME trace_selftest_dynamic_test_func |
@@ -469,6 +546,8 @@ extern int DYN_FTRACE_TEST_NAME(void); | |||
469 | #ifdef CONFIG_FTRACE_STARTUP_TEST | 546 | #ifdef CONFIG_FTRACE_STARTUP_TEST |
470 | extern int trace_selftest_startup_function(struct tracer *trace, | 547 | extern int trace_selftest_startup_function(struct tracer *trace, |
471 | struct trace_array *tr); | 548 | struct trace_array *tr); |
549 | extern int trace_selftest_startup_function_graph(struct tracer *trace, | ||
550 | struct trace_array *tr); | ||
472 | extern int trace_selftest_startup_irqsoff(struct tracer *trace, | 551 | extern int trace_selftest_startup_irqsoff(struct tracer *trace, |
473 | struct trace_array *tr); | 552 | struct trace_array *tr); |
474 | extern int trace_selftest_startup_preemptoff(struct tracer *trace, | 553 | extern int trace_selftest_startup_preemptoff(struct tracer *trace, |
@@ -488,15 +567,6 @@ extern int trace_selftest_startup_branch(struct tracer *trace, | |||
488 | #endif /* CONFIG_FTRACE_STARTUP_TEST */ | 567 | #endif /* CONFIG_FTRACE_STARTUP_TEST */ |
489 | 568 | ||
490 | extern void *head_page(struct trace_array_cpu *data); | 569 | extern void *head_page(struct trace_array_cpu *data); |
491 | extern int trace_seq_printf(struct trace_seq *s, const char *fmt, ...); | ||
492 | extern void trace_seq_print_cont(struct trace_seq *s, | ||
493 | struct trace_iterator *iter); | ||
494 | |||
495 | extern int | ||
496 | seq_print_ip_sym(struct trace_seq *s, unsigned long ip, | ||
497 | unsigned long sym_flags); | ||
498 | extern ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, | ||
499 | size_t cnt); | ||
500 | extern long ns2usecs(cycle_t nsec); | 570 | extern long ns2usecs(cycle_t nsec); |
501 | extern int | 571 | extern int |
502 | trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args); | 572 | trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args); |
@@ -580,7 +650,9 @@ enum trace_iterator_flags { | |||
580 | TRACE_ITER_ANNOTATE = 0x2000, | 650 | TRACE_ITER_ANNOTATE = 0x2000, |
581 | TRACE_ITER_USERSTACKTRACE = 0x4000, | 651 | TRACE_ITER_USERSTACKTRACE = 0x4000, |
582 | TRACE_ITER_SYM_USEROBJ = 0x8000, | 652 | TRACE_ITER_SYM_USEROBJ = 0x8000, |
583 | TRACE_ITER_PRINTK_MSGONLY = 0x10000 | 653 | TRACE_ITER_PRINTK_MSGONLY = 0x10000, |
654 | TRACE_ITER_CONTEXT_INFO = 0x20000, /* Print pid/cpu/time */ | ||
655 | TRACE_ITER_LATENCY_FMT = 0x40000, | ||
584 | }; | 656 | }; |
585 | 657 | ||
586 | /* | 658 | /* |
@@ -601,12 +673,12 @@ extern struct tracer nop_trace; | |||
601 | * preempt_enable (after a disable), a schedule might take place | 673 | * preempt_enable (after a disable), a schedule might take place |
602 | * causing an infinite recursion. | 674 | * causing an infinite recursion. |
603 | * | 675 | * |
604 | * To prevent this, we read the need_recshed flag before | 676 | * To prevent this, we read the need_resched flag before |
605 | * disabling preemption. When we want to enable preemption we | 677 | * disabling preemption. When we want to enable preemption we |
606 | * check the flag, if it is set, then we call preempt_enable_no_resched. | 678 | * check the flag, if it is set, then we call preempt_enable_no_resched. |
607 | * Otherwise, we call preempt_enable. | 679 | * Otherwise, we call preempt_enable. |
608 | * | 680 | * |
609 | * The rational for doing the above is that if need resched is set | 681 | * The rational for doing the above is that if need_resched is set |
610 | * and we have yet to reschedule, we are either in an atomic location | 682 | * and we have yet to reschedule, we are either in an atomic location |
611 | * (where we do not need to check for scheduling) or we are inside | 683 | * (where we do not need to check for scheduling) or we are inside |
612 | * the scheduler and do not want to resched. | 684 | * the scheduler and do not want to resched. |
@@ -627,7 +699,7 @@ static inline int ftrace_preempt_disable(void) | |||
627 | * | 699 | * |
628 | * This is a scheduler safe way to enable preemption and not miss | 700 | * This is a scheduler safe way to enable preemption and not miss |
629 | * any preemption checks. The disabled saved the state of preemption. | 701 | * any preemption checks. The disabled saved the state of preemption. |
630 | * If resched is set, then we were either inside an atomic or | 702 | * If resched is set, then we are either inside an atomic or |
631 | * are inside the scheduler (we would have already scheduled | 703 | * are inside the scheduler (we would have already scheduled |
632 | * otherwise). In this case, we do not want to call normal | 704 | * otherwise). In this case, we do not want to call normal |
633 | * preempt_enable, but preempt_enable_no_resched instead. | 705 | * preempt_enable, but preempt_enable_no_resched instead. |
@@ -664,4 +736,31 @@ static inline void trace_branch_disable(void) | |||
664 | } | 736 | } |
665 | #endif /* CONFIG_BRANCH_TRACER */ | 737 | #endif /* CONFIG_BRANCH_TRACER */ |
666 | 738 | ||
739 | /* trace event type bit fields, not numeric */ | ||
740 | enum { | ||
741 | TRACE_EVENT_TYPE_PRINTF = 1, | ||
742 | TRACE_EVENT_TYPE_RAW = 2, | ||
743 | }; | ||
744 | |||
745 | struct ftrace_event_call { | ||
746 | char *name; | ||
747 | char *system; | ||
748 | struct dentry *dir; | ||
749 | int enabled; | ||
750 | int (*regfunc)(void); | ||
751 | void (*unregfunc)(void); | ||
752 | int id; | ||
753 | struct dentry *raw_dir; | ||
754 | int raw_enabled; | ||
755 | int type; | ||
756 | int (*raw_init)(void); | ||
757 | int (*raw_reg)(void); | ||
758 | void (*raw_unreg)(void); | ||
759 | int (*show_format)(struct trace_seq *s); | ||
760 | }; | ||
761 | |||
762 | void event_trace_printk(unsigned long ip, const char *fmt, ...); | ||
763 | extern struct ftrace_event_call __start_ftrace_events[]; | ||
764 | extern struct ftrace_event_call __stop_ftrace_events[]; | ||
765 | |||
667 | #endif /* _LINUX_KERNEL_TRACE_H */ | 766 | #endif /* _LINUX_KERNEL_TRACE_H */ |