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