Cleanup: move to kernel style SPDX license identifiers
[lttng-modules.git] / instrumentation / events / lttng-module / rcu.h
CommitLineData
9f36eaed 1/* SPDX-License-Identifier: GPL-2.0 */
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#include <linux/version.h>
10
11/*
12 * Tracepoint for start/end markers used for utilization calculations.
13 * By convention, the string is of the following forms:
14 *
15 * "Start <activity>" -- Mark the start of the specified activity,
16 * such as "context switch". Nesting is permitted.
17 * "End <activity>" -- Mark the end of the specified activity.
18 *
19 * An "@" character within "<activity>" is a comment character: Data
20 * reduction scripts will ignore the "@" and the remainder of the line.
21 */
3bc29f0a 22LTTNG_TRACEPOINT_EVENT(rcu_utilization,
b87700e3 23
8e621312
MD
24#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
25 TP_PROTO(const char *s),
26#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3 27 TP_PROTO(char *s),
8e621312 28#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
29
30 TP_ARGS(s),
31
f127e61e
MD
32 TP_FIELDS(
33 ctf_string(s, s)
34 )
b87700e3
AG
35)
36
37#ifdef CONFIG_RCU_TRACE
38
12318fb8
MD
39#if defined(CONFIG_TREE_RCU) \
40 || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) \
41 && defined(CONFIG_PREEMPT_RCU)) \
42 || defined(CONFIG_TREE_PREEMPT_RCU)
b87700e3
AG
43
44/*
45 * Tracepoint for grace-period events: starting and ending a grace
46 * period ("start" and "end", respectively), a CPU noting the start
47 * of a new grace period or the end of an old grace period ("cpustart"
48 * and "cpuend", respectively), a CPU passing through a quiescent
49 * state ("cpuqs"), a CPU coming online or going offline ("cpuonl"
50 * and "cpuofl", respectively), and a CPU being kicked for being too
51 * long in dyntick-idle mode ("kick").
52 */
3bc29f0a 53LTTNG_TRACEPOINT_EVENT(rcu_grace_period,
b87700e3 54
01adf18e
MD
55#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
56 TP_PROTO(const char *rcuname, unsigned long gpnum, const char *gpevent),
57#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3 58 TP_PROTO(char *rcuname, unsigned long gpnum, char *gpevent),
01adf18e 59#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
60
61 TP_ARGS(rcuname, gpnum, gpevent),
62
f127e61e
MD
63 TP_FIELDS(
64 ctf_string(rcuname, rcuname)
65 ctf_integer(unsigned long, gpnum, gpnum)
66 ctf_string(gpevent, gpevent)
67 )
b87700e3
AG
68)
69
70/*
71 * Tracepoint for grace-period-initialization events. These are
72 * distinguished by the type of RCU, the new grace-period number, the
73 * rcu_node structure level, the starting and ending CPU covered by the
74 * rcu_node structure, and the mask of CPUs that will be waited for.
75 * All but the type of RCU are extracted from the rcu_node structure.
76 */
3bc29f0a 77LTTNG_TRACEPOINT_EVENT(rcu_grace_period_init,
b87700e3 78
01adf18e
MD
79#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
80 TP_PROTO(const char *rcuname, unsigned long gpnum, u8 level,
81 int grplo, int grphi, unsigned long qsmask),
82#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
83 TP_PROTO(char *rcuname, unsigned long gpnum, u8 level,
84 int grplo, int grphi, unsigned long qsmask),
01adf18e 85#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
86
87 TP_ARGS(rcuname, gpnum, level, grplo, grphi, qsmask),
88
f127e61e
MD
89 TP_FIELDS(
90 ctf_string(rcuname, rcuname)
91 ctf_integer(unsigned long, gpnum, gpnum)
92 ctf_integer(u8, level, level)
93 ctf_integer(int, grplo, grplo)
94 ctf_integer(int, grphi, grphi)
95 ctf_integer(unsigned long, qsmask, qsmask)
96 )
b87700e3
AG
97)
98
99/*
100 * Tracepoint for tasks blocking within preemptible-RCU read-side
101 * critical sections. Track the type of RCU (which one day might
102 * include SRCU), the grace-period number that the task is blocking
103 * (the current or the next), and the task's PID.
104 */
3bc29f0a 105LTTNG_TRACEPOINT_EVENT(rcu_preempt_task,
b87700e3 106
01adf18e
MD
107#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
108 TP_PROTO(const char *rcuname, int pid, unsigned long gpnum),
109#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3 110 TP_PROTO(char *rcuname, int pid, unsigned long gpnum),
01adf18e 111#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
112
113 TP_ARGS(rcuname, pid, gpnum),
114
f127e61e
MD
115 TP_FIELDS(
116 ctf_string(rcuname, rcuname)
117 ctf_integer(unsigned long, gpnum, gpnum)
118 ctf_integer(int, pid, pid)
119 )
b87700e3
AG
120)
121
122/*
123 * Tracepoint for tasks that blocked within a given preemptible-RCU
124 * read-side critical section exiting that critical section. Track the
125 * type of RCU (which one day might include SRCU) and the task's PID.
126 */
3bc29f0a 127LTTNG_TRACEPOINT_EVENT(rcu_unlock_preempted_task,
b87700e3 128
01adf18e
MD
129#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
130 TP_PROTO(const char *rcuname, unsigned long gpnum, int pid),
131#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3 132 TP_PROTO(char *rcuname, unsigned long gpnum, int pid),
01adf18e 133#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
134
135 TP_ARGS(rcuname, gpnum, pid),
136
f127e61e
MD
137 TP_FIELDS(
138 ctf_string(rcuname, rcuname)
139 ctf_integer(unsigned long, gpnum, gpnum)
140 ctf_integer(int, pid, pid)
141 )
b87700e3
AG
142)
143
144/*
145 * Tracepoint for quiescent-state-reporting events. These are
146 * distinguished by the type of RCU, the grace-period number, the
147 * mask of quiescent lower-level entities, the rcu_node structure level,
148 * the starting and ending CPU covered by the rcu_node structure, and
149 * whether there are any blocked tasks blocking the current grace period.
150 * All but the type of RCU are extracted from the rcu_node structure.
151 */
3bc29f0a 152LTTNG_TRACEPOINT_EVENT(rcu_quiescent_state_report,
b87700e3 153
01adf18e
MD
154#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
155 TP_PROTO(const char *rcuname, unsigned long gpnum,
156 unsigned long mask, unsigned long qsmask,
157 u8 level, int grplo, int grphi, int gp_tasks),
158#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
159 TP_PROTO(char *rcuname, unsigned long gpnum,
160 unsigned long mask, unsigned long qsmask,
161 u8 level, int grplo, int grphi, int gp_tasks),
01adf18e 162#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
163
164 TP_ARGS(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks),
165
f127e61e
MD
166 TP_FIELDS(
167 ctf_string(rcuname, rcuname)
168 ctf_integer(unsigned long, gpnum, gpnum)
169 ctf_integer(unsigned long, mask, mask)
170 ctf_integer(unsigned long, qsmask, qsmask)
171 ctf_integer(u8, level, level)
172 ctf_integer(int, grplo, grplo)
173 ctf_integer(int, grphi, grphi)
174 ctf_integer(u8, gp_tasks, gp_tasks)
175 )
b87700e3
AG
176)
177
178/*
179 * Tracepoint for quiescent states detected by force_quiescent_state().
180 * These trace events include the type of RCU, the grace-period number
181 * that was blocked by the CPU, the CPU itself, and the type of quiescent
182 * state, which can be "dti" for dyntick-idle mode, "ofl" for CPU offline,
183 * or "kick" when kicking a CPU that has been in dyntick-idle mode for
184 * too long.
185 */
3bc29f0a 186LTTNG_TRACEPOINT_EVENT(rcu_fqs,
b87700e3 187
01adf18e
MD
188#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
189 TP_PROTO(const char *rcuname, unsigned long gpnum, int cpu, const char *qsevent),
190#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3 191 TP_PROTO(char *rcuname, unsigned long gpnum, int cpu, char *qsevent),
01adf18e 192#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
193
194 TP_ARGS(rcuname, gpnum, cpu, qsevent),
195
f127e61e
MD
196 TP_FIELDS(
197 ctf_integer(unsigned long, gpnum, gpnum)
198 ctf_integer(int, cpu, cpu)
199 ctf_string(rcuname, rcuname)
200 ctf_string(qsevent, qsevent)
201 )
b87700e3
AG
202)
203
12318fb8
MD
204#endif /*
205 * #if defined(CONFIG_TREE_RCU)
206 * || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
207 * && defined(CONFIG_PREEMPT_RCU))
208 * || defined(CONFIG_TREE_PREEMPT_RCU)
209 */
b87700e3
AG
210
211/*
212 * Tracepoint for dyntick-idle entry/exit events. These take a string
213 * as argument: "Start" for entering dyntick-idle mode, "End" for
214 * leaving it, "--=" for events moving towards idle, and "++=" for events
215 * moving away from idle. "Error on entry: not idle task" and "Error on
216 * exit: not idle task" indicate that a non-idle task is erroneously
217 * toying with the idle loop.
218 *
219 * These events also take a pair of numbers, which indicate the nesting
220 * depth before and after the event of interest. Note that task-related
221 * events use the upper bits of each number, while interrupt-related
222 * events use the lower bits.
223 */
760a1cae 224#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,16,0))
3bc29f0a 225LTTNG_TRACEPOINT_EVENT(rcu_dyntick,
b87700e3 226
760a1cae
MJ
227 TP_PROTO(const char *polarity, long oldnesting, long newnesting, atomic_t dynticks),
228
229 TP_ARGS(polarity, oldnesting, newnesting, dynticks),
230
231 TP_FIELDS(
232 ctf_string(polarity, polarity)
233 ctf_integer(long, oldnesting, oldnesting)
234 ctf_integer(long, newnesting, newnesting)
235 ctf_integer(int, dynticks, atomic_read(&dynticks))
236 )
237)
238
239#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
240LTTNG_TRACEPOINT_EVENT(rcu_dyntick,
01adf18e 241
01adf18e
MD
242 TP_PROTO(const char *polarity, long long oldnesting, long long newnesting),
243
244 TP_ARGS(polarity, oldnesting, newnesting),
760a1cae
MJ
245
246 TP_FIELDS(
247 ctf_string(polarity, polarity)
248 ctf_integer(long long, oldnesting, oldnesting)
249 ctf_integer(long long, newnesting, newnesting)
250 )
251)
01adf18e 252#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
760a1cae
MJ
253LTTNG_TRACEPOINT_EVENT(rcu_dyntick,
254
b87700e3
AG
255 TP_PROTO(char *polarity, long long oldnesting, long long newnesting),
256
257 TP_ARGS(polarity, oldnesting, newnesting),
760a1cae
MJ
258
259 TP_FIELDS(
260 ctf_string(polarity, polarity)
261 ctf_integer(long long, oldnesting, oldnesting)
262 ctf_integer(long long, newnesting, newnesting)
263 )
264)
b87700e3 265#else
760a1cae
MJ
266LTTNG_TRACEPOINT_EVENT(rcu_dyntick,
267
b87700e3
AG
268 TP_PROTO(char *polarity),
269
270 TP_ARGS(polarity),
b87700e3 271
f127e61e
MD
272 TP_FIELDS(
273 ctf_string(polarity, polarity)
f127e61e 274 )
b87700e3 275)
760a1cae
MJ
276#endif
277
b87700e3
AG
278
279#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
280/*
281 * Tracepoint for RCU preparation for idle, the goal being to get RCU
282 * processing done so that the current CPU can shut off its scheduling
283 * clock and enter dyntick-idle mode. One way to accomplish this is
284 * to drain all RCU callbacks from this CPU, and the other is to have
285 * done everything RCU requires for the current grace period. In this
286 * latter case, the CPU will be awakened at the end of the current grace
287 * period in order to process the remainder of its callbacks.
288 *
289 * These tracepoints take a string as argument:
290 *
291 * "No callbacks": Nothing to do, no callbacks on this CPU.
292 * "In holdoff": Nothing to do, holding off after unsuccessful attempt.
293 * "Begin holdoff": Attempt failed, don't retry until next jiffy.
294 * "Dyntick with callbacks": Entering dyntick-idle despite callbacks.
295 * "Dyntick with lazy callbacks": Entering dyntick-idle w/lazy callbacks.
296 * "More callbacks": Still more callbacks, try again to clear them out.
297 * "Callbacks drained": All callbacks processed, off to dyntick idle!
298 * "Timer": Timer fired to cause CPU to continue processing callbacks.
299 * "Demigrate": Timer fired on wrong CPU, woke up correct CPU.
300 * "Cleanup after idle": Idle exited, timer canceled.
301 */
3bc29f0a 302LTTNG_TRACEPOINT_EVENT(rcu_prep_idle,
b87700e3 303
01adf18e
MD
304#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
305 TP_PROTO(const char *reason),
306#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3 307 TP_PROTO(char *reason),
01adf18e 308#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
309
310 TP_ARGS(reason),
311
f127e61e
MD
312 TP_FIELDS(
313 ctf_string(reason, reason)
314 )
b87700e3
AG
315)
316#endif
317
318/*
319 * Tracepoint for the registration of a single RCU callback function.
320 * The first argument is the type of RCU, the second argument is
321 * a pointer to the RCU callback itself, the third element is the
322 * number of lazy callbacks queued, and the fourth element is the
323 * total number of callbacks queued.
324 */
3bc29f0a 325LTTNG_TRACEPOINT_EVENT(rcu_callback,
b87700e3 326
01adf18e
MD
327#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
328 TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen_lazy,
329 long qlen),
330
331 TP_ARGS(rcuname, rhp, qlen_lazy, qlen),
332#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
b87700e3
AG
333 TP_PROTO(char *rcuname, struct rcu_head *rhp, long qlen_lazy,
334 long qlen),
335
336 TP_ARGS(rcuname, rhp, qlen_lazy, qlen),
337#else
338 TP_PROTO(char *rcuname, struct rcu_head *rhp, long qlen),
339
340 TP_ARGS(rcuname, rhp, qlen),
341#endif
342
f127e61e
MD
343 TP_FIELDS(
344 ctf_string(rcuname, rcuname)
fa91fcac
MD
345 ctf_integer_hex(void *, rhp, rhp)
346 ctf_integer_hex(void *, func, rhp->func)
b87700e3 347#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
f127e61e 348 ctf_integer(long, qlen_lazy, qlen_lazy)
b87700e3 349#endif
f127e61e
MD
350 ctf_integer(long, qlen, qlen)
351 )
b87700e3
AG
352)
353
354/*
355 * Tracepoint for the registration of a single RCU callback of the special
356 * kfree() form. The first argument is the RCU type, the second argument
357 * is a pointer to the RCU callback, the third argument is the offset
358 * of the callback within the enclosing RCU-protected data structure,
359 * the fourth argument is the number of lazy callbacks queued, and the
360 * fifth argument is the total number of callbacks queued.
361 */
3bc29f0a 362LTTNG_TRACEPOINT_EVENT(rcu_kfree_callback,
b87700e3 363
01adf18e
MD
364
365#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
366 TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset,
367 long qlen_lazy, long qlen),
368
369 TP_ARGS(rcuname, rhp, offset, qlen_lazy, qlen),
370#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
b87700e3
AG
371 TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset,
372 long qlen_lazy, long qlen),
373
374 TP_ARGS(rcuname, rhp, offset, qlen_lazy, qlen),
375#else
376 TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset,
377 long qlen),
378
379 TP_ARGS(rcuname, rhp, offset, qlen),
380#endif
381
f127e61e
MD
382 TP_FIELDS(
383 ctf_string(rcuname, rcuname)
fa91fcac
MD
384 ctf_integer_hex(void *, rhp, rhp)
385 ctf_integer_hex(unsigned long, offset, offset)
b87700e3 386#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
f127e61e 387 ctf_integer(long, qlen_lazy, qlen_lazy)
b87700e3 388#endif
f127e61e
MD
389 ctf_integer(long, qlen, qlen)
390 )
b87700e3
AG
391)
392
393/*
394 * Tracepoint for marking the beginning rcu_do_batch, performed to start
395 * RCU callback invocation. The first argument is the RCU flavor,
396 * the second is the number of lazy callbacks queued, the third is
397 * the total number of callbacks queued, and the fourth argument is
398 * the current RCU-callback batch limit.
399 */
3bc29f0a 400LTTNG_TRACEPOINT_EVENT(rcu_batch_start,
b87700e3 401
01adf18e
MD
402#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
403 TP_PROTO(const char *rcuname, long qlen_lazy, long qlen, long blimit),
404
405 TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
406#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
4b4111c9
MD
407 TP_PROTO(char *rcuname, long qlen_lazy, long qlen, long blimit),
408
409 TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
410#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
b87700e3
AG
411 TP_PROTO(char *rcuname, long qlen_lazy, long qlen, int blimit),
412
413 TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
414#else
415 TP_PROTO(char *rcuname, long qlen, int blimit),
416
417 TP_ARGS(rcuname, qlen, blimit),
418#endif
419
f127e61e
MD
420 TP_FIELDS(
421 ctf_string(rcuname, rcuname)
b87700e3 422#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
f127e61e 423 ctf_integer(long, qlen_lazy, qlen_lazy)
b87700e3 424#endif
f127e61e 425 ctf_integer(long, qlen, qlen)
4b4111c9 426#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
f127e61e 427 ctf_integer(long, blimit, blimit)
b87700e3 428#else
f127e61e 429 ctf_integer(int, blimit, blimit)
b87700e3 430#endif
f127e61e 431 )
b87700e3
AG
432)
433
434/*
435 * Tracepoint for the invocation of a single RCU callback function.
436 * The first argument is the type of RCU, and the second argument is
437 * a pointer to the RCU callback itself.
438 */
3bc29f0a 439LTTNG_TRACEPOINT_EVENT(rcu_invoke_callback,
b87700e3 440
01adf18e
MD
441#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
442 TP_PROTO(const char *rcuname, struct rcu_head *rhp),
443#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3 444 TP_PROTO(char *rcuname, struct rcu_head *rhp),
01adf18e 445#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
446
447 TP_ARGS(rcuname, rhp),
448
f127e61e
MD
449 TP_FIELDS(
450 ctf_string(rcuname, rcuname)
fa91fcac
MD
451 ctf_integer_hex(void *, rhp, rhp)
452 ctf_integer_hex(void *, func, rhp->func)
f127e61e 453 )
b87700e3
AG
454)
455
456/*
457 * Tracepoint for the invocation of a single RCU callback of the special
458 * kfree() form. The first argument is the RCU flavor, the second
459 * argument is a pointer to the RCU callback, and the third argument
460 * is the offset of the callback within the enclosing RCU-protected
461 * data structure.
462 */
3bc29f0a 463LTTNG_TRACEPOINT_EVENT(rcu_invoke_kfree_callback,
b87700e3 464
01adf18e
MD
465#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
466 TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset),
467#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3 468 TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset),
01adf18e 469#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
470
471 TP_ARGS(rcuname, rhp, offset),
472
f127e61e
MD
473 TP_FIELDS(
474 ctf_string(rcuname, rcuname)
fa91fcac 475 ctf_integer_hex(void *, rhp, rhp)
f127e61e
MD
476 ctf_integer(unsigned long, offset, offset)
477 )
b87700e3
AG
478)
479
480/*
481 * Tracepoint for exiting rcu_do_batch after RCU callbacks have been
482 * invoked. The first argument is the name of the RCU flavor,
483 * the second argument is number of callbacks actually invoked,
484 * the third argument (cb) is whether or not any of the callbacks that
485 * were ready to invoke at the beginning of this batch are still
486 * queued, the fourth argument (nr) is the return value of need_resched(),
487 * the fifth argument (iit) is 1 if the current task is the idle task,
488 * and the sixth argument (risk) is the return value from
489 * rcu_is_callbacks_kthread().
490 */
3bc29f0a 491LTTNG_TRACEPOINT_EVENT(rcu_batch_end,
b87700e3 492
01adf18e
MD
493#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0))
494 TP_PROTO(const char *rcuname, int callbacks_invoked,
495 char cb, char nr, char iit, char risk),
496
497 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
498#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
499 TP_PROTO(const char *rcuname, int callbacks_invoked,
500 bool cb, bool nr, bool iit, bool risk),
501
502 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
503#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
b87700e3
AG
504 TP_PROTO(char *rcuname, int callbacks_invoked,
505 bool cb, bool nr, bool iit, bool risk),
506
507 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
508#else
509 TP_PROTO(char *rcuname, int callbacks_invoked),
510
511 TP_ARGS(rcuname, callbacks_invoked),
512#endif
513
f127e61e
MD
514 TP_FIELDS(
515 ctf_string(rcuname, rcuname)
516 ctf_integer(int, callbacks_invoked, callbacks_invoked)
01adf18e 517#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0))
f127e61e
MD
518 ctf_integer(char, cb, cb)
519 ctf_integer(char, nr, nr)
520 ctf_integer(char, iit, iit)
521 ctf_integer(char, risk, risk)
01adf18e 522#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
f127e61e
MD
523 ctf_integer(bool, cb, cb)
524 ctf_integer(bool, nr, nr)
525 ctf_integer(bool, iit, iit)
526 ctf_integer(bool, risk, risk)
b87700e3 527#endif
f127e61e 528 )
b87700e3
AG
529)
530
531#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
532/*
533 * Tracepoint for rcutorture readers. The first argument is the name
534 * of the RCU flavor from rcutorture's viewpoint and the second argument
535 * is the callback address.
536 */
3bc29f0a 537LTTNG_TRACEPOINT_EVENT(rcu_torture_read,
b87700e3 538
01adf18e
MD
539#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
540 TP_PROTO(const char *rcutorturename, struct rcu_head *rhp,
541 unsigned long secs, unsigned long c_old, unsigned long c),
542
543 TP_ARGS(rcutorturename, rhp, secs, c_old, c),
544#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
a828b9d5
MD
545 TP_PROTO(char *rcutorturename, struct rcu_head *rhp,
546 unsigned long secs, unsigned long c_old, unsigned long c),
547
548 TP_ARGS(rcutorturename, rhp, secs, c_old, c),
549#else
b87700e3
AG
550 TP_PROTO(char *rcutorturename, struct rcu_head *rhp),
551
552 TP_ARGS(rcutorturename, rhp),
a828b9d5 553#endif
b87700e3 554
f127e61e
MD
555 TP_FIELDS(
556 ctf_string(rcutorturename, rcutorturename)
fa91fcac 557 ctf_integer_hex(struct rcu_head *, rhp, rhp)
a828b9d5 558#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
f127e61e
MD
559 ctf_integer(unsigned long, secs, secs)
560 ctf_integer(unsigned long, c_old, c_old)
561 ctf_integer(unsigned long, c, c)
a828b9d5 562#endif
f127e61e 563 )
b87700e3
AG
564)
565#endif
566
567#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
568/*
569 * Tracepoint for _rcu_barrier() execution. The string "s" describes
570 * the _rcu_barrier phase:
571 * "Begin": rcu_barrier_callback() started.
572 * "Check": rcu_barrier_callback() checking for piggybacking.
573 * "EarlyExit": rcu_barrier_callback() piggybacked, thus early exit.
574 * "Inc1": rcu_barrier_callback() piggyback check counter incremented.
575 * "Offline": rcu_barrier_callback() found offline CPU
576 * "OnlineQ": rcu_barrier_callback() found online CPU with callbacks.
577 * "OnlineNQ": rcu_barrier_callback() found online CPU, no callbacks.
578 * "IRQ": An rcu_barrier_callback() callback posted on remote CPU.
579 * "CB": An rcu_barrier_callback() invoked a callback, not the last.
580 * "LastCB": An rcu_barrier_callback() invoked the last callback.
581 * "Inc2": rcu_barrier_callback() piggyback check counter incremented.
582 * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument
583 * is the count of remaining callbacks, and "done" is the piggybacking count.
584 */
3bc29f0a 585LTTNG_TRACEPOINT_EVENT(rcu_barrier,
b87700e3 586
01adf18e
MD
587#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
588 TP_PROTO(const char *rcuname, const char *s, int cpu, int cnt, unsigned long done),
589#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3 590 TP_PROTO(char *rcuname, char *s, int cpu, int cnt, unsigned long done),
01adf18e 591#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
592
593 TP_ARGS(rcuname, s, cpu, cnt, done),
594
f127e61e
MD
595 TP_FIELDS(
596 ctf_string(rcuname, rcuname)
597 ctf_string(s, s)
598 ctf_integer(int, cpu, cpu)
599 ctf_integer(int, cnt, cnt)
600 ctf_integer(unsigned long, done, done)
601 )
b87700e3
AG
602)
603#endif
604
605#else /* #ifdef CONFIG_RCU_TRACE */
606
607#define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0)
608#define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, \
609 qsmask) do { } while (0)
610#define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0)
611#define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0)
612#define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \
613 grplo, grphi, gp_tasks) do { } \
614 while (0)
615#define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0)
7621c267 616#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,16,0))
f442e68c
MD
617#define trace_rcu_dyntick(polarity, oldnesting, newnesting, dyntick) do { } while (0)
618#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
b87700e3
AG
619#define trace_rcu_dyntick(polarity, oldnesting, newnesting) do { } while (0)
620#else
621#define trace_rcu_dyntick(polarity) do { } while (0)
622#endif
623#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
624#define trace_rcu_prep_idle(reason) do { } while (0)
625#endif
626#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
627#define trace_rcu_callback(rcuname, rhp, qlen_lazy, qlen) do { } while (0)
628#define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen_lazy, qlen) \
629 do { } while (0)
630#define trace_rcu_batch_start(rcuname, qlen_lazy, qlen, blimit) \
631 do { } while (0)
632#else
633#define trace_rcu_callback(rcuname, rhp, qlen) do { } while (0)
634#define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen) do { } while (0)
635#define trace_rcu_batch_start(rcuname, qlen, blimit) do { } while (0)
636#endif
637#define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0)
638#define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0)
639#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
640#define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \
641 do { } while (0)
642#else
643#define trace_rcu_batch_end(rcuname, callbacks_invoked) do { } while (0)
644#endif
a828b9d5
MD
645#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
646#define trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
647 do { } while (0)
648#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
b87700e3
AG
649#define trace_rcu_torture_read(rcutorturename, rhp) do { } while (0)
650#endif
651#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
652#define trace_rcu_barrier(name, s, cpu, cnt, done) do { } while (0)
653#endif
654#endif /* #else #ifdef CONFIG_RCU_TRACE */
655
3bc29f0a 656#endif /* LTTNG_TRACE_RCU_H */
b87700e3
AG
657
658/* This part must be outside protection */
6ec43db8 659#include <probes/define_trace.h>
This page took 0.06015 seconds and 4 git commands to generate.