diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-03-12 13:24:49 -0400 |
---|---|---|
committer | Steven Rostedt <srostedt@redhat.com> | 2009-03-12 21:15:00 -0400 |
commit | 48ead02030f849d011259244bb4ea9b985479006 (patch) | |
tree | 4500f27dc7eb6567ca79dd03fa94fe9e56fbc316 /kernel/trace/trace.h | |
parent | db526ca329f855510e8ce672332eba3304aed590 (diff) |
tracing/core: bring back raw trace_printk for dynamic formats strings
Impact: fix callsites with dynamic format strings
Since its new binary implementation, trace_printk() internally uses static
containers for the format strings on each callsites. But the value is
assigned once at build time, which means that it can't take dynamic
formats.
So this patch unearthes the raw trace_printk implementation for the callers
that will need trace_printk to be able to carry these dynamic format
strings. The trace_printk() macro will use the appropriate implementation
for each callsite. Most of the time however, the binary implementation will
still be used.
The other impact of this patch is that mmiotrace_printk() will use the old
implementation because it calls the low level trace_vprintk and we can't
guess here whether the format passed in it is dynamic or not.
Some parts of this patch have been written by Steven Rostedt (most notably
the part that chooses the appropriate implementation for each callsites).
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r-- | kernel/trace/trace.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 336324d717f8..cede1ab49d07 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, |
@@ -117,7 +118,7 @@ struct userstack_entry { | |||
117 | /* | 118 | /* |
118 | * trace_printk entry: | 119 | * trace_printk entry: |
119 | */ | 120 | */ |
120 | struct print_entry { | 121 | struct bprint_entry { |
121 | struct trace_entry ent; | 122 | struct trace_entry ent; |
122 | unsigned long ip; | 123 | unsigned long ip; |
123 | int depth; | 124 | int depth; |
@@ -125,6 +126,13 @@ struct print_entry { | |||
125 | u32 buf[]; | 126 | u32 buf[]; |
126 | }; | 127 | }; |
127 | 128 | ||
129 | struct print_entry { | ||
130 | struct trace_entry ent; | ||
131 | unsigned long ip; | ||
132 | int depth; | ||
133 | char buf[]; | ||
134 | }; | ||
135 | |||
128 | #define TRACE_OLD_SIZE 88 | 136 | #define TRACE_OLD_SIZE 88 |
129 | 137 | ||
130 | struct trace_field_cont { | 138 | struct trace_field_cont { |
@@ -286,6 +294,7 @@ extern void __ftrace_bad_type(void); | |||
286 | IF_ASSIGN(var, ent, struct stack_entry, TRACE_STACK); \ | 294 | IF_ASSIGN(var, ent, struct stack_entry, TRACE_STACK); \ |
287 | IF_ASSIGN(var, ent, struct userstack_entry, TRACE_USER_STACK);\ | 295 | IF_ASSIGN(var, ent, struct userstack_entry, TRACE_USER_STACK);\ |
288 | IF_ASSIGN(var, ent, struct print_entry, TRACE_PRINT); \ | 296 | IF_ASSIGN(var, ent, struct print_entry, TRACE_PRINT); \ |
297 | IF_ASSIGN(var, ent, struct bprint_entry, TRACE_BPRINT); \ | ||
289 | IF_ASSIGN(var, ent, struct special_entry, 0); \ | 298 | IF_ASSIGN(var, ent, struct special_entry, 0); \ |
290 | IF_ASSIGN(var, ent, struct trace_mmiotrace_rw, \ | 299 | IF_ASSIGN(var, ent, struct trace_mmiotrace_rw, \ |
291 | TRACE_MMIO_RW); \ | 300 | TRACE_MMIO_RW); \ |
@@ -570,6 +579,8 @@ extern int trace_selftest_startup_branch(struct tracer *trace, | |||
570 | extern void *head_page(struct trace_array_cpu *data); | 579 | extern void *head_page(struct trace_array_cpu *data); |
571 | extern long ns2usecs(cycle_t nsec); | 580 | extern long ns2usecs(cycle_t nsec); |
572 | extern int | 581 | extern int |
582 | trace_vbprintk(unsigned long ip, int depth, const char *fmt, va_list args); | ||
583 | extern int | ||
573 | trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args); | 584 | trace_vprintk(unsigned long ip, int depth, const char *fmt, va_list args); |
574 | 585 | ||
575 | extern unsigned long trace_flags; | 586 | extern unsigned long trace_flags; |