fix: rcu: Remove kfree_rcu() special casing and lazy-callback (v5.6)
[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 */
248211c9
MJ
53#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
54LTTNG_TRACEPOINT_EVENT(rcu_grace_period,
55
56 TP_PROTO(const char *rcuname, unsigned long gp_seq, const char *gpevent),
57
58 TP_ARGS(rcuname, gp_seq, gpevent),
59
60 TP_FIELDS(
61 ctf_string(rcuname, rcuname)
62 ctf_integer(unsigned long, gp_seq, gp_seq)
63 ctf_string(gpevent, gpevent)
64 )
65)
66#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
3bc29f0a 67LTTNG_TRACEPOINT_EVENT(rcu_grace_period,
b87700e3 68
01adf18e 69 TP_PROTO(const char *rcuname, unsigned long gpnum, const char *gpevent),
248211c9
MJ
70
71 TP_ARGS(rcuname, gpnum, gpevent),
72
73 TP_FIELDS(
74 ctf_string(rcuname, rcuname)
75 ctf_integer(unsigned long, gpnum, gpnum)
76 ctf_string(gpevent, gpevent)
77 )
78)
79#else
80LTTNG_TRACEPOINT_EVENT(rcu_grace_period,
81
b87700e3
AG
82 TP_PROTO(char *rcuname, unsigned long gpnum, char *gpevent),
83
84 TP_ARGS(rcuname, gpnum, gpevent),
85
f127e61e
MD
86 TP_FIELDS(
87 ctf_string(rcuname, rcuname)
88 ctf_integer(unsigned long, gpnum, gpnum)
89 ctf_string(gpevent, gpevent)
90 )
b87700e3 91)
248211c9 92#endif
b87700e3
AG
93
94/*
95 * Tracepoint for grace-period-initialization events. These are
96 * distinguished by the type of RCU, the new grace-period number, the
97 * rcu_node structure level, the starting and ending CPU covered by the
98 * rcu_node structure, and the mask of CPUs that will be waited for.
99 * All but the type of RCU are extracted from the rcu_node structure.
100 */
248211c9
MJ
101#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
102LTTNG_TRACEPOINT_EVENT(rcu_grace_period_init,
103
104 TP_PROTO(const char *rcuname, unsigned long gp_seq, u8 level,
105 int grplo, int grphi, unsigned long qsmask),
106
107 TP_ARGS(rcuname, gp_seq, level, grplo, grphi, qsmask),
108
109 TP_FIELDS(
110 ctf_string(rcuname, rcuname)
111 ctf_integer(unsigned long, gp_seq, gp_seq)
112 ctf_integer(u8, level, level)
113 ctf_integer(int, grplo, grplo)
114 ctf_integer(int, grphi, grphi)
115 ctf_integer(unsigned long, qsmask, qsmask)
116 )
117)
118#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
3bc29f0a 119LTTNG_TRACEPOINT_EVENT(rcu_grace_period_init,
b87700e3 120
01adf18e
MD
121 TP_PROTO(const char *rcuname, unsigned long gpnum, u8 level,
122 int grplo, int grphi, unsigned long qsmask),
248211c9
MJ
123
124 TP_ARGS(rcuname, gpnum, level, grplo, grphi, qsmask),
125
126 TP_FIELDS(
127 ctf_string(rcuname, rcuname)
128 ctf_integer(unsigned long, gpnum, gpnum)
129 ctf_integer(u8, level, level)
130 ctf_integer(int, grplo, grplo)
131 ctf_integer(int, grphi, grphi)
132 ctf_integer(unsigned long, qsmask, qsmask)
133 )
134)
135#else
136LTTNG_TRACEPOINT_EVENT(rcu_grace_period_init,
137
b87700e3
AG
138 TP_PROTO(char *rcuname, unsigned long gpnum, u8 level,
139 int grplo, int grphi, unsigned long qsmask),
140
141 TP_ARGS(rcuname, gpnum, level, grplo, grphi, qsmask),
142
f127e61e
MD
143 TP_FIELDS(
144 ctf_string(rcuname, rcuname)
145 ctf_integer(unsigned long, gpnum, gpnum)
146 ctf_integer(u8, level, level)
147 ctf_integer(int, grplo, grplo)
148 ctf_integer(int, grphi, grphi)
149 ctf_integer(unsigned long, qsmask, qsmask)
150 )
b87700e3 151)
248211c9 152#endif
b87700e3
AG
153
154/*
155 * Tracepoint for tasks blocking within preemptible-RCU read-side
156 * critical sections. Track the type of RCU (which one day might
157 * include SRCU), the grace-period number that the task is blocking
158 * (the current or the next), and the task's PID.
159 */
248211c9
MJ
160#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
161LTTNG_TRACEPOINT_EVENT(rcu_preempt_task,
162
163 TP_PROTO(const char *rcuname, int pid, unsigned long gp_seq),
164
165 TP_ARGS(rcuname, pid, gp_seq),
166
167 TP_FIELDS(
168 ctf_string(rcuname, rcuname)
169 ctf_integer(unsigned long, gp_seq, gp_seq)
170 ctf_integer(int, pid, pid)
171 )
172)
173#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
3bc29f0a 174LTTNG_TRACEPOINT_EVENT(rcu_preempt_task,
b87700e3 175
01adf18e 176 TP_PROTO(const char *rcuname, int pid, unsigned long gpnum),
248211c9
MJ
177
178 TP_ARGS(rcuname, pid, gpnum),
179
180 TP_FIELDS(
181 ctf_string(rcuname, rcuname)
182 ctf_integer(unsigned long, gpnum, gpnum)
183 ctf_integer(int, pid, pid)
184 )
185)
186#else
187LTTNG_TRACEPOINT_EVENT(rcu_preempt_task,
188
b87700e3
AG
189 TP_PROTO(char *rcuname, int pid, unsigned long gpnum),
190
191 TP_ARGS(rcuname, pid, gpnum),
192
f127e61e
MD
193 TP_FIELDS(
194 ctf_string(rcuname, rcuname)
195 ctf_integer(unsigned long, gpnum, gpnum)
196 ctf_integer(int, pid, pid)
197 )
b87700e3 198)
248211c9 199#endif
b87700e3
AG
200
201/*
202 * Tracepoint for tasks that blocked within a given preemptible-RCU
203 * read-side critical section exiting that critical section. Track the
204 * type of RCU (which one day might include SRCU) and the task's PID.
205 */
248211c9
MJ
206#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
207LTTNG_TRACEPOINT_EVENT(rcu_unlock_preempted_task,
208
209 TP_PROTO(const char *rcuname, unsigned long gp_seq, int pid),
210
211 TP_ARGS(rcuname, gp_seq, pid),
212
213 TP_FIELDS(
214 ctf_string(rcuname, rcuname)
215 ctf_integer(unsigned long, gp_seq, gp_seq)
216 ctf_integer(int, pid, pid)
217 )
218)
219#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
3bc29f0a 220LTTNG_TRACEPOINT_EVENT(rcu_unlock_preempted_task,
b87700e3 221
01adf18e 222 TP_PROTO(const char *rcuname, unsigned long gpnum, int pid),
248211c9
MJ
223
224 TP_ARGS(rcuname, gpnum, pid),
225
226 TP_FIELDS(
227 ctf_string(rcuname, rcuname)
228 ctf_integer(unsigned long, gpnum, gpnum)
229 ctf_integer(int, pid, pid)
230 )
231)
232#else
233LTTNG_TRACEPOINT_EVENT(rcu_unlock_preempted_task,
234
b87700e3
AG
235 TP_PROTO(char *rcuname, unsigned long gpnum, int pid),
236
237 TP_ARGS(rcuname, gpnum, pid),
238
f127e61e
MD
239 TP_FIELDS(
240 ctf_string(rcuname, rcuname)
241 ctf_integer(unsigned long, gpnum, gpnum)
242 ctf_integer(int, pid, pid)
243 )
b87700e3 244)
248211c9 245#endif
b87700e3
AG
246
247/*
248 * Tracepoint for quiescent-state-reporting events. These are
249 * distinguished by the type of RCU, the grace-period number, the
250 * mask of quiescent lower-level entities, the rcu_node structure level,
251 * the starting and ending CPU covered by the rcu_node structure, and
252 * whether there are any blocked tasks blocking the current grace period.
253 * All but the type of RCU are extracted from the rcu_node structure.
254 */
248211c9
MJ
255#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
256LTTNG_TRACEPOINT_EVENT(rcu_quiescent_state_report,
257
258 TP_PROTO(const char *rcuname, unsigned long gp_seq,
259 unsigned long mask, unsigned long qsmask,
260 u8 level, int grplo, int grphi, int gp_tasks),
261
262 TP_ARGS(rcuname, gp_seq, mask, qsmask, level, grplo, grphi, gp_tasks),
263
264 TP_FIELDS(
265 ctf_string(rcuname, rcuname)
266 ctf_integer(unsigned long, gp_seq, gp_seq)
267 ctf_integer(unsigned long, mask, mask)
268 ctf_integer(unsigned long, qsmask, qsmask)
269 ctf_integer(u8, level, level)
270 ctf_integer(int, grplo, grplo)
271 ctf_integer(int, grphi, grphi)
272 ctf_integer(u8, gp_tasks, gp_tasks)
273 )
274)
275#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
3bc29f0a 276LTTNG_TRACEPOINT_EVENT(rcu_quiescent_state_report,
b87700e3 277
01adf18e
MD
278 TP_PROTO(const char *rcuname, unsigned long gpnum,
279 unsigned long mask, unsigned long qsmask,
280 u8 level, int grplo, int grphi, int gp_tasks),
248211c9
MJ
281
282 TP_ARGS(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks),
283
284 TP_FIELDS(
285 ctf_string(rcuname, rcuname)
286 ctf_integer(unsigned long, gpnum, gpnum)
287 ctf_integer(unsigned long, mask, mask)
288 ctf_integer(unsigned long, qsmask, qsmask)
289 ctf_integer(u8, level, level)
290 ctf_integer(int, grplo, grplo)
291 ctf_integer(int, grphi, grphi)
292 ctf_integer(u8, gp_tasks, gp_tasks)
293 )
294)
295#else
296LTTNG_TRACEPOINT_EVENT(rcu_quiescent_state_report,
297
b87700e3
AG
298 TP_PROTO(char *rcuname, unsigned long gpnum,
299 unsigned long mask, unsigned long qsmask,
300 u8 level, int grplo, int grphi, int gp_tasks),
301
302 TP_ARGS(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks),
303
f127e61e
MD
304 TP_FIELDS(
305 ctf_string(rcuname, rcuname)
306 ctf_integer(unsigned long, gpnum, gpnum)
307 ctf_integer(unsigned long, mask, mask)
308 ctf_integer(unsigned long, qsmask, qsmask)
309 ctf_integer(u8, level, level)
310 ctf_integer(int, grplo, grplo)
311 ctf_integer(int, grphi, grphi)
312 ctf_integer(u8, gp_tasks, gp_tasks)
313 )
b87700e3 314)
248211c9 315#endif
b87700e3
AG
316
317/*
318 * Tracepoint for quiescent states detected by force_quiescent_state().
319 * These trace events include the type of RCU, the grace-period number
320 * that was blocked by the CPU, the CPU itself, and the type of quiescent
321 * state, which can be "dti" for dyntick-idle mode, "ofl" for CPU offline,
322 * or "kick" when kicking a CPU that has been in dyntick-idle mode for
323 * too long.
324 */
248211c9
MJ
325#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
326LTTNG_TRACEPOINT_EVENT(rcu_fqs,
327
328 TP_PROTO(const char *rcuname, unsigned long gp_seq, int cpu, const char *qsevent),
329
330 TP_ARGS(rcuname, gp_seq, cpu, qsevent),
331
332 TP_FIELDS(
333 ctf_integer(unsigned long, gp_seq, gp_seq)
334 ctf_integer(int, cpu, cpu)
335 ctf_string(rcuname, rcuname)
336 ctf_string(qsevent, qsevent)
337 )
338)
339#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
3bc29f0a 340LTTNG_TRACEPOINT_EVENT(rcu_fqs,
b87700e3 341
01adf18e 342 TP_PROTO(const char *rcuname, unsigned long gpnum, int cpu, const char *qsevent),
248211c9
MJ
343
344 TP_ARGS(rcuname, gpnum, cpu, qsevent),
345
346 TP_FIELDS(
347 ctf_integer(unsigned long, gpnum, gpnum)
348 ctf_integer(int, cpu, cpu)
349 ctf_string(rcuname, rcuname)
350 ctf_string(qsevent, qsevent)
351 )
352)
353#else
354LTTNG_TRACEPOINT_EVENT(rcu_fqs,
355
b87700e3
AG
356 TP_PROTO(char *rcuname, unsigned long gpnum, int cpu, char *qsevent),
357
358 TP_ARGS(rcuname, gpnum, cpu, qsevent),
359
f127e61e
MD
360 TP_FIELDS(
361 ctf_integer(unsigned long, gpnum, gpnum)
362 ctf_integer(int, cpu, cpu)
363 ctf_string(rcuname, rcuname)
364 ctf_string(qsevent, qsevent)
365 )
b87700e3 366)
248211c9 367#endif
b87700e3 368
12318fb8
MD
369#endif /*
370 * #if defined(CONFIG_TREE_RCU)
371 * || (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
372 * && defined(CONFIG_PREEMPT_RCU))
373 * || defined(CONFIG_TREE_PREEMPT_RCU)
374 */
b87700e3
AG
375
376/*
377 * Tracepoint for dyntick-idle entry/exit events. These take a string
378 * as argument: "Start" for entering dyntick-idle mode, "End" for
379 * leaving it, "--=" for events moving towards idle, and "++=" for events
380 * moving away from idle. "Error on entry: not idle task" and "Error on
381 * exit: not idle task" indicate that a non-idle task is erroneously
382 * toying with the idle loop.
383 *
384 * These events also take a pair of numbers, which indicate the nesting
385 * depth before and after the event of interest. Note that task-related
386 * events use the upper bits of each number, while interrupt-related
387 * events use the lower bits.
388 */
6334822c
MJ
389#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0))
390LTTNG_TRACEPOINT_EVENT(rcu_dyntick,
391
392 TP_PROTO(const char *polarity, long oldnesting, long newnesting, int dynticks),
393
394 TP_ARGS(polarity, oldnesting, newnesting, dynticks),
395
396 TP_FIELDS(
397 ctf_string(polarity, polarity)
398 ctf_integer(long, oldnesting, oldnesting)
399 ctf_integer(long, newnesting, newnesting)
400 ctf_integer(int, dynticks, dynticks)
401 )
402)
403
404#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,16,0))
3bc29f0a 405LTTNG_TRACEPOINT_EVENT(rcu_dyntick,
b87700e3 406
760a1cae
MJ
407 TP_PROTO(const char *polarity, long oldnesting, long newnesting, atomic_t dynticks),
408
409 TP_ARGS(polarity, oldnesting, newnesting, dynticks),
410
411 TP_FIELDS(
412 ctf_string(polarity, polarity)
413 ctf_integer(long, oldnesting, oldnesting)
414 ctf_integer(long, newnesting, newnesting)
415 ctf_integer(int, dynticks, atomic_read(&dynticks))
416 )
417)
418
419#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
420LTTNG_TRACEPOINT_EVENT(rcu_dyntick,
01adf18e 421
01adf18e
MD
422 TP_PROTO(const char *polarity, long long oldnesting, long long newnesting),
423
424 TP_ARGS(polarity, oldnesting, newnesting),
760a1cae
MJ
425
426 TP_FIELDS(
427 ctf_string(polarity, polarity)
428 ctf_integer(long long, oldnesting, oldnesting)
429 ctf_integer(long long, newnesting, newnesting)
430 )
431)
01adf18e 432#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
760a1cae
MJ
433LTTNG_TRACEPOINT_EVENT(rcu_dyntick,
434
b87700e3
AG
435 TP_PROTO(char *polarity, long long oldnesting, long long newnesting),
436
437 TP_ARGS(polarity, oldnesting, newnesting),
760a1cae
MJ
438
439 TP_FIELDS(
440 ctf_string(polarity, polarity)
441 ctf_integer(long long, oldnesting, oldnesting)
442 ctf_integer(long long, newnesting, newnesting)
443 )
444)
b87700e3 445#else
760a1cae
MJ
446LTTNG_TRACEPOINT_EVENT(rcu_dyntick,
447
b87700e3
AG
448 TP_PROTO(char *polarity),
449
450 TP_ARGS(polarity),
b87700e3 451
f127e61e
MD
452 TP_FIELDS(
453 ctf_string(polarity, polarity)
f127e61e 454 )
b87700e3 455)
760a1cae
MJ
456#endif
457
b87700e3
AG
458
459#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
460/*
461 * Tracepoint for RCU preparation for idle, the goal being to get RCU
462 * processing done so that the current CPU can shut off its scheduling
463 * clock and enter dyntick-idle mode. One way to accomplish this is
464 * to drain all RCU callbacks from this CPU, and the other is to have
465 * done everything RCU requires for the current grace period. In this
466 * latter case, the CPU will be awakened at the end of the current grace
467 * period in order to process the remainder of its callbacks.
468 *
469 * These tracepoints take a string as argument:
470 *
471 * "No callbacks": Nothing to do, no callbacks on this CPU.
472 * "In holdoff": Nothing to do, holding off after unsuccessful attempt.
473 * "Begin holdoff": Attempt failed, don't retry until next jiffy.
474 * "Dyntick with callbacks": Entering dyntick-idle despite callbacks.
475 * "Dyntick with lazy callbacks": Entering dyntick-idle w/lazy callbacks.
476 * "More callbacks": Still more callbacks, try again to clear them out.
477 * "Callbacks drained": All callbacks processed, off to dyntick idle!
478 * "Timer": Timer fired to cause CPU to continue processing callbacks.
479 * "Demigrate": Timer fired on wrong CPU, woke up correct CPU.
480 * "Cleanup after idle": Idle exited, timer canceled.
481 */
3bc29f0a 482LTTNG_TRACEPOINT_EVENT(rcu_prep_idle,
b87700e3 483
01adf18e
MD
484#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
485 TP_PROTO(const char *reason),
486#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3 487 TP_PROTO(char *reason),
01adf18e 488#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
489
490 TP_ARGS(reason),
491
f127e61e
MD
492 TP_FIELDS(
493 ctf_string(reason, reason)
494 )
b87700e3
AG
495)
496#endif
497
498/*
499 * Tracepoint for the registration of a single RCU callback function.
500 * The first argument is the type of RCU, the second argument is
501 * a pointer to the RCU callback itself, the third element is the
502 * number of lazy callbacks queued, and the fourth element is the
503 * total number of callbacks queued.
504 */
3e22913e
MJ
505#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0))
506LTTNG_TRACEPOINT_EVENT(rcu_callback,
507
508 TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen),
509
510 TP_ARGS(rcuname, rhp, qlen),
511
512 TP_FIELDS(
513 ctf_string(rcuname, rcuname)
514 ctf_integer_hex(void *, rhp, rhp)
515 ctf_integer_hex(void *, func, rhp->func)
516 ctf_integer(long, qlen, qlen)
517 )
518)
519#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
3bc29f0a 520LTTNG_TRACEPOINT_EVENT(rcu_callback,
b87700e3 521
01adf18e
MD
522 TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen_lazy,
523 long qlen),
524
525 TP_ARGS(rcuname, rhp, qlen_lazy, qlen),
3e22913e
MJ
526
527 TP_FIELDS(
528 ctf_string(rcuname, rcuname)
529 ctf_integer_hex(void *, rhp, rhp)
530 ctf_integer_hex(void *, func, rhp->func)
531 ctf_integer(long, qlen_lazy, qlen_lazy)
532 ctf_integer(long, qlen, qlen)
533 )
534)
01adf18e 535#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
3e22913e
MJ
536LTTNG_TRACEPOINT_EVENT(rcu_callback,
537
b87700e3
AG
538 TP_PROTO(char *rcuname, struct rcu_head *rhp, long qlen_lazy,
539 long qlen),
540
541 TP_ARGS(rcuname, rhp, qlen_lazy, qlen),
3e22913e
MJ
542
543 TP_FIELDS(
544 ctf_string(rcuname, rcuname)
545 ctf_integer_hex(void *, rhp, rhp)
546 ctf_integer_hex(void *, func, rhp->func)
547 ctf_integer(long, qlen_lazy, qlen_lazy)
548 ctf_integer(long, qlen, qlen)
549 )
550)
b87700e3 551#else
3e22913e
MJ
552LTTNG_TRACEPOINT_EVENT(rcu_callback,
553
b87700e3
AG
554 TP_PROTO(char *rcuname, struct rcu_head *rhp, long qlen),
555
556 TP_ARGS(rcuname, rhp, qlen),
b87700e3 557
f127e61e
MD
558 TP_FIELDS(
559 ctf_string(rcuname, rcuname)
fa91fcac
MD
560 ctf_integer_hex(void *, rhp, rhp)
561 ctf_integer_hex(void *, func, rhp->func)
f127e61e
MD
562 ctf_integer(long, qlen, qlen)
563 )
b87700e3 564)
3e22913e
MJ
565#endif
566
b87700e3
AG
567
568/*
569 * Tracepoint for the registration of a single RCU callback of the special
570 * kfree() form. The first argument is the RCU type, the second argument
571 * is a pointer to the RCU callback, the third argument is the offset
572 * of the callback within the enclosing RCU-protected data structure,
573 * the fourth argument is the number of lazy callbacks queued, and the
574 * fifth argument is the total number of callbacks queued.
575 */
3e22913e 576#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0))
3bc29f0a 577LTTNG_TRACEPOINT_EVENT(rcu_kfree_callback,
b87700e3 578
3e22913e
MJ
579 TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset,
580 long qlen),
581
582 TP_ARGS(rcuname, rhp, offset, qlen),
583
584 TP_FIELDS(
585 ctf_string(rcuname, rcuname)
586 ctf_integer_hex(void *, rhp, rhp)
587 ctf_integer_hex(unsigned long, offset, offset)
588 ctf_integer(long, qlen, qlen)
589 )
590)
591#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
592LTTNG_TRACEPOINT_EVENT(rcu_kfree_callback,
01adf18e 593
01adf18e
MD
594 TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset,
595 long qlen_lazy, long qlen),
596
597 TP_ARGS(rcuname, rhp, offset, qlen_lazy, qlen),
3e22913e
MJ
598
599 TP_FIELDS(
600 ctf_string(rcuname, rcuname)
601 ctf_integer_hex(void *, rhp, rhp)
602 ctf_integer_hex(unsigned long, offset, offset)
603 ctf_integer(long, qlen_lazy, qlen_lazy)
604 ctf_integer(long, qlen, qlen)
605 )
606)
01adf18e 607#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
3e22913e
MJ
608LTTNG_TRACEPOINT_EVENT(rcu_kfree_callback,
609
b87700e3
AG
610 TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset,
611 long qlen_lazy, long qlen),
612
613 TP_ARGS(rcuname, rhp, offset, qlen_lazy, qlen),
3e22913e
MJ
614
615 TP_FIELDS(
616 ctf_string(rcuname, rcuname)
617 ctf_integer_hex(void *, rhp, rhp)
618 ctf_integer_hex(unsigned long, offset, offset)
619 ctf_integer(long, qlen_lazy, qlen_lazy)
620 ctf_integer(long, qlen, qlen)
621 )
622)
b87700e3 623#else
3e22913e
MJ
624LTTNG_TRACEPOINT_EVENT(rcu_kfree_callback,
625
b87700e3
AG
626 TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset,
627 long qlen),
628
629 TP_ARGS(rcuname, rhp, offset, qlen),
b87700e3 630
f127e61e
MD
631 TP_FIELDS(
632 ctf_string(rcuname, rcuname)
fa91fcac
MD
633 ctf_integer_hex(void *, rhp, rhp)
634 ctf_integer_hex(unsigned long, offset, offset)
f127e61e
MD
635 ctf_integer(long, qlen, qlen)
636 )
b87700e3 637)
3e22913e 638#endif
b87700e3
AG
639
640/*
641 * Tracepoint for marking the beginning rcu_do_batch, performed to start
642 * RCU callback invocation. The first argument is the RCU flavor,
643 * the second is the number of lazy callbacks queued, the third is
644 * the total number of callbacks queued, and the fourth argument is
645 * the current RCU-callback batch limit.
646 */
3e22913e
MJ
647#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0))
648LTTNG_TRACEPOINT_EVENT(rcu_batch_start,
649
650 TP_PROTO(const char *rcuname, long qlen, long blimit),
651
652 TP_ARGS(rcuname, qlen, blimit),
653
654 TP_FIELDS(
655 ctf_string(rcuname, rcuname)
656 ctf_integer(long, qlen, qlen)
657 ctf_integer(long, blimit, blimit)
658 )
659)
660#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
3bc29f0a 661LTTNG_TRACEPOINT_EVENT(rcu_batch_start,
b87700e3 662
01adf18e
MD
663 TP_PROTO(const char *rcuname, long qlen_lazy, long qlen, long blimit),
664
665 TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
3e22913e
MJ
666
667 TP_FIELDS(
668 ctf_string(rcuname, rcuname)
669 ctf_integer(long, qlen_lazy, qlen_lazy)
670 ctf_integer(long, qlen, qlen)
671 ctf_integer(long, blimit, blimit)
672 )
673)
01adf18e 674#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
3e22913e
MJ
675LTTNG_TRACEPOINT_EVENT(rcu_batch_start,
676
4b4111c9
MD
677 TP_PROTO(char *rcuname, long qlen_lazy, long qlen, long blimit),
678
679 TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
3e22913e
MJ
680
681 TP_FIELDS(
682 ctf_string(rcuname, rcuname)
683 ctf_integer(long, qlen_lazy, qlen_lazy)
684 ctf_integer(long, qlen, qlen)
685 ctf_integer(long, blimit, blimit)
686 )
687)
4b4111c9 688#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
3e22913e
MJ
689LTTNG_TRACEPOINT_EVENT(rcu_batch_start,
690
b87700e3
AG
691 TP_PROTO(char *rcuname, long qlen_lazy, long qlen, int blimit),
692
693 TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
3e22913e
MJ
694
695 TP_FIELDS(
696 ctf_string(rcuname, rcuname)
697 ctf_integer(long, qlen_lazy, qlen_lazy)
698 ctf_integer(long, qlen, qlen)
699 ctf_integer(int, blimit, blimit)
700 )
701)
b87700e3 702#else
3e22913e
MJ
703LTTNG_TRACEPOINT_EVENT(rcu_batch_start,
704
b87700e3
AG
705 TP_PROTO(char *rcuname, long qlen, int blimit),
706
707 TP_ARGS(rcuname, qlen, blimit),
b87700e3 708
f127e61e
MD
709 TP_FIELDS(
710 ctf_string(rcuname, rcuname)
f127e61e 711 ctf_integer(long, qlen, qlen)
f127e61e 712 ctf_integer(int, blimit, blimit)
f127e61e 713 )
b87700e3 714)
3e22913e 715#endif
b87700e3
AG
716
717/*
718 * Tracepoint for the invocation of a single RCU callback function.
719 * The first argument is the type of RCU, and the second argument is
720 * a pointer to the RCU callback itself.
721 */
3bc29f0a 722LTTNG_TRACEPOINT_EVENT(rcu_invoke_callback,
b87700e3 723
01adf18e
MD
724#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
725 TP_PROTO(const char *rcuname, struct rcu_head *rhp),
726#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3 727 TP_PROTO(char *rcuname, struct rcu_head *rhp),
01adf18e 728#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
729
730 TP_ARGS(rcuname, rhp),
731
f127e61e
MD
732 TP_FIELDS(
733 ctf_string(rcuname, rcuname)
fa91fcac
MD
734 ctf_integer_hex(void *, rhp, rhp)
735 ctf_integer_hex(void *, func, rhp->func)
f127e61e 736 )
b87700e3
AG
737)
738
739/*
740 * Tracepoint for the invocation of a single RCU callback of the special
741 * kfree() form. The first argument is the RCU flavor, the second
742 * argument is a pointer to the RCU callback, and the third argument
743 * is the offset of the callback within the enclosing RCU-protected
744 * data structure.
745 */
3bc29f0a 746LTTNG_TRACEPOINT_EVENT(rcu_invoke_kfree_callback,
b87700e3 747
01adf18e
MD
748#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
749 TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset),
750#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3 751 TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset),
01adf18e 752#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
753
754 TP_ARGS(rcuname, rhp, offset),
755
f127e61e
MD
756 TP_FIELDS(
757 ctf_string(rcuname, rcuname)
fa91fcac 758 ctf_integer_hex(void *, rhp, rhp)
f127e61e
MD
759 ctf_integer(unsigned long, offset, offset)
760 )
b87700e3
AG
761)
762
763/*
764 * Tracepoint for exiting rcu_do_batch after RCU callbacks have been
765 * invoked. The first argument is the name of the RCU flavor,
766 * the second argument is number of callbacks actually invoked,
767 * the third argument (cb) is whether or not any of the callbacks that
768 * were ready to invoke at the beginning of this batch are still
769 * queued, the fourth argument (nr) is the return value of need_resched(),
770 * the fifth argument (iit) is 1 if the current task is the idle task,
771 * and the sixth argument (risk) is the return value from
772 * rcu_is_callbacks_kthread().
773 */
3bc29f0a 774LTTNG_TRACEPOINT_EVENT(rcu_batch_end,
b87700e3 775
01adf18e
MD
776#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0))
777 TP_PROTO(const char *rcuname, int callbacks_invoked,
778 char cb, char nr, char iit, char risk),
779
780 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
781#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
782 TP_PROTO(const char *rcuname, int callbacks_invoked,
783 bool cb, bool nr, bool iit, bool risk),
784
785 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
786#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
b87700e3
AG
787 TP_PROTO(char *rcuname, int callbacks_invoked,
788 bool cb, bool nr, bool iit, bool risk),
789
790 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
791#else
792 TP_PROTO(char *rcuname, int callbacks_invoked),
793
794 TP_ARGS(rcuname, callbacks_invoked),
795#endif
796
f127e61e
MD
797 TP_FIELDS(
798 ctf_string(rcuname, rcuname)
799 ctf_integer(int, callbacks_invoked, callbacks_invoked)
01adf18e 800#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,13,0))
f127e61e
MD
801 ctf_integer(char, cb, cb)
802 ctf_integer(char, nr, nr)
803 ctf_integer(char, iit, iit)
804 ctf_integer(char, risk, risk)
01adf18e 805#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
f127e61e
MD
806 ctf_integer(bool, cb, cb)
807 ctf_integer(bool, nr, nr)
808 ctf_integer(bool, iit, iit)
809 ctf_integer(bool, risk, risk)
b87700e3 810#endif
f127e61e 811 )
b87700e3
AG
812)
813
814#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
815/*
816 * Tracepoint for rcutorture readers. The first argument is the name
817 * of the RCU flavor from rcutorture's viewpoint and the second argument
818 * is the callback address.
819 */
3bc29f0a 820LTTNG_TRACEPOINT_EVENT(rcu_torture_read,
b87700e3 821
01adf18e
MD
822#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
823 TP_PROTO(const char *rcutorturename, struct rcu_head *rhp,
824 unsigned long secs, unsigned long c_old, unsigned long c),
825
826 TP_ARGS(rcutorturename, rhp, secs, c_old, c),
827#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
a828b9d5
MD
828 TP_PROTO(char *rcutorturename, struct rcu_head *rhp,
829 unsigned long secs, unsigned long c_old, unsigned long c),
830
831 TP_ARGS(rcutorturename, rhp, secs, c_old, c),
832#else
b87700e3
AG
833 TP_PROTO(char *rcutorturename, struct rcu_head *rhp),
834
835 TP_ARGS(rcutorturename, rhp),
a828b9d5 836#endif
b87700e3 837
f127e61e
MD
838 TP_FIELDS(
839 ctf_string(rcutorturename, rcutorturename)
fa91fcac 840 ctf_integer_hex(struct rcu_head *, rhp, rhp)
a828b9d5 841#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
f127e61e
MD
842 ctf_integer(unsigned long, secs, secs)
843 ctf_integer(unsigned long, c_old, c_old)
844 ctf_integer(unsigned long, c, c)
a828b9d5 845#endif
f127e61e 846 )
b87700e3
AG
847)
848#endif
849
850#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
851/*
852 * Tracepoint for _rcu_barrier() execution. The string "s" describes
853 * the _rcu_barrier phase:
854 * "Begin": rcu_barrier_callback() started.
855 * "Check": rcu_barrier_callback() checking for piggybacking.
856 * "EarlyExit": rcu_barrier_callback() piggybacked, thus early exit.
857 * "Inc1": rcu_barrier_callback() piggyback check counter incremented.
858 * "Offline": rcu_barrier_callback() found offline CPU
859 * "OnlineQ": rcu_barrier_callback() found online CPU with callbacks.
860 * "OnlineNQ": rcu_barrier_callback() found online CPU, no callbacks.
861 * "IRQ": An rcu_barrier_callback() callback posted on remote CPU.
862 * "CB": An rcu_barrier_callback() invoked a callback, not the last.
863 * "LastCB": An rcu_barrier_callback() invoked the last callback.
864 * "Inc2": rcu_barrier_callback() piggyback check counter incremented.
865 * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument
866 * is the count of remaining callbacks, and "done" is the piggybacking count.
867 */
3bc29f0a 868LTTNG_TRACEPOINT_EVENT(rcu_barrier,
b87700e3 869
01adf18e
MD
870#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
871 TP_PROTO(const char *rcuname, const char *s, int cpu, int cnt, unsigned long done),
872#else /* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3 873 TP_PROTO(char *rcuname, char *s, int cpu, int cnt, unsigned long done),
01adf18e 874#endif /* #else #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) */
b87700e3
AG
875
876 TP_ARGS(rcuname, s, cpu, cnt, done),
877
f127e61e
MD
878 TP_FIELDS(
879 ctf_string(rcuname, rcuname)
880 ctf_string(s, s)
881 ctf_integer(int, cpu, cpu)
882 ctf_integer(int, cnt, cnt)
883 ctf_integer(unsigned long, done, done)
884 )
b87700e3
AG
885)
886#endif
887
888#else /* #ifdef CONFIG_RCU_TRACE */
889
248211c9
MJ
890#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,19,0))
891#define trace_rcu_grace_period(rcuname, gp_seq, gpevent) do { } while (0)
892#define trace_rcu_grace_period_init(rcuname, gp_seq, level, grplo, grphi, \
893 qsmask) do { } while (0)
894#define trace_rcu_preempt_task(rcuname, pid, gp_seq) do { } while (0)
895#define trace_rcu_unlock_preempted_task(rcuname, gp_seq, pid) do { } while (0)
896#define trace_rcu_quiescent_state_report(rcuname, gp_seq, mask, qsmask, level, \
897 grplo, grphi, gp_tasks) do { } \
898 while (0)
899#define trace_rcu_fqs(rcuname, gp_seq, cpu, qsevent) do { } while (0)
900#else
b87700e3
AG
901#define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0)
902#define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, \
903 qsmask) do { } while (0)
904#define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0)
905#define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0)
906#define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \
907 grplo, grphi, gp_tasks) do { } \
908 while (0)
909#define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0)
248211c9
MJ
910#endif
911
7621c267 912#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,16,0))
f442e68c
MD
913#define trace_rcu_dyntick(polarity, oldnesting, newnesting, dyntick) do { } while (0)
914#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
b87700e3
AG
915#define trace_rcu_dyntick(polarity, oldnesting, newnesting) do { } while (0)
916#else
917#define trace_rcu_dyntick(polarity) do { } while (0)
918#endif
919#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
920#define trace_rcu_prep_idle(reason) do { } while (0)
921#endif
922#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0))
923#define trace_rcu_callback(rcuname, rhp, qlen_lazy, qlen) do { } while (0)
924#define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen_lazy, qlen) \
925 do { } while (0)
926#define trace_rcu_batch_start(rcuname, qlen_lazy, qlen, blimit) \
927 do { } while (0)
928#else
929#define trace_rcu_callback(rcuname, rhp, qlen) do { } while (0)
930#define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen) do { } while (0)
931#define trace_rcu_batch_start(rcuname, qlen, blimit) do { } while (0)
932#endif
933#define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0)
934#define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0)
935#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
936#define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \
937 do { } while (0)
938#else
939#define trace_rcu_batch_end(rcuname, callbacks_invoked) do { } while (0)
940#endif
a828b9d5
MD
941#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
942#define trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
943 do { } while (0)
944#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0))
b87700e3
AG
945#define trace_rcu_torture_read(rcutorturename, rhp) do { } while (0)
946#endif
947#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
948#define trace_rcu_barrier(name, s, cpu, cnt, done) do { } while (0)
949#endif
950#endif /* #else #ifdef CONFIG_RCU_TRACE */
951
3bc29f0a 952#endif /* LTTNG_TRACE_RCU_H */
b87700e3
AG
953
954/* This part must be outside protection */
6ec43db8 955#include <probes/define_trace.h>
This page took 0.074146 seconds and 4 git commands to generate.