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_output.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_output.c')
-rw-r--r-- | kernel/trace/trace_output.c | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 491832af9ba1..ea9d3b410c7a 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
@@ -832,13 +832,13 @@ static struct trace_event trace_user_stack_event = { | |||
832 | .binary = trace_special_bin, | 832 | .binary = trace_special_bin, |
833 | }; | 833 | }; |
834 | 834 | ||
835 | /* TRACE_PRINT */ | 835 | /* TRACE_BPRINT */ |
836 | static enum print_line_t | 836 | static enum print_line_t |
837 | trace_print_print(struct trace_iterator *iter, int flags) | 837 | trace_bprint_print(struct trace_iterator *iter, int flags) |
838 | { | 838 | { |
839 | struct trace_entry *entry = iter->ent; | 839 | struct trace_entry *entry = iter->ent; |
840 | struct trace_seq *s = &iter->seq; | 840 | struct trace_seq *s = &iter->seq; |
841 | struct print_entry *field; | 841 | struct bprint_entry *field; |
842 | 842 | ||
843 | trace_assign_type(field, entry); | 843 | trace_assign_type(field, entry); |
844 | 844 | ||
@@ -858,9 +858,10 @@ trace_print_print(struct trace_iterator *iter, int flags) | |||
858 | } | 858 | } |
859 | 859 | ||
860 | 860 | ||
861 | static enum print_line_t trace_print_raw(struct trace_iterator *iter, int flags) | 861 | static enum print_line_t |
862 | trace_bprint_raw(struct trace_iterator *iter, int flags) | ||
862 | { | 863 | { |
863 | struct print_entry *field; | 864 | struct bprint_entry *field; |
864 | struct trace_seq *s = &iter->seq; | 865 | struct trace_seq *s = &iter->seq; |
865 | 866 | ||
866 | trace_assign_type(field, iter->ent); | 867 | trace_assign_type(field, iter->ent); |
@@ -878,12 +879,55 @@ static enum print_line_t trace_print_raw(struct trace_iterator *iter, int flags) | |||
878 | } | 879 | } |
879 | 880 | ||
880 | 881 | ||
882 | static struct trace_event trace_bprint_event = { | ||
883 | .type = TRACE_BPRINT, | ||
884 | .trace = trace_bprint_print, | ||
885 | .raw = trace_bprint_raw, | ||
886 | }; | ||
887 | |||
888 | /* TRACE_PRINT */ | ||
889 | static enum print_line_t trace_print_print(struct trace_iterator *iter, | ||
890 | int flags) | ||
891 | { | ||
892 | struct print_entry *field; | ||
893 | struct trace_seq *s = &iter->seq; | ||
894 | |||
895 | trace_assign_type(field, iter->ent); | ||
896 | |||
897 | if (!seq_print_ip_sym(s, field->ip, flags)) | ||
898 | goto partial; | ||
899 | |||
900 | if (!trace_seq_printf(s, ": %s", field->buf)) | ||
901 | goto partial; | ||
902 | |||
903 | return TRACE_TYPE_HANDLED; | ||
904 | |||
905 | partial: | ||
906 | return TRACE_TYPE_PARTIAL_LINE; | ||
907 | } | ||
908 | |||
909 | static enum print_line_t trace_print_raw(struct trace_iterator *iter, int flags) | ||
910 | { | ||
911 | struct print_entry *field; | ||
912 | |||
913 | trace_assign_type(field, iter->ent); | ||
914 | |||
915 | if (!trace_seq_printf(&iter->seq, "# %lx %s", field->ip, field->buf)) | ||
916 | goto partial; | ||
917 | |||
918 | return TRACE_TYPE_HANDLED; | ||
919 | |||
920 | partial: | ||
921 | return TRACE_TYPE_PARTIAL_LINE; | ||
922 | } | ||
923 | |||
881 | static struct trace_event trace_print_event = { | 924 | static struct trace_event trace_print_event = { |
882 | .type = TRACE_PRINT, | 925 | .type = TRACE_PRINT, |
883 | .trace = trace_print_print, | 926 | .trace = trace_print_print, |
884 | .raw = trace_print_raw, | 927 | .raw = trace_print_raw, |
885 | }; | 928 | }; |
886 | 929 | ||
930 | |||
887 | static struct trace_event *events[] __initdata = { | 931 | static struct trace_event *events[] __initdata = { |
888 | &trace_fn_event, | 932 | &trace_fn_event, |
889 | &trace_ctx_event, | 933 | &trace_ctx_event, |
@@ -891,6 +935,7 @@ static struct trace_event *events[] __initdata = { | |||
891 | &trace_special_event, | 935 | &trace_special_event, |
892 | &trace_stack_event, | 936 | &trace_stack_event, |
893 | &trace_user_stack_event, | 937 | &trace_user_stack_event, |
938 | &trace_bprint_event, | ||
894 | &trace_print_event, | 939 | &trace_print_event, |
895 | NULL | 940 | NULL |
896 | }; | 941 | }; |