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_printk.c | |
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_printk.c')
-rw-r--r-- | kernel/trace/trace_printk.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c index a50aea22e929..f307a11e2332 100644 --- a/kernel/trace/trace_printk.c +++ b/kernel/trace/trace_printk.c | |||
@@ -99,7 +99,7 @@ struct notifier_block module_trace_bprintk_format_nb = { | |||
99 | .notifier_call = module_trace_bprintk_format_notify, | 99 | .notifier_call = module_trace_bprintk_format_notify, |
100 | }; | 100 | }; |
101 | 101 | ||
102 | int __trace_printk(unsigned long ip, const char *fmt, ...) | 102 | int __trace_bprintk(unsigned long ip, const char *fmt, ...) |
103 | { | 103 | { |
104 | int ret; | 104 | int ret; |
105 | va_list ap; | 105 | va_list ap; |
@@ -111,13 +111,13 @@ int __trace_printk(unsigned long ip, const char *fmt, ...) | |||
111 | return 0; | 111 | return 0; |
112 | 112 | ||
113 | va_start(ap, fmt); | 113 | va_start(ap, fmt); |
114 | ret = trace_vprintk(ip, task_curr_ret_stack(current), fmt, ap); | 114 | ret = trace_vbprintk(ip, task_curr_ret_stack(current), fmt, ap); |
115 | va_end(ap); | 115 | va_end(ap); |
116 | return ret; | 116 | return ret; |
117 | } | 117 | } |
118 | EXPORT_SYMBOL_GPL(__trace_printk); | 118 | EXPORT_SYMBOL_GPL(__trace_bprintk); |
119 | 119 | ||
120 | int __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap) | 120 | int __ftrace_vbprintk(unsigned long ip, const char *fmt, va_list ap) |
121 | { | 121 | { |
122 | if (unlikely(!fmt)) | 122 | if (unlikely(!fmt)) |
123 | return 0; | 123 | return 0; |
@@ -125,11 +125,34 @@ int __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap) | |||
125 | if (!(trace_flags & TRACE_ITER_PRINTK)) | 125 | if (!(trace_flags & TRACE_ITER_PRINTK)) |
126 | return 0; | 126 | return 0; |
127 | 127 | ||
128 | return trace_vbprintk(ip, task_curr_ret_stack(current), fmt, ap); | ||
129 | } | ||
130 | EXPORT_SYMBOL_GPL(__ftrace_vbprintk); | ||
131 | |||
132 | int __trace_printk(unsigned long ip, const char *fmt, ...) | ||
133 | { | ||
134 | int ret; | ||
135 | va_list ap; | ||
136 | |||
137 | if (!(trace_flags & TRACE_ITER_PRINTK)) | ||
138 | return 0; | ||
139 | |||
140 | va_start(ap, fmt); | ||
141 | ret = trace_vprintk(ip, task_curr_ret_stack(current), fmt, ap); | ||
142 | va_end(ap); | ||
143 | return ret; | ||
144 | } | ||
145 | EXPORT_SYMBOL_GPL(__trace_printk); | ||
146 | |||
147 | int __ftrace_vprintk(unsigned long ip, const char *fmt, va_list ap) | ||
148 | { | ||
149 | if (!(trace_flags & TRACE_ITER_PRINTK)) | ||
150 | return 0; | ||
151 | |||
128 | return trace_vprintk(ip, task_curr_ret_stack(current), fmt, ap); | 152 | return trace_vprintk(ip, task_curr_ret_stack(current), fmt, ap); |
129 | } | 153 | } |
130 | EXPORT_SYMBOL_GPL(__ftrace_vprintk); | 154 | EXPORT_SYMBOL_GPL(__ftrace_vprintk); |
131 | 155 | ||
132 | |||
133 | static __init int init_trace_printk(void) | 156 | static __init int init_trace_printk(void) |
134 | { | 157 | { |
135 | return register_module_notifier(&module_trace_bprintk_format_nb); | 158 | return register_module_notifier(&module_trace_bprintk_format_nb); |