diff options
author | Theodore Ts'o <tytso@mit.edu> | 2013-10-03 12:02:37 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-10-10 14:32:23 -0400 |
commit | f80bbd8b92987f55f26691cd53785c4a54622eb0 (patch) | |
tree | 390c761123de9fe3784c147a01be2f3be8f7b7e0 /include/trace/events | |
parent | 6265e169cd313d6f3aad3c33d0a5b0d9624f69f5 (diff) |
random: convert DEBUG_ENT to tracepoints
Instead of using the random driver's ad-hoc DEBUG_ENT() mechanism, use
tracepoints instead. This allows for a much more fine-grained control
of which debugging mechanism which a developer might need, and unifies
the debugging messages with all of the existing tracepoints.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'include/trace/events')
-rw-r--r-- | include/trace/events/random.h | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/include/trace/events/random.h b/include/trace/events/random.h index 527b5dc1b416..805af6db41cc 100644 --- a/include/trace/events/random.h +++ b/include/trace/events/random.h | |||
@@ -109,6 +109,89 @@ TRACE_EVENT(push_to_pool, | |||
109 | __entry->input_bits) | 109 | __entry->input_bits) |
110 | ); | 110 | ); |
111 | 111 | ||
112 | TRACE_EVENT(debit_entropy, | ||
113 | TP_PROTO(const char *pool_name, int debit_bits), | ||
114 | |||
115 | TP_ARGS(pool_name, debit_bits), | ||
116 | |||
117 | TP_STRUCT__entry( | ||
118 | __field( const char *, pool_name ) | ||
119 | __field( int, debit_bits ) | ||
120 | ), | ||
121 | |||
122 | TP_fast_assign( | ||
123 | __entry->pool_name = pool_name; | ||
124 | __entry->debit_bits = debit_bits; | ||
125 | ), | ||
126 | |||
127 | TP_printk("%s: debit_bits %d", __entry->pool_name, | ||
128 | __entry->debit_bits) | ||
129 | ); | ||
130 | |||
131 | TRACE_EVENT(add_input_randomness, | ||
132 | TP_PROTO(int input_bits), | ||
133 | |||
134 | TP_ARGS(input_bits), | ||
135 | |||
136 | TP_STRUCT__entry( | ||
137 | __field( int, input_bits ) | ||
138 | ), | ||
139 | |||
140 | TP_fast_assign( | ||
141 | __entry->input_bits = input_bits; | ||
142 | ), | ||
143 | |||
144 | TP_printk("input_pool_bits %d", __entry->input_bits) | ||
145 | ); | ||
146 | |||
147 | TRACE_EVENT(add_disk_randomness, | ||
148 | TP_PROTO(dev_t dev, int input_bits), | ||
149 | |||
150 | TP_ARGS(dev, input_bits), | ||
151 | |||
152 | TP_STRUCT__entry( | ||
153 | __field( dev_t, dev ) | ||
154 | __field( int, input_bits ) | ||
155 | ), | ||
156 | |||
157 | TP_fast_assign( | ||
158 | __entry->dev = dev; | ||
159 | __entry->input_bits = input_bits; | ||
160 | ), | ||
161 | |||
162 | TP_printk("dev %d,%d input_pool_bits %d", MAJOR(__entry->dev), | ||
163 | MINOR(__entry->dev), __entry->input_bits) | ||
164 | ); | ||
165 | |||
166 | TRACE_EVENT(xfer_secondary_pool, | ||
167 | TP_PROTO(const char *pool_name, int xfer_bits, int request_bits, | ||
168 | int pool_entropy, int input_entropy), | ||
169 | |||
170 | TP_ARGS(pool_name, xfer_bits, request_bits, pool_entropy, | ||
171 | input_entropy), | ||
172 | |||
173 | TP_STRUCT__entry( | ||
174 | __field( const char *, pool_name ) | ||
175 | __field( int, xfer_bits ) | ||
176 | __field( int, request_bits ) | ||
177 | __field( int, pool_entropy ) | ||
178 | __field( int, input_entropy ) | ||
179 | ), | ||
180 | |||
181 | TP_fast_assign( | ||
182 | __entry->pool_name = pool_name; | ||
183 | __entry->xfer_bits = xfer_bits; | ||
184 | __entry->request_bits = request_bits; | ||
185 | __entry->pool_entropy = pool_entropy; | ||
186 | __entry->input_entropy = input_entropy; | ||
187 | ), | ||
188 | |||
189 | TP_printk("pool %s xfer_bits %d request_bits %d pool_entropy %d " | ||
190 | "input_entropy %d", __entry->pool_name, __entry->xfer_bits, | ||
191 | __entry->request_bits, __entry->pool_entropy, | ||
192 | __entry->input_entropy) | ||
193 | ); | ||
194 | |||
112 | DECLARE_EVENT_CLASS(random__get_random_bytes, | 195 | DECLARE_EVENT_CLASS(random__get_random_bytes, |
113 | TP_PROTO(int nbytes, unsigned long IP), | 196 | TP_PROTO(int nbytes, unsigned long IP), |
114 | 197 | ||
@@ -179,7 +262,52 @@ DEFINE_EVENT(random__extract_entropy, extract_entropy_user, | |||
179 | TP_ARGS(pool_name, nbytes, entropy_count, IP) | 262 | TP_ARGS(pool_name, nbytes, entropy_count, IP) |
180 | ); | 263 | ); |
181 | 264 | ||
265 | TRACE_EVENT(random_read, | ||
266 | TP_PROTO(int got_bits, int need_bits, int pool_left, int input_left), | ||
182 | 267 | ||
268 | TP_ARGS(got_bits, need_bits, pool_left, input_left), | ||
269 | |||
270 | TP_STRUCT__entry( | ||
271 | __field( int, got_bits ) | ||
272 | __field( int, need_bits ) | ||
273 | __field( int, pool_left ) | ||
274 | __field( int, input_left ) | ||
275 | ), | ||
276 | |||
277 | TP_fast_assign( | ||
278 | __entry->got_bits = got_bits; | ||
279 | __entry->need_bits = need_bits; | ||
280 | __entry->pool_left = pool_left; | ||
281 | __entry->input_left = input_left; | ||
282 | ), | ||
283 | |||
284 | TP_printk("got_bits %d still_needed_bits %d " | ||
285 | "blocking_pool_entropy_left %d input_entropy_left %d", | ||
286 | __entry->got_bits, __entry->got_bits, __entry->pool_left, | ||
287 | __entry->input_left) | ||
288 | ); | ||
289 | |||
290 | TRACE_EVENT(urandom_read, | ||
291 | TP_PROTO(int got_bits, int pool_left, int input_left), | ||
292 | |||
293 | TP_ARGS(got_bits, pool_left, input_left), | ||
294 | |||
295 | TP_STRUCT__entry( | ||
296 | __field( int, got_bits ) | ||
297 | __field( int, pool_left ) | ||
298 | __field( int, input_left ) | ||
299 | ), | ||
300 | |||
301 | TP_fast_assign( | ||
302 | __entry->got_bits = got_bits; | ||
303 | __entry->pool_left = pool_left; | ||
304 | __entry->input_left = input_left; | ||
305 | ), | ||
306 | |||
307 | TP_printk("got_bits %d nonblocking_pool_entropy_left %d " | ||
308 | "input_entropy_left %d", __entry->got_bits, | ||
309 | __entry->pool_left, __entry->input_left) | ||
310 | ); | ||
183 | 311 | ||
184 | #endif /* _TRACE_RANDOM_H */ | 312 | #endif /* _TRACE_RANDOM_H */ |
185 | 313 | ||