2 #define TRACE_SYSTEM random
4 #if !defined(_TRACE_RANDOM_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_RANDOM_H
7 #include <linux/writeback.h>
8 #include <linux/tracepoint.h>
10 TRACE_EVENT(add_device_randomness
,
11 TP_PROTO(int bytes
, unsigned long IP
),
17 __field(unsigned long, IP
)
21 __entry
->bytes
= bytes
;
25 TP_printk("bytes %d caller %pS",
26 __entry
->bytes
, (void *)__entry
->IP
)
29 DECLARE_EVENT_CLASS(random__mix_pool_bytes
,
30 TP_PROTO(const char *pool_name
, int bytes
, unsigned long IP
),
32 TP_ARGS(pool_name
, bytes
, IP
),
35 __field( const char *, pool_name
)
37 __field(unsigned long, IP
)
41 __entry
->pool_name
= pool_name
;
42 __entry
->bytes
= bytes
;
46 TP_printk("%s pool: bytes %d caller %pS",
47 __entry
->pool_name
, __entry
->bytes
, (void *)__entry
->IP
)
50 DEFINE_EVENT(random__mix_pool_bytes
, mix_pool_bytes
,
51 TP_PROTO(const char *pool_name
, int bytes
, unsigned long IP
),
53 TP_ARGS(pool_name
, bytes
, IP
)
56 DEFINE_EVENT(random__mix_pool_bytes
, mix_pool_bytes_nolock
,
57 TP_PROTO(const char *pool_name
, int bytes
, unsigned long IP
),
59 TP_ARGS(pool_name
, bytes
, IP
)
62 TRACE_EVENT(credit_entropy_bits
,
63 TP_PROTO(const char *pool_name
, int bits
, int entropy_count
,
64 int entropy_total
, unsigned long IP
),
66 TP_ARGS(pool_name
, bits
, entropy_count
, entropy_total
, IP
),
69 __field( const char *, pool_name
)
71 __field( int, entropy_count
)
72 __field( int, entropy_total
)
73 __field(unsigned long, IP
)
77 __entry
->pool_name
= pool_name
;
79 __entry
->entropy_count
= entropy_count
;
80 __entry
->entropy_total
= entropy_total
;
84 TP_printk("%s pool: bits %d entropy_count %d entropy_total %d "
85 "caller %pS", __entry
->pool_name
, __entry
->bits
,
86 __entry
->entropy_count
, __entry
->entropy_total
,
90 TRACE_EVENT(push_to_pool
,
91 TP_PROTO(const char *pool_name
, int pool_bits
, int input_bits
),
93 TP_ARGS(pool_name
, pool_bits
, input_bits
),
96 __field( const char *, pool_name
)
97 __field( int, pool_bits
)
98 __field( int, input_bits
)
102 __entry
->pool_name
= pool_name
;
103 __entry
->pool_bits
= pool_bits
;
104 __entry
->input_bits
= input_bits
;
107 TP_printk("%s: pool_bits %d input_pool_bits %d",
108 __entry
->pool_name
, __entry
->pool_bits
,
112 TRACE_EVENT(debit_entropy
,
113 TP_PROTO(const char *pool_name
, int debit_bits
),
115 TP_ARGS(pool_name
, debit_bits
),
118 __field( const char *, pool_name
)
119 __field( int, debit_bits
)
123 __entry
->pool_name
= pool_name
;
124 __entry
->debit_bits
= debit_bits
;
127 TP_printk("%s: debit_bits %d", __entry
->pool_name
,
131 TRACE_EVENT(add_input_randomness
,
132 TP_PROTO(int input_bits
),
137 __field( int, input_bits
)
141 __entry
->input_bits
= input_bits
;
144 TP_printk("input_pool_bits %d", __entry
->input_bits
)
147 TRACE_EVENT(add_disk_randomness
,
148 TP_PROTO(dev_t dev
, int input_bits
),
150 TP_ARGS(dev
, input_bits
),
153 __field( dev_t
, dev
)
154 __field( int, input_bits
)
159 __entry
->input_bits
= input_bits
;
162 TP_printk("dev %d,%d input_pool_bits %d", MAJOR(__entry
->dev
),
163 MINOR(__entry
->dev
), __entry
->input_bits
)
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
),
170 TP_ARGS(pool_name
, xfer_bits
, request_bits
, pool_entropy
,
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
)
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
;
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
)
195 DECLARE_EVENT_CLASS(random__get_random_bytes
,
196 TP_PROTO(int nbytes
, unsigned long IP
),
201 __field( int, nbytes
)
202 __field(unsigned long, IP
)
206 __entry
->nbytes
= nbytes
;
210 TP_printk("nbytes %d caller %pS", __entry
->nbytes
, (void *)__entry
->IP
)
213 DEFINE_EVENT(random__get_random_bytes
, get_random_bytes
,
214 TP_PROTO(int nbytes
, unsigned long IP
),
219 DEFINE_EVENT(random__get_random_bytes
, get_random_bytes_arch
,
220 TP_PROTO(int nbytes
, unsigned long IP
),
225 DECLARE_EVENT_CLASS(random__extract_entropy
,
226 TP_PROTO(const char *pool_name
, int nbytes
, int entropy_count
,
229 TP_ARGS(pool_name
, nbytes
, entropy_count
, IP
),
232 __field( const char *, pool_name
)
233 __field( int, nbytes
)
234 __field( int, entropy_count
)
235 __field(unsigned long, IP
)
239 __entry
->pool_name
= pool_name
;
240 __entry
->nbytes
= nbytes
;
241 __entry
->entropy_count
= entropy_count
;
245 TP_printk("%s pool: nbytes %d entropy_count %d caller %pS",
246 __entry
->pool_name
, __entry
->nbytes
, __entry
->entropy_count
,
251 DEFINE_EVENT(random__extract_entropy
, extract_entropy
,
252 TP_PROTO(const char *pool_name
, int nbytes
, int entropy_count
,
255 TP_ARGS(pool_name
, nbytes
, entropy_count
, IP
)
258 DEFINE_EVENT(random__extract_entropy
, extract_entropy_user
,
259 TP_PROTO(const char *pool_name
, int nbytes
, int entropy_count
,
262 TP_ARGS(pool_name
, nbytes
, entropy_count
, IP
)
265 TRACE_EVENT(random_read
,
266 TP_PROTO(int got_bits
, int need_bits
, int pool_left
, int input_left
),
268 TP_ARGS(got_bits
, need_bits
, pool_left
, input_left
),
271 __field( int, got_bits
)
272 __field( int, need_bits
)
273 __field( int, pool_left
)
274 __field( int, input_left
)
278 __entry
->got_bits
= got_bits
;
279 __entry
->need_bits
= need_bits
;
280 __entry
->pool_left
= pool_left
;
281 __entry
->input_left
= input_left
;
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
,
290 TRACE_EVENT(urandom_read
,
291 TP_PROTO(int got_bits
, int pool_left
, int input_left
),
293 TP_ARGS(got_bits
, pool_left
, input_left
),
296 __field( int, got_bits
)
297 __field( int, pool_left
)
298 __field( int, input_left
)
302 __entry
->got_bits
= got_bits
;
303 __entry
->pool_left
= pool_left
;
304 __entry
->input_left
= input_left
;
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
)
312 #endif /* _TRACE_RANDOM_H */
314 /* This part must be outside protection */
315 #include <trace/define_trace.h>