aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_output.c
diff options
context:
space:
mode:
authorRoss Zwisler <ross.zwisler@linux.intel.com>2017-02-22 18:39:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-22 19:41:26 -0500
commitd3213e8fd4b0f18dfd438268ff480406ba743abb (patch)
tree0e0e15ede8380adc8bf69c5845ce22564f75d97e /kernel/trace/trace_output.c
parent37c85961c3f87f2141c84e53df31e59db072fd2e (diff)
tracing: add __print_flags_u64()
Patch series "DAX tracepoints, mm argument simplification", v4. This contains both my DAX tracepoint code and Dave Jiang's MM argument simplifications. Dave's code was written with my tracepoint code as a baseline, so it seemed simplest to keep them together in a single series. This patch (of 7): Add __print_flags_u64() and the helper trace_print_flags_seq_u64() in the same spirit as __print_symbolic_u64() and trace_print_symbols_seq_u64(). These functions allow us to print symbols associated with flags that are 64 bits wide even on 32 bit machines. These will be used by the DAX code so that we can print the flags set in a pfn_t such as PFN_SG_CHAIN, PFN_SG_LAST, PFN_DEV and PFN_MAP. Without this new function I was getting errors like the following when compiling for i386: include/linux/pfn_t.h:13:22: warning: large integer implicitly truncated to unsigned type [-Woverflow] #define PFN_SG_CHAIN (1ULL << (BITS_PER_LONG_LONG - 1)) ^ Link: http://lkml.kernel.org/r/1484085142-2297-2-git-send-email-ross.zwisler@linux.intel.com Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Steven Rostedt <rostedt@goodmis.org> Cc: Dave Chinner <david@fromorbit.com> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Jan Kara <jack@suse.cz> Cc: Matthew Wilcox <mawilcox@microsoft.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/trace/trace_output.c')
-rw-r--r--kernel/trace/trace_output.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index aea6a1218c7d..070866c32eb9 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -124,6 +124,44 @@ EXPORT_SYMBOL(trace_print_symbols_seq);
124 124
125#if BITS_PER_LONG == 32 125#if BITS_PER_LONG == 32
126const char * 126const char *
127trace_print_flags_seq_u64(struct trace_seq *p, const char *delim,
128 unsigned long long flags,
129 const struct trace_print_flags_u64 *flag_array)
130{
131 unsigned long long mask;
132 const char *str;
133 const char *ret = trace_seq_buffer_ptr(p);
134 int i, first = 1;
135
136 for (i = 0; flag_array[i].name && flags; i++) {
137
138 mask = flag_array[i].mask;
139 if ((flags & mask) != mask)
140 continue;
141
142 str = flag_array[i].name;
143 flags &= ~mask;
144 if (!first && delim)
145 trace_seq_puts(p, delim);
146 else
147 first = 0;
148 trace_seq_puts(p, str);
149 }
150
151 /* check for left over flags */
152 if (flags) {
153 if (!first && delim)
154 trace_seq_puts(p, delim);
155 trace_seq_printf(p, "0x%llx", flags);
156 }
157
158 trace_seq_putc(p, 0);
159
160 return ret;
161}
162EXPORT_SYMBOL(trace_print_flags_seq_u64);
163
164const char *
127trace_print_symbols_seq_u64(struct trace_seq *p, unsigned long long val, 165trace_print_symbols_seq_u64(struct trace_seq *p, unsigned long long val,
128 const struct trace_print_flags_u64 *symbol_array) 166 const struct trace_print_flags_u64 *symbol_array)
129{ 167{