]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
00ce1db1 TT |
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 | ||
5910895f TT |
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 | ||
bbedb179 | 26 | TP_printk("bytes %d caller %pS", |
5910895f TT |
27 | __entry->bytes, (void *)__entry->IP) |
28 | ); | |
29 | ||
00ce1db1 TT |
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 | ||
bbedb179 | 47 | TP_printk("%s pool: bytes %d caller %pS", |
00ce1db1 TT |
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, | |
eb9d1bf0 | 65 | unsigned long IP), |
00ce1db1 | 66 | |
eb9d1bf0 | 67 | TP_ARGS(pool_name, bits, entropy_count, IP), |
00ce1db1 TT |
68 | |
69 | TP_STRUCT__entry( | |
70 | __field( const char *, pool_name ) | |
71 | __field( int, bits ) | |
72 | __field( int, entropy_count ) | |
00ce1db1 TT |
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; | |
00ce1db1 TT |
80 | __entry->IP = IP; |
81 | ), | |
82 | ||
eb9d1bf0 TT |
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) | |
00ce1db1 TT |
86 | ); |
87 | ||
f80bbd8b TT |
88 | TRACE_EVENT(debit_entropy, |
89 | TP_PROTO(const char *pool_name, int debit_bits), | |
90 | ||
91 | TP_ARGS(pool_name, debit_bits), | |
92 | ||
93 | TP_STRUCT__entry( | |
94 | __field( const char *, pool_name ) | |
95 | __field( int, debit_bits ) | |
96 | ), | |
97 | ||
98 | TP_fast_assign( | |
99 | __entry->pool_name = pool_name; | |
100 | __entry->debit_bits = debit_bits; | |
101 | ), | |
102 | ||
103 | TP_printk("%s: debit_bits %d", __entry->pool_name, | |
104 | __entry->debit_bits) | |
105 | ); | |
106 | ||
107 | TRACE_EVENT(add_input_randomness, | |
108 | TP_PROTO(int input_bits), | |
109 | ||
110 | TP_ARGS(input_bits), | |
111 | ||
112 | TP_STRUCT__entry( | |
113 | __field( int, input_bits ) | |
114 | ), | |
115 | ||
116 | TP_fast_assign( | |
117 | __entry->input_bits = input_bits; | |
118 | ), | |
119 | ||
120 | TP_printk("input_pool_bits %d", __entry->input_bits) | |
121 | ); | |
122 | ||
123 | TRACE_EVENT(add_disk_randomness, | |
124 | TP_PROTO(dev_t dev, int input_bits), | |
125 | ||
126 | TP_ARGS(dev, input_bits), | |
127 | ||
128 | TP_STRUCT__entry( | |
129 | __field( dev_t, dev ) | |
130 | __field( int, input_bits ) | |
131 | ), | |
132 | ||
133 | TP_fast_assign( | |
134 | __entry->dev = dev; | |
135 | __entry->input_bits = input_bits; | |
136 | ), | |
137 | ||
138 | TP_printk("dev %d,%d input_pool_bits %d", MAJOR(__entry->dev), | |
139 | MINOR(__entry->dev), __entry->input_bits) | |
140 | ); | |
141 | ||
5910895f | 142 | DECLARE_EVENT_CLASS(random__get_random_bytes, |
00ce1db1 TT |
143 | TP_PROTO(int nbytes, unsigned long IP), |
144 | ||
145 | TP_ARGS(nbytes, IP), | |
146 | ||
147 | TP_STRUCT__entry( | |
148 | __field( int, nbytes ) | |
149 | __field(unsigned long, IP ) | |
150 | ), | |
151 | ||
152 | TP_fast_assign( | |
153 | __entry->nbytes = nbytes; | |
154 | __entry->IP = IP; | |
155 | ), | |
156 | ||
bbedb179 | 157 | TP_printk("nbytes %d caller %pS", __entry->nbytes, (void *)__entry->IP) |
00ce1db1 TT |
158 | ); |
159 | ||
5910895f TT |
160 | DEFINE_EVENT(random__get_random_bytes, get_random_bytes, |
161 | TP_PROTO(int nbytes, unsigned long IP), | |
162 | ||
163 | TP_ARGS(nbytes, IP) | |
164 | ); | |
165 | ||
166 | DEFINE_EVENT(random__get_random_bytes, get_random_bytes_arch, | |
167 | TP_PROTO(int nbytes, unsigned long IP), | |
168 | ||
169 | TP_ARGS(nbytes, IP) | |
170 | ); | |
171 | ||
00ce1db1 TT |
172 | DECLARE_EVENT_CLASS(random__extract_entropy, |
173 | TP_PROTO(const char *pool_name, int nbytes, int entropy_count, | |
174 | unsigned long IP), | |
175 | ||
176 | TP_ARGS(pool_name, nbytes, entropy_count, IP), | |
177 | ||
178 | TP_STRUCT__entry( | |
179 | __field( const char *, pool_name ) | |
180 | __field( int, nbytes ) | |
181 | __field( int, entropy_count ) | |
182 | __field(unsigned long, IP ) | |
183 | ), | |
184 | ||
185 | TP_fast_assign( | |
186 | __entry->pool_name = pool_name; | |
187 | __entry->nbytes = nbytes; | |
188 | __entry->entropy_count = entropy_count; | |
189 | __entry->IP = IP; | |
190 | ), | |
191 | ||
bbedb179 | 192 | TP_printk("%s pool: nbytes %d entropy_count %d caller %pS", |
00ce1db1 TT |
193 | __entry->pool_name, __entry->nbytes, __entry->entropy_count, |
194 | (void *)__entry->IP) | |
195 | ); | |
196 | ||
197 | ||
198 | DEFINE_EVENT(random__extract_entropy, extract_entropy, | |
199 | TP_PROTO(const char *pool_name, int nbytes, int entropy_count, | |
200 | unsigned long IP), | |
201 | ||
202 | TP_ARGS(pool_name, nbytes, entropy_count, IP) | |
203 | ); | |
204 | ||
f80bbd8b TT |
205 | TRACE_EVENT(urandom_read, |
206 | TP_PROTO(int got_bits, int pool_left, int input_left), | |
207 | ||
208 | TP_ARGS(got_bits, pool_left, input_left), | |
209 | ||
210 | TP_STRUCT__entry( | |
211 | __field( int, got_bits ) | |
212 | __field( int, pool_left ) | |
213 | __field( int, input_left ) | |
214 | ), | |
215 | ||
216 | TP_fast_assign( | |
217 | __entry->got_bits = got_bits; | |
218 | __entry->pool_left = pool_left; | |
219 | __entry->input_left = input_left; | |
220 | ), | |
221 | ||
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) | |
225 | ); | |
00ce1db1 | 226 | |
94c7eb54 ED |
227 | TRACE_EVENT(prandom_u32, |
228 | ||
229 | TP_PROTO(unsigned int ret), | |
230 | ||
231 | TP_ARGS(ret), | |
232 | ||
233 | TP_STRUCT__entry( | |
234 | __field( unsigned int, ret) | |
235 | ), | |
236 | ||
237 | TP_fast_assign( | |
238 | __entry->ret = ret; | |
239 | ), | |
240 | ||
241 | TP_printk("ret=%u" , __entry->ret) | |
242 | ); | |
243 | ||
00ce1db1 TT |
244 | #endif /* _TRACE_RANDOM_H */ |
245 | ||
246 | /* This part must be outside protection */ | |
247 | #include <trace/define_trace.h> |