1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM random
5 #if !defined(_TRACE_RANDOM_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_RANDOM_H
8 #include <linux/writeback.h>
9 #include <linux/tracepoint.h>
11 TRACE_EVENT(add_device_randomness,
12 TP_PROTO(int bytes, unsigned long IP),
18 __field(unsigned long, IP )
22 __entry->bytes = bytes;
26 TP_printk("bytes %d caller %pS",
27 __entry->bytes, (void *)__entry->IP)
30 DECLARE_EVENT_CLASS(random__mix_pool_bytes,
31 TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
33 TP_ARGS(pool_name, bytes, IP),
36 __field( const char *, pool_name )
38 __field(unsigned long, IP )
42 __entry->pool_name = pool_name;
43 __entry->bytes = bytes;
47 TP_printk("%s pool: bytes %d caller %pS",
48 __entry->pool_name, __entry->bytes, (void *)__entry->IP)
51 DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes,
52 TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
54 TP_ARGS(pool_name, bytes, IP)
57 DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes_nolock,
58 TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
60 TP_ARGS(pool_name, bytes, IP)
63 TRACE_EVENT(credit_entropy_bits,
64 TP_PROTO(const char *pool_name, int bits, int entropy_count,
67 TP_ARGS(pool_name, bits, entropy_count, IP),
70 __field( const char *, pool_name )
72 __field( int, entropy_count )
73 __field(unsigned long, IP )
77 __entry->pool_name = pool_name;
79 __entry->entropy_count = entropy_count;
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)
88 TRACE_EVENT(debit_entropy,
89 TP_PROTO(const char *pool_name, int debit_bits),
91 TP_ARGS(pool_name, debit_bits),
94 __field( const char *, pool_name )
95 __field( int, debit_bits )
99 __entry->pool_name = pool_name;
100 __entry->debit_bits = debit_bits;
103 TP_printk("%s: debit_bits %d", __entry->pool_name,
107 TRACE_EVENT(add_input_randomness,
108 TP_PROTO(int input_bits),
113 __field( int, input_bits )
117 __entry->input_bits = input_bits;
120 TP_printk("input_pool_bits %d", __entry->input_bits)
123 TRACE_EVENT(add_disk_randomness,
124 TP_PROTO(dev_t dev, int input_bits),
126 TP_ARGS(dev, input_bits),
129 __field( dev_t, dev )
130 __field( int, input_bits )
135 __entry->input_bits = input_bits;
138 TP_printk("dev %d,%d input_pool_bits %d", MAJOR(__entry->dev),
139 MINOR(__entry->dev), __entry->input_bits)
142 DECLARE_EVENT_CLASS(random__get_random_bytes,
143 TP_PROTO(int nbytes, unsigned long IP),
148 __field( int, nbytes )
149 __field(unsigned long, IP )
153 __entry->nbytes = nbytes;
157 TP_printk("nbytes %d caller %pS", __entry->nbytes, (void *)__entry->IP)
160 DEFINE_EVENT(random__get_random_bytes, get_random_bytes,
161 TP_PROTO(int nbytes, unsigned long IP),
166 DEFINE_EVENT(random__get_random_bytes, get_random_bytes_arch,
167 TP_PROTO(int nbytes, unsigned long IP),
172 DECLARE_EVENT_CLASS(random__extract_entropy,
173 TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
176 TP_ARGS(pool_name, nbytes, entropy_count, IP),
179 __field( const char *, pool_name )
180 __field( int, nbytes )
181 __field( int, entropy_count )
182 __field(unsigned long, IP )
186 __entry->pool_name = pool_name;
187 __entry->nbytes = nbytes;
188 __entry->entropy_count = entropy_count;
192 TP_printk("%s pool: nbytes %d entropy_count %d caller %pS",
193 __entry->pool_name, __entry->nbytes, __entry->entropy_count,
198 DEFINE_EVENT(random__extract_entropy, extract_entropy,
199 TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
202 TP_ARGS(pool_name, nbytes, entropy_count, IP)
205 TRACE_EVENT(urandom_read,
206 TP_PROTO(int got_bits, int pool_left, int input_left),
208 TP_ARGS(got_bits, pool_left, input_left),
211 __field( int, got_bits )
212 __field( int, pool_left )
213 __field( int, input_left )
217 __entry->got_bits = got_bits;
218 __entry->pool_left = pool_left;
219 __entry->input_left = input_left;
222 TP_printk("got_bits %d nonblocking_pool_entropy_left %d "
223 "input_entropy_left %d", __entry->got_bits,
224 __entry->pool_left, __entry->input_left)
227 TRACE_EVENT(prandom_u32,
229 TP_PROTO(unsigned int ret),
234 __field( unsigned int, ret)
241 TP_printk("ret=%u" , __entry->ret)
244 #endif /* _TRACE_RANDOM_H */
246 /* This part must be outside protection */
247 #include <trace/define_trace.h>