Commit | Line | Data |
---|---|---|
b7cdc182 | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
b87700e3 AG |
2 | #undef TRACE_SYSTEM |
3 | #define TRACE_SYSTEM rcu | |
4 | ||
3bc29f0a MD |
5 | #if !defined(LTTNG_TRACE_RCU_H) || defined(TRACE_HEADER_MULTI_READ) |
6 | #define LTTNG_TRACE_RCU_H | |
b87700e3 | 7 | |
6ec43db8 | 8 | #include <probes/lttng-tracepoint-event.h> |
b87700e3 AG |
9 | |
10 | /* | |
11 | * Tracepoint for start/end markers used for utilization calculations. | |
12 | * By convention, the string is of the following forms: | |
13 | * | |
14 | * "Start <activity>" -- Mark the start of the specified activity, | |
15 | * such as "context switch". Nesting is permitted. | |
16 | * "End <activity>" -- Mark the end of the specified activity. | |
17 | * | |
18 | * An "@" character within "<activity>" is a comment character: Data | |
19 | * reduction scripts will ignore the "@" and the remainder of the line. | |
20 | */ | |
3bc29f0a | 21 | LTTNG_TRACEPOINT_EVENT(rcu_utilization, |
b87700e3 | 22 | |
8e621312 | 23 | TP_PROTO(const char *s), |
b87700e3 AG |
24 | |
25 | TP_ARGS(s), | |
26 | ||
f127e61e MD |
27 | TP_FIELDS( |
28 | ctf_string(s, s) | |
29 | ) | |
b87700e3 AG |
30 | ) |
31 | ||
32 | #ifdef CONFIG_RCU_TRACE | |
33 | ||
ce804b94 | 34 | #if defined(CONFIG_TREE_RCU) |
b87700e3 AG |
35 | |
36 | /* | |
37 | * Tracepoint for grace-period events: starting and ending a grace | |
38 | * period ("start" and "end", respectively), a CPU noting the start | |
39 | * of a new grace period or the end of an old grace period ("cpustart" | |
40 | * and "cpuend", respectively), a CPU passing through a quiescent | |
41 | * state ("cpuqs"), a CPU coming online or going offline ("cpuonl" | |
42 | * and "cpuofl", respectively), and a CPU being kicked for being too | |
43 | * long in dyntick-idle mode ("kick"). | |
44 | */ | |
248211c9 MJ |
45 | LTTNG_TRACEPOINT_EVENT(rcu_grace_period, |
46 | ||
47 | TP_PROTO(const char *rcuname, unsigned long gp_seq, const char *gpevent), | |
48 | ||
49 | TP_ARGS(rcuname, gp_seq, gpevent), | |
50 | ||
51 | TP_FIELDS( | |
52 | ctf_string(rcuname, rcuname) | |
53 | ctf_integer(unsigned long, gp_seq, gp_seq) | |
54 | ctf_string(gpevent, gpevent) | |
55 | ) | |
56 | ) | |
b87700e3 AG |
57 | |
58 | /* | |
59 | * Tracepoint for grace-period-initialization events. These are | |
60 | * distinguished by the type of RCU, the new grace-period number, the | |
61 | * rcu_node structure level, the starting and ending CPU covered by the | |
62 | * rcu_node structure, and the mask of CPUs that will be waited for. | |
63 | * All but the type of RCU are extracted from the rcu_node structure. | |
64 | */ | |
248211c9 MJ |
65 | LTTNG_TRACEPOINT_EVENT(rcu_grace_period_init, |
66 | ||
67 | TP_PROTO(const char *rcuname, unsigned long gp_seq, u8 level, | |
68 | int grplo, int grphi, unsigned long qsmask), | |
69 | ||
70 | TP_ARGS(rcuname, gp_seq, level, grplo, grphi, qsmask), | |
71 | ||
72 | TP_FIELDS( | |
73 | ctf_string(rcuname, rcuname) | |
74 | ctf_integer(unsigned long, gp_seq, gp_seq) | |
75 | ctf_integer(u8, level, level) | |
76 | ctf_integer(int, grplo, grplo) | |
77 | ctf_integer(int, grphi, grphi) | |
78 | ctf_integer(unsigned long, qsmask, qsmask) | |
79 | ) | |
80 | ) | |
b87700e3 AG |
81 | |
82 | /* | |
83 | * Tracepoint for tasks blocking within preemptible-RCU read-side | |
84 | * critical sections. Track the type of RCU (which one day might | |
85 | * include SRCU), the grace-period number that the task is blocking | |
86 | * (the current or the next), and the task's PID. | |
87 | */ | |
248211c9 MJ |
88 | LTTNG_TRACEPOINT_EVENT(rcu_preempt_task, |
89 | ||
90 | TP_PROTO(const char *rcuname, int pid, unsigned long gp_seq), | |
91 | ||
92 | TP_ARGS(rcuname, pid, gp_seq), | |
93 | ||
94 | TP_FIELDS( | |
95 | ctf_string(rcuname, rcuname) | |
96 | ctf_integer(unsigned long, gp_seq, gp_seq) | |
97 | ctf_integer(int, pid, pid) | |
98 | ) | |
99 | ) | |
b87700e3 AG |
100 | |
101 | /* | |
102 | * Tracepoint for tasks that blocked within a given preemptible-RCU | |
103 | * read-side critical section exiting that critical section. Track the | |
104 | * type of RCU (which one day might include SRCU) and the task's PID. | |
105 | */ | |
248211c9 MJ |
106 | LTTNG_TRACEPOINT_EVENT(rcu_unlock_preempted_task, |
107 | ||
108 | TP_PROTO(const char *rcuname, unsigned long gp_seq, int pid), | |
109 | ||
110 | TP_ARGS(rcuname, gp_seq, pid), | |
111 | ||
112 | TP_FIELDS( | |
113 | ctf_string(rcuname, rcuname) | |
114 | ctf_integer(unsigned long, gp_seq, gp_seq) | |
115 | ctf_integer(int, pid, pid) | |
116 | ) | |
117 | ) | |
b87700e3 AG |
118 | |
119 | /* | |
120 | * Tracepoint for quiescent-state-reporting events. These are | |
121 | * distinguished by the type of RCU, the grace-period number, the | |
122 | * mask of quiescent lower-level entities, the rcu_node structure level, | |
123 | * the starting and ending CPU covered by the rcu_node structure, and | |
124 | * whether there are any blocked tasks blocking the current grace period. | |
125 | * All but the type of RCU are extracted from the rcu_node structure. | |
126 | */ | |
248211c9 MJ |
127 | LTTNG_TRACEPOINT_EVENT(rcu_quiescent_state_report, |
128 | ||
129 | TP_PROTO(const char *rcuname, unsigned long gp_seq, | |
130 | unsigned long mask, unsigned long qsmask, | |
131 | u8 level, int grplo, int grphi, int gp_tasks), | |
132 | ||
133 | TP_ARGS(rcuname, gp_seq, mask, qsmask, level, grplo, grphi, gp_tasks), | |
134 | ||
135 | TP_FIELDS( | |
136 | ctf_string(rcuname, rcuname) | |
137 | ctf_integer(unsigned long, gp_seq, gp_seq) | |
138 | ctf_integer(unsigned long, mask, mask) | |
139 | ctf_integer(unsigned long, qsmask, qsmask) | |
140 | ctf_integer(u8, level, level) | |
141 | ctf_integer(int, grplo, grplo) | |
142 | ctf_integer(int, grphi, grphi) | |
143 | ctf_integer(u8, gp_tasks, gp_tasks) | |
144 | ) | |
145 | ) | |
b87700e3 AG |
146 | |
147 | /* | |
148 | * Tracepoint for quiescent states detected by force_quiescent_state(). | |
149 | * These trace events include the type of RCU, the grace-period number | |
150 | * that was blocked by the CPU, the CPU itself, and the type of quiescent | |
151 | * state, which can be "dti" for dyntick-idle mode, "ofl" for CPU offline, | |
152 | * or "kick" when kicking a CPU that has been in dyntick-idle mode for | |
153 | * too long. | |
154 | */ | |
248211c9 MJ |
155 | LTTNG_TRACEPOINT_EVENT(rcu_fqs, |
156 | ||
157 | TP_PROTO(const char *rcuname, unsigned long gp_seq, int cpu, const char *qsevent), | |
158 | ||
159 | TP_ARGS(rcuname, gp_seq, cpu, qsevent), | |
160 | ||
161 | TP_FIELDS( | |
162 | ctf_integer(unsigned long, gp_seq, gp_seq) | |
163 | ctf_integer(int, cpu, cpu) | |
164 | ctf_string(rcuname, rcuname) | |
165 | ctf_string(qsevent, qsevent) | |
166 | ) | |
167 | ) | |
248211c9 | 168 | |
248211c9 | 169 | #endif |
b87700e3 | 170 | |
b87700e3 AG |
171 | /* |
172 | * Tracepoint for dyntick-idle entry/exit events. These take a string | |
173 | * as argument: "Start" for entering dyntick-idle mode, "End" for | |
174 | * leaving it, "--=" for events moving towards idle, and "++=" for events | |
175 | * moving away from idle. "Error on entry: not idle task" and "Error on | |
176 | * exit: not idle task" indicate that a non-idle task is erroneously | |
177 | * toying with the idle loop. | |
178 | * | |
179 | * These events also take a pair of numbers, which indicate the nesting | |
180 | * depth before and after the event of interest. Note that task-related | |
181 | * events use the upper bits of each number, while interrupt-related | |
182 | * events use the lower bits. | |
183 | */ | |
6334822c MJ |
184 | LTTNG_TRACEPOINT_EVENT(rcu_dyntick, |
185 | ||
186 | TP_PROTO(const char *polarity, long oldnesting, long newnesting, int dynticks), | |
187 | ||
188 | TP_ARGS(polarity, oldnesting, newnesting, dynticks), | |
189 | ||
190 | TP_FIELDS( | |
191 | ctf_string(polarity, polarity) | |
192 | ctf_integer(long, oldnesting, oldnesting) | |
193 | ctf_integer(long, newnesting, newnesting) | |
194 | ctf_integer(int, dynticks, dynticks) | |
195 | ) | |
196 | ) | |
197 | ||
b87700e3 AG |
198 | /* |
199 | * Tracepoint for RCU preparation for idle, the goal being to get RCU | |
200 | * processing done so that the current CPU can shut off its scheduling | |
201 | * clock and enter dyntick-idle mode. One way to accomplish this is | |
202 | * to drain all RCU callbacks from this CPU, and the other is to have | |
203 | * done everything RCU requires for the current grace period. In this | |
204 | * latter case, the CPU will be awakened at the end of the current grace | |
205 | * period in order to process the remainder of its callbacks. | |
206 | * | |
207 | * These tracepoints take a string as argument: | |
208 | * | |
209 | * "No callbacks": Nothing to do, no callbacks on this CPU. | |
210 | * "In holdoff": Nothing to do, holding off after unsuccessful attempt. | |
211 | * "Begin holdoff": Attempt failed, don't retry until next jiffy. | |
212 | * "Dyntick with callbacks": Entering dyntick-idle despite callbacks. | |
213 | * "Dyntick with lazy callbacks": Entering dyntick-idle w/lazy callbacks. | |
214 | * "More callbacks": Still more callbacks, try again to clear them out. | |
215 | * "Callbacks drained": All callbacks processed, off to dyntick idle! | |
216 | * "Timer": Timer fired to cause CPU to continue processing callbacks. | |
217 | * "Demigrate": Timer fired on wrong CPU, woke up correct CPU. | |
218 | * "Cleanup after idle": Idle exited, timer canceled. | |
219 | */ | |
3bc29f0a | 220 | LTTNG_TRACEPOINT_EVENT(rcu_prep_idle, |
b87700e3 | 221 | |
01adf18e | 222 | TP_PROTO(const char *reason), |
b87700e3 AG |
223 | |
224 | TP_ARGS(reason), | |
225 | ||
f127e61e MD |
226 | TP_FIELDS( |
227 | ctf_string(reason, reason) | |
228 | ) | |
b87700e3 | 229 | ) |
b87700e3 AG |
230 | |
231 | /* | |
232 | * Tracepoint for the registration of a single RCU callback function. | |
233 | * The first argument is the type of RCU, the second argument is | |
234 | * a pointer to the RCU callback itself, the third element is the | |
235 | * number of lazy callbacks queued, and the fourth element is the | |
236 | * total number of callbacks queued. | |
237 | */ | |
3e22913e MJ |
238 | LTTNG_TRACEPOINT_EVENT(rcu_callback, |
239 | ||
240 | TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen), | |
241 | ||
242 | TP_ARGS(rcuname, rhp, qlen), | |
243 | ||
244 | TP_FIELDS( | |
245 | ctf_string(rcuname, rcuname) | |
246 | ctf_integer_hex(void *, rhp, rhp) | |
247 | ctf_integer_hex(void *, func, rhp->func) | |
248 | ctf_integer(long, qlen, qlen) | |
249 | ) | |
250 | ) | |
b87700e3 AG |
251 | |
252 | /* | |
253 | * Tracepoint for the registration of a single RCU callback of the special | |
254 | * kfree() form. The first argument is the RCU type, the second argument | |
255 | * is a pointer to the RCU callback, the third argument is the offset | |
256 | * of the callback within the enclosing RCU-protected data structure, | |
257 | * the fourth argument is the number of lazy callbacks queued, and the | |
258 | * fifth argument is the total number of callbacks queued. | |
259 | */ | |
3bc29f0a | 260 | LTTNG_TRACEPOINT_EVENT(rcu_kfree_callback, |
b87700e3 | 261 | |
3e22913e MJ |
262 | TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset, |
263 | long qlen), | |
264 | ||
265 | TP_ARGS(rcuname, rhp, offset, qlen), | |
266 | ||
267 | TP_FIELDS( | |
268 | ctf_string(rcuname, rcuname) | |
269 | ctf_integer_hex(void *, rhp, rhp) | |
270 | ctf_integer_hex(unsigned long, offset, offset) | |
271 | ctf_integer(long, qlen, qlen) | |
272 | ) | |
273 | ) | |
b87700e3 AG |
274 | |
275 | /* | |
276 | * Tracepoint for marking the beginning rcu_do_batch, performed to start | |
277 | * RCU callback invocation. The first argument is the RCU flavor, | |
278 | * the second is the number of lazy callbacks queued, the third is | |
279 | * the total number of callbacks queued, and the fourth argument is | |
280 | * the current RCU-callback batch limit. | |
281 | */ | |
3e22913e MJ |
282 | LTTNG_TRACEPOINT_EVENT(rcu_batch_start, |
283 | ||
284 | TP_PROTO(const char *rcuname, long qlen, long blimit), | |
285 | ||
286 | TP_ARGS(rcuname, qlen, blimit), | |
287 | ||
288 | TP_FIELDS( | |
289 | ctf_string(rcuname, rcuname) | |
290 | ctf_integer(long, qlen, qlen) | |
291 | ctf_integer(long, blimit, blimit) | |
292 | ) | |
293 | ) | |
b87700e3 AG |
294 | |
295 | /* | |
296 | * Tracepoint for the invocation of a single RCU callback function. | |
297 | * The first argument is the type of RCU, and the second argument is | |
298 | * a pointer to the RCU callback itself. | |
299 | */ | |
3bc29f0a | 300 | LTTNG_TRACEPOINT_EVENT(rcu_invoke_callback, |
b87700e3 | 301 | |
01adf18e | 302 | TP_PROTO(const char *rcuname, struct rcu_head *rhp), |
b87700e3 AG |
303 | |
304 | TP_ARGS(rcuname, rhp), | |
305 | ||
f127e61e MD |
306 | TP_FIELDS( |
307 | ctf_string(rcuname, rcuname) | |
fa91fcac MD |
308 | ctf_integer_hex(void *, rhp, rhp) |
309 | ctf_integer_hex(void *, func, rhp->func) | |
f127e61e | 310 | ) |
b87700e3 AG |
311 | ) |
312 | ||
313 | /* | |
314 | * Tracepoint for the invocation of a single RCU callback of the special | |
315 | * kfree() form. The first argument is the RCU flavor, the second | |
316 | * argument is a pointer to the RCU callback, and the third argument | |
317 | * is the offset of the callback within the enclosing RCU-protected | |
318 | * data structure. | |
319 | */ | |
3bc29f0a | 320 | LTTNG_TRACEPOINT_EVENT(rcu_invoke_kfree_callback, |
b87700e3 | 321 | |
01adf18e | 322 | TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset), |
b87700e3 AG |
323 | |
324 | TP_ARGS(rcuname, rhp, offset), | |
325 | ||
f127e61e MD |
326 | TP_FIELDS( |
327 | ctf_string(rcuname, rcuname) | |
fa91fcac | 328 | ctf_integer_hex(void *, rhp, rhp) |
f127e61e MD |
329 | ctf_integer(unsigned long, offset, offset) |
330 | ) | |
b87700e3 AG |
331 | ) |
332 | ||
333 | /* | |
334 | * Tracepoint for exiting rcu_do_batch after RCU callbacks have been | |
335 | * invoked. The first argument is the name of the RCU flavor, | |
336 | * the second argument is number of callbacks actually invoked, | |
337 | * the third argument (cb) is whether or not any of the callbacks that | |
338 | * were ready to invoke at the beginning of this batch are still | |
339 | * queued, the fourth argument (nr) is the return value of need_resched(), | |
340 | * the fifth argument (iit) is 1 if the current task is the idle task, | |
341 | * and the sixth argument (risk) is the return value from | |
342 | * rcu_is_callbacks_kthread(). | |
343 | */ | |
3bc29f0a | 344 | LTTNG_TRACEPOINT_EVENT(rcu_batch_end, |
b87700e3 | 345 | |
01adf18e MD |
346 | TP_PROTO(const char *rcuname, int callbacks_invoked, |
347 | char cb, char nr, char iit, char risk), | |
348 | ||
349 | TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk), | |
b87700e3 | 350 | |
f127e61e MD |
351 | TP_FIELDS( |
352 | ctf_string(rcuname, rcuname) | |
353 | ctf_integer(int, callbacks_invoked, callbacks_invoked) | |
f127e61e MD |
354 | ctf_integer(char, cb, cb) |
355 | ctf_integer(char, nr, nr) | |
356 | ctf_integer(char, iit, iit) | |
357 | ctf_integer(char, risk, risk) | |
f127e61e | 358 | ) |
b87700e3 AG |
359 | ) |
360 | ||
b87700e3 AG |
361 | /* |
362 | * Tracepoint for rcutorture readers. The first argument is the name | |
363 | * of the RCU flavor from rcutorture's viewpoint and the second argument | |
364 | * is the callback address. | |
365 | */ | |
3bc29f0a | 366 | LTTNG_TRACEPOINT_EVENT(rcu_torture_read, |
b87700e3 | 367 | |
01adf18e MD |
368 | TP_PROTO(const char *rcutorturename, struct rcu_head *rhp, |
369 | unsigned long secs, unsigned long c_old, unsigned long c), | |
370 | ||
371 | TP_ARGS(rcutorturename, rhp, secs, c_old, c), | |
b87700e3 | 372 | |
f127e61e MD |
373 | TP_FIELDS( |
374 | ctf_string(rcutorturename, rcutorturename) | |
fa91fcac | 375 | ctf_integer_hex(struct rcu_head *, rhp, rhp) |
f127e61e MD |
376 | ctf_integer(unsigned long, secs, secs) |
377 | ctf_integer(unsigned long, c_old, c_old) | |
378 | ctf_integer(unsigned long, c, c) | |
f127e61e | 379 | ) |
b87700e3 | 380 | ) |
b87700e3 | 381 | |
b87700e3 AG |
382 | /* |
383 | * Tracepoint for _rcu_barrier() execution. The string "s" describes | |
384 | * the _rcu_barrier phase: | |
385 | * "Begin": rcu_barrier_callback() started. | |
386 | * "Check": rcu_barrier_callback() checking for piggybacking. | |
387 | * "EarlyExit": rcu_barrier_callback() piggybacked, thus early exit. | |
388 | * "Inc1": rcu_barrier_callback() piggyback check counter incremented. | |
389 | * "Offline": rcu_barrier_callback() found offline CPU | |
390 | * "OnlineQ": rcu_barrier_callback() found online CPU with callbacks. | |
391 | * "OnlineNQ": rcu_barrier_callback() found online CPU, no callbacks. | |
392 | * "IRQ": An rcu_barrier_callback() callback posted on remote CPU. | |
393 | * "CB": An rcu_barrier_callback() invoked a callback, not the last. | |
394 | * "LastCB": An rcu_barrier_callback() invoked the last callback. | |
395 | * "Inc2": rcu_barrier_callback() piggyback check counter incremented. | |
396 | * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument | |
397 | * is the count of remaining callbacks, and "done" is the piggybacking count. | |
398 | */ | |
3bc29f0a | 399 | LTTNG_TRACEPOINT_EVENT(rcu_barrier, |
b87700e3 | 400 | |
01adf18e | 401 | TP_PROTO(const char *rcuname, const char *s, int cpu, int cnt, unsigned long done), |
b87700e3 AG |
402 | |
403 | TP_ARGS(rcuname, s, cpu, cnt, done), | |
404 | ||
f127e61e MD |
405 | TP_FIELDS( |
406 | ctf_string(rcuname, rcuname) | |
407 | ctf_string(s, s) | |
408 | ctf_integer(int, cpu, cpu) | |
409 | ctf_integer(int, cnt, cnt) | |
410 | ctf_integer(unsigned long, done, done) | |
411 | ) | |
b87700e3 | 412 | ) |
b87700e3 AG |
413 | |
414 | #else /* #ifdef CONFIG_RCU_TRACE */ | |
415 | ||
248211c9 MJ |
416 | #define trace_rcu_grace_period(rcuname, gp_seq, gpevent) do { } while (0) |
417 | #define trace_rcu_grace_period_init(rcuname, gp_seq, level, grplo, grphi, \ | |
418 | qsmask) do { } while (0) | |
419 | #define trace_rcu_preempt_task(rcuname, pid, gp_seq) do { } while (0) | |
420 | #define trace_rcu_unlock_preempted_task(rcuname, gp_seq, pid) do { } while (0) | |
421 | #define trace_rcu_quiescent_state_report(rcuname, gp_seq, mask, qsmask, level, \ | |
422 | grplo, grphi, gp_tasks) do { } \ | |
423 | while (0) | |
424 | #define trace_rcu_fqs(rcuname, gp_seq, cpu, qsevent) do { } while (0) | |
248211c9 | 425 | |
f442e68c | 426 | #define trace_rcu_dyntick(polarity, oldnesting, newnesting, dyntick) do { } while (0) |
b87700e3 | 427 | #define trace_rcu_prep_idle(reason) do { } while (0) |
b87700e3 AG |
428 | #define trace_rcu_callback(rcuname, rhp, qlen_lazy, qlen) do { } while (0) |
429 | #define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen_lazy, qlen) \ | |
430 | do { } while (0) | |
431 | #define trace_rcu_batch_start(rcuname, qlen_lazy, qlen, blimit) \ | |
432 | do { } while (0) | |
b87700e3 AG |
433 | #define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0) |
434 | #define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0) | |
b87700e3 AG |
435 | #define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \ |
436 | do { } while (0) | |
a828b9d5 MD |
437 | #define trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \ |
438 | do { } while (0) | |
b87700e3 | 439 | #define trace_rcu_barrier(name, s, cpu, cnt, done) do { } while (0) |
b87700e3 AG |
440 | #endif /* #else #ifdef CONFIG_RCU_TRACE */ |
441 | ||
3bc29f0a | 442 | #endif /* LTTNG_TRACE_RCU_H */ |
b87700e3 AG |
443 | |
444 | /* This part must be outside protection */ | |
6ec43db8 | 445 | #include <probes/define_trace.h> |