diff options
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r-- | kernel/trace/trace.h | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index d80ca0d464d9..f56162806f50 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -20,6 +20,7 @@ enum trace_type { | |||
20 | TRACE_WAKE, | 20 | TRACE_WAKE, |
21 | TRACE_STACK, | 21 | TRACE_STACK, |
22 | TRACE_PRINT, | 22 | TRACE_PRINT, |
23 | TRACE_BPRINT, | ||
23 | TRACE_SPECIAL, | 24 | TRACE_SPECIAL, |
24 | TRACE_MMIO_RW, | 25 | TRACE_MMIO_RW, |
25 | TRACE_MMIO_MAP, | 26 | TRACE_MMIO_MAP, |
@@ -119,7 +120,7 @@ struct userstack_entry { | |||
119 | /* | 120 | /* |
120 | * trace_printk entry: | 121 | * trace_printk entry: |
121 | */ | 122 | */ |
122 | struct print_entry { | 123 | struct bprint_entry { |
123 | struct trace_entry ent; | 124 | struct trace_entry ent; |
124 | unsigned long ip; | 125 | unsigned long ip; |
125 | int depth; | 126 | int depth; |
@@ -127,6 +128,13 @@ struct print_entry { | |||
127 | u32 buf[]; | 128 | u32 buf[]; |
128 | }; | 129 | }; |
129 | 130 | ||
131 | struct print_entry { | ||
132 | struct trace_entry ent; | ||
133 | unsigned long ip; | ||
134 | int depth; | ||
135 | char buf[]; | ||
136 | }; | ||
137 | |||
130 | #define TRACE_OLD_SIZE 88 | 138 | #define TRACE_OLD_SIZE 88 |
131 | 139 | ||
132 | struct trace_field_cont { | 140 | struct trace_field_cont { |
@@ -301,6 +309,7 @@ extern void __ftrace_bad_type(void); | |||
301 | IF_ASSIGN(var, ent, struct stack_entry, TRACE_STACK); \ | 309 | IF_ASSIGN(var, ent, struct stack_entry, TRACE_STACK); \ |
302 | IF_ASSIGN(var, ent, struct userstack_entry, TRACE_USER_STACK);\ | 310 | IF_ASSIGN(var, ent, struct userstack_entry, TRACE_USER_STACK);\ |
303 | IF_ASSIGN(var, ent, struct print_entry, TRACE_PRINT); \ | 311 | IF_ASSIGN(var, ent, struct print_entry, TRACE_PRINT); \ |
312 | IF_ASSIGN(var, ent, struct bprint_entry, TRACE_BPRINT); \ | ||
304 | IF_ASSIGN(var, ent, struct special_entry, 0); \ | 313 | IF_ASSIGN(var, ent, struct special_entry, 0); \ |
305 | IF_ASSIGN(var, ent, struct trace_mmiotrace_rw, \ | 314 | IF_ASSIGN(var, ent, struct trace_mmiotrace_rw, \ |
306 | TRACE_MMIO_RW); \ | 315 | TRACE_MMIO_RW); \ |
@@ -589,6 +598,8 @@ extern int trace_selftest_startup_branch(struct tracer *trace, | |||
589 | extern void *head_page(struct trace_array_cpu *data); | 598 | extern void *head_page(struct trace_array_cpu *data); |
590 | extern long ns2usecs(cycle_t nsec); | 599 | extern long ns2usecs(cycle_t nsec); |
591 | extern int | 600 | extern int |
601 | trace_vbprintk(unsigned long ip, int depth, const char *fmt, va_list args); | ||
602 | extern int | ||
592 | trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args); | 603 | trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args); |
593 | 604 | ||
594 | extern unsigned long trace_flags; | 605 | extern unsigned long trace_flags; |
@@ -756,6 +767,9 @@ static inline void trace_branch_disable(void) | |||
756 | } | 767 | } |
757 | #endif /* CONFIG_BRANCH_TRACER */ | 768 | #endif /* CONFIG_BRANCH_TRACER */ |
758 | 769 | ||
770 | /* set ring buffers to default size if not already done so */ | ||
771 | int tracing_update_buffers(void); | ||
772 | |||
759 | /* trace event type bit fields, not numeric */ | 773 | /* trace event type bit fields, not numeric */ |
760 | enum { | 774 | enum { |
761 | TRACE_EVENT_TYPE_PRINTF = 1, | 775 | TRACE_EVENT_TYPE_PRINTF = 1, |
@@ -778,4 +792,26 @@ void event_trace_printk(unsigned long ip, const char *fmt, ...); | |||
778 | extern struct ftrace_event_call __start_ftrace_events[]; | 792 | extern struct ftrace_event_call __start_ftrace_events[]; |
779 | extern struct ftrace_event_call __stop_ftrace_events[]; | 793 | extern struct ftrace_event_call __stop_ftrace_events[]; |
780 | 794 | ||
795 | extern const char *__start___trace_bprintk_fmt[]; | ||
796 | extern const char *__stop___trace_bprintk_fmt[]; | ||
797 | |||
798 | /* | ||
799 | * The double __builtin_constant_p is because gcc will give us an error | ||
800 | * if we try to allocate the static variable to fmt if it is not a | ||
801 | * constant. Even with the outer if statement optimizing out. | ||
802 | */ | ||
803 | #define event_trace_printk(ip, fmt, args...) \ | ||
804 | do { \ | ||
805 | __trace_printk_check_format(fmt, ##args); \ | ||
806 | tracing_record_cmdline(current); \ | ||
807 | if (__builtin_constant_p(fmt)) { \ | ||
808 | static const char *trace_printk_fmt \ | ||
809 | __attribute__((section("__trace_printk_fmt"))) = \ | ||
810 | __builtin_constant_p(fmt) ? fmt : NULL; \ | ||
811 | \ | ||
812 | __trace_bprintk(ip, trace_printk_fmt, ##args); \ | ||
813 | } else \ | ||
814 | __trace_printk(ip, fmt, ##args); \ | ||
815 | } while (0) | ||
816 | |||
781 | #endif /* _LINUX_KERNEL_TRACE_H */ | 817 | #endif /* _LINUX_KERNEL_TRACE_H */ |