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