blob: 4684de344c5d96d7fb86260d37cadd3d7c76a1fe [file] [log] [blame]
Theodore Ts'o00ce1db2012-07-04 16:19:30 -04001#undef TRACE_SYSTEM
2#define TRACE_SYSTEM random
3
4#if !defined(_TRACE_RANDOM_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_RANDOM_H
6
7#include <linux/writeback.h>
8#include <linux/tracepoint.h>
9
Theodore Ts'o59108952013-09-12 14:10:25 -040010TRACE_EVENT(add_device_randomness,
11 TP_PROTO(int bytes, unsigned long IP),
12
13 TP_ARGS(bytes, IP),
14
15 TP_STRUCT__entry(
16 __field( int, bytes )
17 __field(unsigned long, IP )
18 ),
19
20 TP_fast_assign(
21 __entry->bytes = bytes;
22 __entry->IP = IP;
23 ),
24
Scott Woodbbedb172015-03-11 22:13:57 -050025 TP_printk("bytes %d caller %pS",
Theodore Ts'o59108952013-09-12 14:10:25 -040026 __entry->bytes, (void *)__entry->IP)
27);
28
Theodore Ts'o00ce1db2012-07-04 16:19:30 -040029DECLARE_EVENT_CLASS(random__mix_pool_bytes,
30 TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
31
32 TP_ARGS(pool_name, bytes, IP),
33
34 TP_STRUCT__entry(
35 __field( const char *, pool_name )
36 __field( int, bytes )
37 __field(unsigned long, IP )
38 ),
39
40 TP_fast_assign(
41 __entry->pool_name = pool_name;
42 __entry->bytes = bytes;
43 __entry->IP = IP;
44 ),
45
Scott Woodbbedb172015-03-11 22:13:57 -050046 TP_printk("%s pool: bytes %d caller %pS",
Theodore Ts'o00ce1db2012-07-04 16:19:30 -040047 __entry->pool_name, __entry->bytes, (void *)__entry->IP)
48);
49
50DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes,
51 TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
52
53 TP_ARGS(pool_name, bytes, IP)
54);
55
56DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes_nolock,
57 TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
58
59 TP_ARGS(pool_name, bytes, IP)
60);
61
62TRACE_EVENT(credit_entropy_bits,
63 TP_PROTO(const char *pool_name, int bits, int entropy_count,
64 int entropy_total, unsigned long IP),
65
66 TP_ARGS(pool_name, bits, entropy_count, entropy_total, IP),
67
68 TP_STRUCT__entry(
69 __field( const char *, pool_name )
70 __field( int, bits )
71 __field( int, entropy_count )
72 __field( int, entropy_total )
73 __field(unsigned long, IP )
74 ),
75
76 TP_fast_assign(
77 __entry->pool_name = pool_name;
78 __entry->bits = bits;
79 __entry->entropy_count = entropy_count;
80 __entry->entropy_total = entropy_total;
81 __entry->IP = IP;
82 ),
83
84 TP_printk("%s pool: bits %d entropy_count %d entropy_total %d "
Scott Woodbbedb172015-03-11 22:13:57 -050085 "caller %pS", __entry->pool_name, __entry->bits,
Theodore Ts'o00ce1db2012-07-04 16:19:30 -040086 __entry->entropy_count, __entry->entropy_total,
87 (void *)__entry->IP)
88);
89
Theodore Ts'o6265e162013-10-03 01:08:15 -040090TRACE_EVENT(push_to_pool,
91 TP_PROTO(const char *pool_name, int pool_bits, int input_bits),
92
93 TP_ARGS(pool_name, pool_bits, input_bits),
94
95 TP_STRUCT__entry(
96 __field( const char *, pool_name )
97 __field( int, pool_bits )
98 __field( int, input_bits )
99 ),
100
101 TP_fast_assign(
102 __entry->pool_name = pool_name;
103 __entry->pool_bits = pool_bits;
104 __entry->input_bits = input_bits;
105 ),
106
107 TP_printk("%s: pool_bits %d input_pool_bits %d",
108 __entry->pool_name, __entry->pool_bits,
109 __entry->input_bits)
110);
111
Theodore Ts'of80bbd82013-10-03 12:02:37 -0400112TRACE_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
131TRACE_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
147TRACE_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
166TRACE_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
Theodore Ts'o59108952013-09-12 14:10:25 -0400195DECLARE_EVENT_CLASS(random__get_random_bytes,
Theodore Ts'o00ce1db2012-07-04 16:19:30 -0400196 TP_PROTO(int nbytes, unsigned long IP),
197
198 TP_ARGS(nbytes, IP),
199
200 TP_STRUCT__entry(
201 __field( int, nbytes )
202 __field(unsigned long, IP )
203 ),
204
205 TP_fast_assign(
206 __entry->nbytes = nbytes;
207 __entry->IP = IP;
208 ),
209
Scott Woodbbedb172015-03-11 22:13:57 -0500210 TP_printk("nbytes %d caller %pS", __entry->nbytes, (void *)__entry->IP)
Theodore Ts'o00ce1db2012-07-04 16:19:30 -0400211);
212
Theodore Ts'o59108952013-09-12 14:10:25 -0400213DEFINE_EVENT(random__get_random_bytes, get_random_bytes,
214 TP_PROTO(int nbytes, unsigned long IP),
215
216 TP_ARGS(nbytes, IP)
217);
218
219DEFINE_EVENT(random__get_random_bytes, get_random_bytes_arch,
220 TP_PROTO(int nbytes, unsigned long IP),
221
222 TP_ARGS(nbytes, IP)
223);
224
Theodore Ts'o00ce1db2012-07-04 16:19:30 -0400225DECLARE_EVENT_CLASS(random__extract_entropy,
226 TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
227 unsigned long IP),
228
229 TP_ARGS(pool_name, nbytes, entropy_count, IP),
230
231 TP_STRUCT__entry(
232 __field( const char *, pool_name )
233 __field( int, nbytes )
234 __field( int, entropy_count )
235 __field(unsigned long, IP )
236 ),
237
238 TP_fast_assign(
239 __entry->pool_name = pool_name;
240 __entry->nbytes = nbytes;
241 __entry->entropy_count = entropy_count;
242 __entry->IP = IP;
243 ),
244
Scott Woodbbedb172015-03-11 22:13:57 -0500245 TP_printk("%s pool: nbytes %d entropy_count %d caller %pS",
Theodore Ts'o00ce1db2012-07-04 16:19:30 -0400246 __entry->pool_name, __entry->nbytes, __entry->entropy_count,
247 (void *)__entry->IP)
248);
249
250
251DEFINE_EVENT(random__extract_entropy, extract_entropy,
252 TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
253 unsigned long IP),
254
255 TP_ARGS(pool_name, nbytes, entropy_count, IP)
256);
257
258DEFINE_EVENT(random__extract_entropy, extract_entropy_user,
259 TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
260 unsigned long IP),
261
262 TP_ARGS(pool_name, nbytes, entropy_count, IP)
263);
264
Theodore Ts'of80bbd82013-10-03 12:02:37 -0400265TRACE_EVENT(random_read,
266 TP_PROTO(int got_bits, int need_bits, int pool_left, int input_left),
Theodore Ts'o00ce1db2012-07-04 16:19:30 -0400267
Theodore Ts'of80bbd82013-10-03 12:02:37 -0400268 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
290TRACE_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);
Theodore Ts'o00ce1db2012-07-04 16:19:30 -0400311
312#endif /* _TRACE_RANDOM_H */
313
314/* This part must be outside protection */
315#include <trace/define_trace.h>