Update README.md for supported kernel
[lttng-modules.git] / instrumentation / events / lttng-module / rcu.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM rcu
4
5 #if !defined(LTTNG_TRACE_RCU_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_RCU_H
7
8 #include <probes/lttng-tracepoint-event.h>
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 */
21 LTTNG_TRACEPOINT_EVENT(rcu_utilization,
22
23 TP_PROTO(const char *s),
24
25 TP_ARGS(s),
26
27 TP_FIELDS(
28 ctf_string(s, s)
29 )
30 )
31
32 #ifdef CONFIG_RCU_TRACE
33
34 #if defined(CONFIG_TREE_RCU)
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 */
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 )
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 */
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 )
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 */
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 )
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 */
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 )
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 */
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 )
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 */
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 )
168
169 #endif
170
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 */
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
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 */
220 LTTNG_TRACEPOINT_EVENT(rcu_prep_idle,
221
222 TP_PROTO(const char *reason),
223
224 TP_ARGS(reason),
225
226 TP_FIELDS(
227 ctf_string(reason, reason)
228 )
229 )
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 */
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 )
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 */
260 LTTNG_TRACEPOINT_EVENT(rcu_kfree_callback,
261
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 )
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 */
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 )
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 */
300 LTTNG_TRACEPOINT_EVENT(rcu_invoke_callback,
301
302 TP_PROTO(const char *rcuname, struct rcu_head *rhp),
303
304 TP_ARGS(rcuname, rhp),
305
306 TP_FIELDS(
307 ctf_string(rcuname, rcuname)
308 ctf_integer_hex(void *, rhp, rhp)
309 ctf_integer_hex(void *, func, rhp->func)
310 )
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 */
320 LTTNG_TRACEPOINT_EVENT(rcu_invoke_kfree_callback,
321
322 TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset),
323
324 TP_ARGS(rcuname, rhp, offset),
325
326 TP_FIELDS(
327 ctf_string(rcuname, rcuname)
328 ctf_integer_hex(void *, rhp, rhp)
329 ctf_integer(unsigned long, offset, offset)
330 )
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 */
344 LTTNG_TRACEPOINT_EVENT(rcu_batch_end,
345
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),
350
351 TP_FIELDS(
352 ctf_string(rcuname, rcuname)
353 ctf_integer(int, callbacks_invoked, callbacks_invoked)
354 ctf_integer(char, cb, cb)
355 ctf_integer(char, nr, nr)
356 ctf_integer(char, iit, iit)
357 ctf_integer(char, risk, risk)
358 )
359 )
360
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 */
366 LTTNG_TRACEPOINT_EVENT(rcu_torture_read,
367
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),
372
373 TP_FIELDS(
374 ctf_string(rcutorturename, rcutorturename)
375 ctf_integer_hex(struct rcu_head *, rhp, rhp)
376 ctf_integer(unsigned long, secs, secs)
377 ctf_integer(unsigned long, c_old, c_old)
378 ctf_integer(unsigned long, c, c)
379 )
380 )
381
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 */
399 LTTNG_TRACEPOINT_EVENT(rcu_barrier,
400
401 TP_PROTO(const char *rcuname, const char *s, int cpu, int cnt, unsigned long done),
402
403 TP_ARGS(rcuname, s, cpu, cnt, done),
404
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 )
412 )
413
414 #else /* #ifdef CONFIG_RCU_TRACE */
415
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)
425
426 #define trace_rcu_dyntick(polarity, oldnesting, newnesting, dyntick) do { } while (0)
427 #define trace_rcu_prep_idle(reason) do { } while (0)
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)
433 #define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0)
434 #define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0)
435 #define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \
436 do { } while (0)
437 #define trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
438 do { } while (0)
439 #define trace_rcu_barrier(name, s, cpu, cnt, done) do { } while (0)
440 #endif /* #else #ifdef CONFIG_RCU_TRACE */
441
442 #endif /* LTTNG_TRACE_RCU_H */
443
444 /* This part must be outside protection */
445 #include <probes/define_trace.h>
This page took 0.037836 seconds and 4 git commands to generate.