1
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM random
4
5 #if !defined(_TRACE_RANDOM_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_RANDOM_H
7
8 #include <linux/writeback.h>
9 #include <linux/tracepoint.h>
10
11 TRACE_EVENT(add_device_randomness,
12 TP_PROTO(int bytes, unsigned long IP),
13
14 TP_ARGS(bytes, IP),
15
16 TP_STRUCT__entry(
17 __field( int, bytes )
18 __field(unsigned long, IP )
19 ),
20
21 TP_fast_assign(
22 __entry->bytes = bytes;
23 __entry->IP = IP;
24 ),
25
26 TP_printk("bytes %d caller %pS",
27 __entry->bytes, (void *)__entry->IP)
28 );
29
30 DECLARE_EVENT_CLASS(random__mix_pool_bytes,
31 TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
32
33 TP_ARGS(pool_name, bytes, IP),
34
35 TP_STRUCT__entry(
36 __field( const char *, pool_name )
37 __field( int, bytes )
38 __field(unsigned long, IP )
39 ),
40
41 TP_fast_assign(
42 __entry->pool_name = pool_name;
43 __entry->bytes = bytes;
44 __entry->IP = IP;
45 ),
46
47 TP_printk("%s pool: bytes %d caller %pS",
48 __entry->pool_name, __entry->bytes, (void *)__entry->IP)
49 );
50
51 DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes,
52 TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
53
54 TP_ARGS(pool_name, bytes, IP)
55 );
56
57 DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes_nolock,
58 TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
59
60 TP_ARGS(pool_name, bytes, IP)
61 );
62
63 TRACE_EVENT(credit_entropy_bits,
64 TP_PROTO(const char *pool_name, int bits, int entropy_count,
65 unsigned long IP),
66
67 TP_ARGS(pool_name, bits, entropy_count, IP),
68
69 TP_STRUCT__entry(
70 __field( const char *, pool_name )
71 __field( int, bits )
72 __field( int, entropy_count )
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->IP = IP;
81 ),
82
83 TP_printk("%s pool: bits %d entropy_count %d caller %pS",
84 __entry->pool_name, __entry->bits,
85 __entry->entropy_count, (void *)__entry->IP)
86 );
87
88 TRACE_EVENT(push_to_pool,
89 TP_PROTO(const char *pool_name, int pool_bits, int input_bits),
90
91 TP_ARGS(pool_name, pool_bits, input_bits),
92
93 TP_STRUCT__entry(
94 __field( const char *, pool_name )
95 __field( int, pool_bits )
96 __field( int, input_bits )
97 ),
98
99 TP_fast_assign(
100 __entry->pool_name = pool_name;
101 __entry->pool_bits = pool_bits;
102 __entry->input_bits = input_bits;
103 ),
104
105 TP_printk("%s: pool_bits %d input_pool_bits %d",
106 __entry->pool_name, __entry->pool_bits,
107 __entry->input_bits)
108 );
109
110 TRACE_EVENT(debit_entropy,
111 TP_PROTO(const char *pool_name, int debit_bits),
112
113 TP_ARGS(pool_name, debit_bits),
114
115 TP_STRUCT__entry(
116 __field( const char *, pool_name )
117 __field( int, debit_bits )
118 ),
119
120 TP_fast_assign(
121 __entry->pool_name = pool_name;
122 __entry->debit_bits = debit_bits;
123 ),
124
125 TP_printk("%s: debit_bits %d", __entry->pool_name,
126 __entry->debit_bits)
127 );
128
129 TRACE_EVENT(add_input_randomness,
130 TP_PROTO(int input_bits),
131
132 TP_ARGS(input_bits),
133
134 TP_STRUCT__entry(
135 __field( int, input_bits )
136 ),
137
138 TP_fast_assign(
139 __entry->input_bits = input_bits;
140 ),
141
142 TP_printk("input_pool_bits %d", __entry->input_bits)
143 );
144
145 TRACE_EVENT(add_disk_randomness,
146 TP_PROTO(dev_t dev, int input_bits),
147
148 TP_ARGS(dev, input_bits),
149
150 TP_STRUCT__entry(
151 __field( dev_t, dev )
152 __field( int, input_bits )
153 ),
154
155 TP_fast_assign(
156 __entry->dev = dev;
157 __entry->input_bits = input_bits;
158 ),
159
160 TP_printk("dev %d,%d input_pool_bits %d", MAJOR(__entry->dev),
161 MINOR(__entry->dev), __entry->input_bits)
162 );
163
164 TRACE_EVENT(xfer_secondary_pool,
165 TP_PROTO(const char *pool_name, int xfer_bits, int request_bits,
166 int pool_entropy, int input_entropy),
167
168 TP_ARGS(pool_name, xfer_bits, request_bits, pool_entropy,
169 input_entropy),
170
171 TP_STRUCT__entry(
172 __field( const char *, pool_name )
173 __field( int, xfer_bits )
174 __field( int, request_bits )
175 __field( int, pool_entropy )
176 __field( int, input_entropy )
177 ),
178
179 TP_fast_assign(
180 __entry->pool_name = pool_name;
181 __entry->xfer_bits = xfer_bits;
182 __entry->request_bits = request_bits;
183 __entry->pool_entropy = pool_entropy;
184 __entry->input_entropy = input_entropy;
185 ),
186
187 TP_printk("pool %s xfer_bits %d request_bits %d pool_entropy %d "
188 "input_entropy %d", __entry->pool_name, __entry->xfer_bits,
189 __entry->request_bits, __entry->pool_entropy,
190 __entry->input_entropy)
191 );
192
193 DECLARE_EVENT_CLASS(random__get_random_bytes,
194 TP_PROTO(int nbytes, unsigned long IP),
195
196 TP_ARGS(nbytes, IP),
197
198 TP_STRUCT__entry(
199 __field( int, nbytes )
200 __field(unsigned long, IP )
201 ),
202
203 TP_fast_assign(
204 __entry->nbytes = nbytes;
205 __entry->IP = IP;
206 ),
207
208 TP_printk("nbytes %d caller %pS", __entry->nbytes, (void *)__entry->IP)
209 );
210
211 DEFINE_EVENT(random__get_random_bytes, get_random_bytes,
212 TP_PROTO(int nbytes, unsigned long IP),
213
214 TP_ARGS(nbytes, IP)
215 );
216
217 DEFINE_EVENT(random__get_random_bytes, get_random_bytes_arch,
218 TP_PROTO(int nbytes, unsigned long IP),
219
220 TP_ARGS(nbytes, IP)
221 );
222
223 DECLARE_EVENT_CLASS(random__extract_entropy,
224 TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
225 unsigned long IP),
226
227 TP_ARGS(pool_name, nbytes, entropy_count, IP),
228
229 TP_STRUCT__entry(
230 __field( const char *, pool_name )
231 __field( int, nbytes )
232 __field( int, entropy_count )
233 __field(unsigned long, IP )
234 ),
235
236 TP_fast_assign(
237 __entry->pool_name = pool_name;
238 __entry->nbytes = nbytes;
239 __entry->entropy_count = entropy_count;
240 __entry->IP = IP;
241 ),
242
243 TP_printk("%s pool: nbytes %d entropy_count %d caller %pS",
244 __entry->pool_name, __entry->nbytes, __entry->entropy_count,
245 (void *)__entry->IP)
246 );
247
248
249 DEFINE_EVENT(random__extract_entropy, extract_entropy,
250 TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
251 unsigned long IP),
252
253 TP_ARGS(pool_name, nbytes, entropy_count, IP)
254 );
255
256 DEFINE_EVENT(random__extract_entropy, extract_entropy_user,
257 TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
258 unsigned long IP),
259
260 TP_ARGS(pool_name, nbytes, entropy_count, IP)
261 );
262
263 TRACE_EVENT(random_read,
264 TP_PROTO(int got_bits, int need_bits, int pool_left, int input_left),
265
266 TP_ARGS(got_bits, need_bits, pool_left, input_left),
267
268 TP_STRUCT__entry(
269 __field( int, got_bits )
270 __field( int, need_bits )
271 __field( int, pool_left )
272 __field( int, input_left )
273 ),
274
275 TP_fast_assign(
276 __entry->got_bits = got_bits;
277 __entry->need_bits = need_bits;
278 __entry->pool_left = pool_left;
279 __entry->input_left = input_left;
280 ),
281
282 TP_printk("got_bits %d still_needed_bits %d "
283 "blocking_pool_entropy_left %d input_entropy_left %d",
284 __entry->got_bits, __entry->got_bits, __entry->pool_left,
285 __entry->input_left)
286 );
287
288 TRACE_EVENT(urandom_read,
289 TP_PROTO(int got_bits, int pool_left, int input_left),
290
291 TP_ARGS(got_bits, pool_left, input_left),
292
293 TP_STRUCT__entry(
294 __field( int, got_bits )
295 __field( int, pool_left )
296 __field( int, input_left )
297 ),
298
299 TP_fast_assign(
300 __entry->got_bits = got_bits;
301 __entry->pool_left = pool_left;
302 __entry->input_left = input_left;
303 ),
304
305 TP_printk("got_bits %d nonblocking_pool_entropy_left %d "
306 "input_entropy_left %d", __entry->got_bits,
307 __entry->pool_left, __entry->input_left)
308 );
309
310 #endif
311
312
313 #include <trace/define_trace.h>