License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[linux-2.6-block.git] / include / trace / events / rcu.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
29c00b4a
PM
2#undef TRACE_SYSTEM
3#define TRACE_SYSTEM rcu
4
5#if !defined(_TRACE_RCU_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_RCU_H
7
8#include <linux/tracepoint.h>
9
10/*
300df91c
PM
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.
385680a9
PM
17 *
18 * An "@" character within "<activity>" is a comment character: Data
19 * reduction scripts will ignore the "@" and the remainder of the line.
300df91c
PM
20 */
21TRACE_EVENT(rcu_utilization,
22
e66c33d5 23 TP_PROTO(const char *s),
300df91c
PM
24
25 TP_ARGS(s),
26
27 TP_STRUCT__entry(
e66c33d5 28 __field(const char *, s)
300df91c
PM
29 ),
30
31 TP_fast_assign(
32 __entry->s = s;
33 ),
34
35 TP_printk("%s", __entry->s)
36);
37
d4c08f2a
PM
38#ifdef CONFIG_RCU_TRACE
39
28f6569a 40#if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU)
d4c08f2a
PM
41
42/*
63c4db78
PM
43 * Tracepoint for grace-period events. Takes a string identifying the
44 * RCU flavor, the grace-period number, and a string identifying the
45 * grace-period-related event as follows:
46 *
47 * "AccReadyCB": CPU acclerates new callbacks to RCU_NEXT_READY_TAIL.
48 * "AccWaitCB": CPU accelerates new callbacks to RCU_WAIT_TAIL.
bb311ecc 49 * "newreq": Request a new grace period.
63c4db78
PM
50 * "start": Start a grace period.
51 * "cpustart": CPU first notices a grace-period start.
52 * "cpuqs": CPU passes through a quiescent state.
53 * "cpuonl": CPU comes online.
54 * "cpuofl": CPU goes offline.
55 * "reqwait": GP kthread sleeps waiting for grace-period request.
56 * "reqwaitsig": GP kthread awakened by signal from reqwait state.
57 * "fqswait": GP kthread waiting until time to force quiescent states.
58 * "fqsstart": GP kthread starts forcing quiescent states.
59 * "fqsend": GP kthread done forcing quiescent states.
60 * "fqswaitsig": GP kthread awakened by signal from fqswait state.
61 * "end": End a grace period.
62 * "cpuend": CPU first notices a grace-period end.
d4c08f2a
PM
63 */
64TRACE_EVENT(rcu_grace_period,
65
e66c33d5 66 TP_PROTO(const char *rcuname, unsigned long gpnum, const char *gpevent),
d4c08f2a
PM
67
68 TP_ARGS(rcuname, gpnum, gpevent),
69
70 TP_STRUCT__entry(
e66c33d5 71 __field(const char *, rcuname)
d4c08f2a 72 __field(unsigned long, gpnum)
e66c33d5 73 __field(const char *, gpevent)
d4c08f2a
PM
74 ),
75
76 TP_fast_assign(
77 __entry->rcuname = rcuname;
78 __entry->gpnum = gpnum;
79 __entry->gpevent = gpevent;
80 ),
81
82 TP_printk("%s %lu %s",
83 __entry->rcuname, __entry->gpnum, __entry->gpevent)
84);
85
09c7b890 86/*
bd9f0686
PM
87 * Tracepoint for future grace-period events, including those for no-callbacks
88 * CPUs. The caller should pull the data from the rcu_node structure,
89 * other than rcuname, which comes from the rcu_state structure, and event,
90 * which is one of the following:
09c7b890
PM
91 *
92 * "Startleaf": Request a nocb grace period based on leaf-node data.
93 * "Startedleaf": Leaf-node start proved sufficient.
94 * "Startedleafroot": Leaf-node start proved sufficient after checking root.
95 * "Startedroot": Requested a nocb grace period based on root-node data.
96 * "StartWait": Start waiting for the requested grace period.
97 * "ResumeWait": Resume waiting after signal.
98 * "EndWait": Complete wait.
99 * "Cleanup": Clean up rcu_node structure after previous GP.
100 * "CleanupMore": Clean up, and another no-CB GP is needed.
101 */
bd9f0686 102TRACE_EVENT(rcu_future_grace_period,
09c7b890 103
e66c33d5 104 TP_PROTO(const char *rcuname, unsigned long gpnum, unsigned long completed,
09c7b890 105 unsigned long c, u8 level, int grplo, int grphi,
e66c33d5 106 const char *gpevent),
09c7b890
PM
107
108 TP_ARGS(rcuname, gpnum, completed, c, level, grplo, grphi, gpevent),
109
110 TP_STRUCT__entry(
e66c33d5 111 __field(const char *, rcuname)
09c7b890
PM
112 __field(unsigned long, gpnum)
113 __field(unsigned long, completed)
114 __field(unsigned long, c)
115 __field(u8, level)
116 __field(int, grplo)
117 __field(int, grphi)
e66c33d5 118 __field(const char *, gpevent)
09c7b890
PM
119 ),
120
121 TP_fast_assign(
122 __entry->rcuname = rcuname;
123 __entry->gpnum = gpnum;
124 __entry->completed = completed;
125 __entry->c = c;
126 __entry->level = level;
127 __entry->grplo = grplo;
128 __entry->grphi = grphi;
129 __entry->gpevent = gpevent;
130 ),
131
132 TP_printk("%s %lu %lu %lu %u %d %d %s",
133 __entry->rcuname, __entry->gpnum, __entry->completed,
134 __entry->c, __entry->level, __entry->grplo, __entry->grphi,
135 __entry->gpevent)
136);
137
d4c08f2a
PM
138/*
139 * Tracepoint for grace-period-initialization events. These are
140 * distinguished by the type of RCU, the new grace-period number, the
141 * rcu_node structure level, the starting and ending CPU covered by the
142 * rcu_node structure, and the mask of CPUs that will be waited for.
143 * All but the type of RCU are extracted from the rcu_node structure.
144 */
145TRACE_EVENT(rcu_grace_period_init,
146
e66c33d5 147 TP_PROTO(const char *rcuname, unsigned long gpnum, u8 level,
d4c08f2a
PM
148 int grplo, int grphi, unsigned long qsmask),
149
150 TP_ARGS(rcuname, gpnum, level, grplo, grphi, qsmask),
151
152 TP_STRUCT__entry(
e66c33d5 153 __field(const char *, rcuname)
d4c08f2a
PM
154 __field(unsigned long, gpnum)
155 __field(u8, level)
156 __field(int, grplo)
157 __field(int, grphi)
158 __field(unsigned long, qsmask)
159 ),
160
161 TP_fast_assign(
162 __entry->rcuname = rcuname;
163 __entry->gpnum = gpnum;
164 __entry->level = level;
165 __entry->grplo = grplo;
166 __entry->grphi = grphi;
167 __entry->qsmask = qsmask;
168 ),
169
170 TP_printk("%s %lu %u %d %d %lx",
171 __entry->rcuname, __entry->gpnum, __entry->level,
172 __entry->grplo, __entry->grphi, __entry->qsmask)
173);
174
e087816d
PM
175/*
176 * Tracepoint for expedited grace-period events. Takes a string identifying
177 * the RCU flavor, the expedited grace-period sequence number, and a string
178 * identifying the grace-period-related event as follows:
179 *
180 * "snap": Captured snapshot of expedited grace period sequence number.
181 * "start": Started a real expedited grace period.
182 * "end": Ended a real expedited grace period.
f6a12f34 183 * "endwake": Woke piggybackers up.
e087816d
PM
184 * "done": Someone else did the expedited grace period for us.
185 */
186TRACE_EVENT(rcu_exp_grace_period,
187
188 TP_PROTO(const char *rcuname, unsigned long gpseq, const char *gpevent),
189
190 TP_ARGS(rcuname, gpseq, gpevent),
191
192 TP_STRUCT__entry(
193 __field(const char *, rcuname)
194 __field(unsigned long, gpseq)
195 __field(const char *, gpevent)
196 ),
197
198 TP_fast_assign(
199 __entry->rcuname = rcuname;
200 __entry->gpseq = gpseq;
201 __entry->gpevent = gpevent;
202 ),
203
204 TP_printk("%s %lu %s",
205 __entry->rcuname, __entry->gpseq, __entry->gpevent)
206);
207
208/*
209 * Tracepoint for expedited grace-period funnel-locking events. Takes a
210 * string identifying the RCU flavor, an integer identifying the rcu_node
211 * combining-tree level, another pair of integers identifying the lowest-
212 * and highest-numbered CPU associated with the current rcu_node structure,
213 * and a string. identifying the grace-period-related event as follows:
214 *
f6a12f34
PM
215 * "nxtlvl": Advance to next level of rcu_node funnel
216 * "wait": Wait for someone else to do expedited GP
e087816d
PM
217 */
218TRACE_EVENT(rcu_exp_funnel_lock,
219
220 TP_PROTO(const char *rcuname, u8 level, int grplo, int grphi,
221 const char *gpevent),
222
223 TP_ARGS(rcuname, level, grplo, grphi, gpevent),
224
225 TP_STRUCT__entry(
226 __field(const char *, rcuname)
227 __field(u8, level)
228 __field(int, grplo)
229 __field(int, grphi)
230 __field(const char *, gpevent)
231 ),
232
233 TP_fast_assign(
234 __entry->rcuname = rcuname;
235 __entry->level = level;
236 __entry->grplo = grplo;
237 __entry->grphi = grphi;
238 __entry->gpevent = gpevent;
239 ),
240
241 TP_printk("%s %d %d %d %s",
242 __entry->rcuname, __entry->level, __entry->grplo,
243 __entry->grphi, __entry->gpevent)
244);
245
9261dd0d
PM
246/*
247 * Tracepoint for RCU no-CBs CPU callback handoffs. This event is intended
248 * to assist debugging of these handoffs.
249 *
250 * The first argument is the name of the RCU flavor, and the second is
251 * the number of the offloaded CPU are extracted. The third and final
252 * argument is a string as follows:
253 *
254 * "WakeEmpty": Wake rcuo kthread, first CB to empty list.
9fdd3bc9 255 * "WakeEmptyIsDeferred": Wake rcuo kthread later, first CB to empty list.
9261dd0d 256 * "WakeOvf": Wake rcuo kthread, CB list is huge.
9fdd3bc9 257 * "WakeOvfIsDeferred": Wake rcuo kthread later, CB list is huge.
9261dd0d
PM
258 * "WakeNot": Don't wake rcuo kthread.
259 * "WakeNotPoll": Don't wake rcuo kthread because it is polling.
9fdd3bc9 260 * "DeferredWake": Carried out the "IsDeferred" wakeup.
69a79bb1
PM
261 * "Poll": Start of new polling cycle for rcu_nocb_poll.
262 * "Sleep": Sleep waiting for CBs for !rcu_nocb_poll.
9261dd0d
PM
263 * "WokeEmpty": rcuo kthread woke to find empty list.
264 * "WokeNonEmpty": rcuo kthread woke to find non-empty list.
69a79bb1
PM
265 * "WaitQueue": Enqueue partially done, timed wait for it to complete.
266 * "WokeQueue": Partial enqueue now complete.
9261dd0d
PM
267 */
268TRACE_EVENT(rcu_nocb_wake,
269
270 TP_PROTO(const char *rcuname, int cpu, const char *reason),
271
272 TP_ARGS(rcuname, cpu, reason),
273
274 TP_STRUCT__entry(
275 __field(const char *, rcuname)
276 __field(int, cpu)
277 __field(const char *, reason)
278 ),
279
280 TP_fast_assign(
281 __entry->rcuname = rcuname;
282 __entry->cpu = cpu;
283 __entry->reason = reason;
284 ),
285
286 TP_printk("%s %d %s", __entry->rcuname, __entry->cpu, __entry->reason)
287);
288
d4c08f2a
PM
289/*
290 * Tracepoint for tasks blocking within preemptible-RCU read-side
291 * critical sections. Track the type of RCU (which one day might
292 * include SRCU), the grace-period number that the task is blocking
293 * (the current or the next), and the task's PID.
294 */
295TRACE_EVENT(rcu_preempt_task,
296
e66c33d5 297 TP_PROTO(const char *rcuname, int pid, unsigned long gpnum),
d4c08f2a
PM
298
299 TP_ARGS(rcuname, pid, gpnum),
300
301 TP_STRUCT__entry(
e66c33d5 302 __field(const char *, rcuname)
d4c08f2a
PM
303 __field(unsigned long, gpnum)
304 __field(int, pid)
305 ),
306
307 TP_fast_assign(
308 __entry->rcuname = rcuname;
309 __entry->gpnum = gpnum;
310 __entry->pid = pid;
311 ),
312
313 TP_printk("%s %lu %d",
314 __entry->rcuname, __entry->gpnum, __entry->pid)
315);
316
317/*
318 * Tracepoint for tasks that blocked within a given preemptible-RCU
319 * read-side critical section exiting that critical section. Track the
320 * type of RCU (which one day might include SRCU) and the task's PID.
321 */
322TRACE_EVENT(rcu_unlock_preempted_task,
323
e66c33d5 324 TP_PROTO(const char *rcuname, unsigned long gpnum, int pid),
d4c08f2a
PM
325
326 TP_ARGS(rcuname, gpnum, pid),
327
328 TP_STRUCT__entry(
e66c33d5 329 __field(const char *, rcuname)
d4c08f2a
PM
330 __field(unsigned long, gpnum)
331 __field(int, pid)
332 ),
333
334 TP_fast_assign(
335 __entry->rcuname = rcuname;
336 __entry->gpnum = gpnum;
337 __entry->pid = pid;
338 ),
339
340 TP_printk("%s %lu %d", __entry->rcuname, __entry->gpnum, __entry->pid)
341);
342
343/*
344 * Tracepoint for quiescent-state-reporting events. These are
345 * distinguished by the type of RCU, the grace-period number, the
346 * mask of quiescent lower-level entities, the rcu_node structure level,
347 * the starting and ending CPU covered by the rcu_node structure, and
348 * whether there are any blocked tasks blocking the current grace period.
349 * All but the type of RCU are extracted from the rcu_node structure.
350 */
351TRACE_EVENT(rcu_quiescent_state_report,
352
e66c33d5 353 TP_PROTO(const char *rcuname, unsigned long gpnum,
d4c08f2a
PM
354 unsigned long mask, unsigned long qsmask,
355 u8 level, int grplo, int grphi, int gp_tasks),
356
357 TP_ARGS(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks),
358
359 TP_STRUCT__entry(
e66c33d5 360 __field(const char *, rcuname)
d4c08f2a
PM
361 __field(unsigned long, gpnum)
362 __field(unsigned long, mask)
363 __field(unsigned long, qsmask)
364 __field(u8, level)
365 __field(int, grplo)
366 __field(int, grphi)
367 __field(u8, gp_tasks)
368 ),
369
370 TP_fast_assign(
371 __entry->rcuname = rcuname;
372 __entry->gpnum = gpnum;
373 __entry->mask = mask;
374 __entry->qsmask = qsmask;
375 __entry->level = level;
376 __entry->grplo = grplo;
377 __entry->grphi = grphi;
378 __entry->gp_tasks = gp_tasks;
379 ),
380
381 TP_printk("%s %lu %lx>%lx %u %d %d %u",
382 __entry->rcuname, __entry->gpnum,
383 __entry->mask, __entry->qsmask, __entry->level,
384 __entry->grplo, __entry->grphi, __entry->gp_tasks)
385);
386
387/*
388 * Tracepoint for quiescent states detected by force_quiescent_state().
3a19b46a
PM
389 * These trace events include the type of RCU, the grace-period number that
390 * was blocked by the CPU, the CPU itself, and the type of quiescent state,
391 * which can be "dti" for dyntick-idle mode, "ofl" for CPU offline, "kick"
392 * when kicking a CPU that has been in dyntick-idle mode for too long, or
393 * "rqc" if the CPU got a quiescent state via its rcu_qs_ctr.
d4c08f2a
PM
394 */
395TRACE_EVENT(rcu_fqs,
396
e66c33d5 397 TP_PROTO(const char *rcuname, unsigned long gpnum, int cpu, const char *qsevent),
d4c08f2a
PM
398
399 TP_ARGS(rcuname, gpnum, cpu, qsevent),
400
401 TP_STRUCT__entry(
e66c33d5 402 __field(const char *, rcuname)
d4c08f2a
PM
403 __field(unsigned long, gpnum)
404 __field(int, cpu)
e66c33d5 405 __field(const char *, qsevent)
d4c08f2a
PM
406 ),
407
408 TP_fast_assign(
409 __entry->rcuname = rcuname;
410 __entry->gpnum = gpnum;
411 __entry->cpu = cpu;
412 __entry->qsevent = qsevent;
413 ),
414
415 TP_printk("%s %lu %d %s",
416 __entry->rcuname, __entry->gpnum,
417 __entry->cpu, __entry->qsevent)
418);
419
28f6569a 420#endif /* #if defined(CONFIG_TREE_RCU) || defined(CONFIG_PREEMPT_RCU) */
d4c08f2a
PM
421
422/*
423 * Tracepoint for dyntick-idle entry/exit events. These take a string
045fb931
PM
424 * as argument: "Start" for entering dyntick-idle mode, "End" for
425 * leaving it, "--=" for events moving towards idle, and "++=" for events
426 * moving away from idle. "Error on entry: not idle task" and "Error on
427 * exit: not idle task" indicate that a non-idle task is erroneously
428 * toying with the idle loop.
429 *
430 * These events also take a pair of numbers, which indicate the nesting
431 * depth before and after the event of interest. Note that task-related
432 * events use the upper bits of each number, while interrupt-related
433 * events use the lower bits.
d4c08f2a
PM
434 */
435TRACE_EVENT(rcu_dyntick,
436
e66c33d5 437 TP_PROTO(const char *polarity, long long oldnesting, long long newnesting),
d4c08f2a 438
4145fa7f 439 TP_ARGS(polarity, oldnesting, newnesting),
d4c08f2a
PM
440
441 TP_STRUCT__entry(
e66c33d5 442 __field(const char *, polarity)
4145fa7f
PM
443 __field(long long, oldnesting)
444 __field(long long, newnesting)
d4c08f2a
PM
445 ),
446
447 TP_fast_assign(
448 __entry->polarity = polarity;
4145fa7f
PM
449 __entry->oldnesting = oldnesting;
450 __entry->newnesting = newnesting;
d4c08f2a
PM
451 ),
452
4145fa7f
PM
453 TP_printk("%s %llx %llx", __entry->polarity,
454 __entry->oldnesting, __entry->newnesting)
d4c08f2a
PM
455);
456
433cdddc
PM
457/*
458 * Tracepoint for RCU preparation for idle, the goal being to get RCU
459 * processing done so that the current CPU can shut off its scheduling
460 * clock and enter dyntick-idle mode. One way to accomplish this is
461 * to drain all RCU callbacks from this CPU, and the other is to have
462 * done everything RCU requires for the current grace period. In this
463 * latter case, the CPU will be awakened at the end of the current grace
464 * period in order to process the remainder of its callbacks.
465 *
466 * These tracepoints take a string as argument:
467 *
468 * "No callbacks": Nothing to do, no callbacks on this CPU.
469 * "In holdoff": Nothing to do, holding off after unsuccessful attempt.
433cdddc 470 * "Begin holdoff": Attempt failed, don't retry until next jiffy.
7cb92499 471 * "Dyntick with callbacks": Entering dyntick-idle despite callbacks.
fd4b3526 472 * "Dyntick with lazy callbacks": Entering dyntick-idle w/lazy callbacks.
433cdddc
PM
473 * "More callbacks": Still more callbacks, try again to clear them out.
474 * "Callbacks drained": All callbacks processed, off to dyntick idle!
7cb92499 475 * "Timer": Timer fired to cause CPU to continue processing callbacks.
21e52e15 476 * "Demigrate": Timer fired on wrong CPU, woke up correct CPU.
2fdbb31b 477 * "Cleanup after idle": Idle exited, timer canceled.
433cdddc
PM
478 */
479TRACE_EVENT(rcu_prep_idle,
480
e66c33d5 481 TP_PROTO(const char *reason),
433cdddc
PM
482
483 TP_ARGS(reason),
484
485 TP_STRUCT__entry(
e66c33d5 486 __field(const char *, reason)
433cdddc
PM
487 ),
488
489 TP_fast_assign(
490 __entry->reason = reason;
491 ),
492
493 TP_printk("%s", __entry->reason)
494);
495
d4c08f2a
PM
496/*
497 * Tracepoint for the registration of a single RCU callback function.
498 * The first argument is the type of RCU, the second argument is
486e2593
PM
499 * a pointer to the RCU callback itself, the third element is the
500 * number of lazy callbacks queued, and the fourth element is the
501 * total number of callbacks queued.
d4c08f2a
PM
502 */
503TRACE_EVENT(rcu_callback,
504
e66c33d5 505 TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen_lazy,
486e2593 506 long qlen),
d4c08f2a 507
486e2593 508 TP_ARGS(rcuname, rhp, qlen_lazy, qlen),
d4c08f2a
PM
509
510 TP_STRUCT__entry(
e66c33d5 511 __field(const char *, rcuname)
d4c08f2a
PM
512 __field(void *, rhp)
513 __field(void *, func)
486e2593 514 __field(long, qlen_lazy)
d4c08f2a
PM
515 __field(long, qlen)
516 ),
517
518 TP_fast_assign(
519 __entry->rcuname = rcuname;
520 __entry->rhp = rhp;
521 __entry->func = rhp->func;
486e2593 522 __entry->qlen_lazy = qlen_lazy;
d4c08f2a
PM
523 __entry->qlen = qlen;
524 ),
525
486e2593
PM
526 TP_printk("%s rhp=%p func=%pf %ld/%ld",
527 __entry->rcuname, __entry->rhp, __entry->func,
528 __entry->qlen_lazy, __entry->qlen)
d4c08f2a
PM
529);
530
531/*
532 * Tracepoint for the registration of a single RCU callback of the special
533 * kfree() form. The first argument is the RCU type, the second argument
534 * is a pointer to the RCU callback, the third argument is the offset
535 * of the callback within the enclosing RCU-protected data structure,
486e2593
PM
536 * the fourth argument is the number of lazy callbacks queued, and the
537 * fifth argument is the total number of callbacks queued.
d4c08f2a
PM
538 */
539TRACE_EVENT(rcu_kfree_callback,
540
e66c33d5 541 TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset,
486e2593 542 long qlen_lazy, long qlen),
d4c08f2a 543
486e2593 544 TP_ARGS(rcuname, rhp, offset, qlen_lazy, qlen),
d4c08f2a
PM
545
546 TP_STRUCT__entry(
e66c33d5 547 __field(const char *, rcuname)
d4c08f2a
PM
548 __field(void *, rhp)
549 __field(unsigned long, offset)
486e2593 550 __field(long, qlen_lazy)
d4c08f2a
PM
551 __field(long, qlen)
552 ),
553
554 TP_fast_assign(
555 __entry->rcuname = rcuname;
556 __entry->rhp = rhp;
557 __entry->offset = offset;
486e2593 558 __entry->qlen_lazy = qlen_lazy;
d4c08f2a
PM
559 __entry->qlen = qlen;
560 ),
561
486e2593 562 TP_printk("%s rhp=%p func=%ld %ld/%ld",
d4c08f2a 563 __entry->rcuname, __entry->rhp, __entry->offset,
486e2593 564 __entry->qlen_lazy, __entry->qlen)
d4c08f2a
PM
565);
566
300df91c
PM
567/*
568 * Tracepoint for marking the beginning rcu_do_batch, performed to start
72fe701b 569 * RCU callback invocation. The first argument is the RCU flavor,
486e2593
PM
570 * the second is the number of lazy callbacks queued, the third is
571 * the total number of callbacks queued, and the fourth argument is
572 * the current RCU-callback batch limit.
29c00b4a
PM
573 */
574TRACE_EVENT(rcu_batch_start,
575
e66c33d5 576 TP_PROTO(const char *rcuname, long qlen_lazy, long qlen, long blimit),
29c00b4a 577
486e2593 578 TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
29c00b4a
PM
579
580 TP_STRUCT__entry(
e66c33d5 581 __field(const char *, rcuname)
486e2593 582 __field(long, qlen_lazy)
300df91c 583 __field(long, qlen)
3aac7a8d 584 __field(long, blimit)
29c00b4a
PM
585 ),
586
587 TP_fast_assign(
72fe701b 588 __entry->rcuname = rcuname;
486e2593 589 __entry->qlen_lazy = qlen_lazy;
300df91c
PM
590 __entry->qlen = qlen;
591 __entry->blimit = blimit;
29c00b4a
PM
592 ),
593
3aac7a8d 594 TP_printk("%s CBs=%ld/%ld bl=%ld",
486e2593
PM
595 __entry->rcuname, __entry->qlen_lazy, __entry->qlen,
596 __entry->blimit)
29c00b4a
PM
597);
598
599/*
300df91c 600 * Tracepoint for the invocation of a single RCU callback function.
d4c08f2a
PM
601 * The first argument is the type of RCU, and the second argument is
602 * a pointer to the RCU callback itself.
29c00b4a
PM
603 */
604TRACE_EVENT(rcu_invoke_callback,
605
e66c33d5 606 TP_PROTO(const char *rcuname, struct rcu_head *rhp),
29c00b4a 607
d4c08f2a 608 TP_ARGS(rcuname, rhp),
29c00b4a
PM
609
610 TP_STRUCT__entry(
e66c33d5 611 __field(const char *, rcuname)
d4c08f2a
PM
612 __field(void *, rhp)
613 __field(void *, func)
29c00b4a
PM
614 ),
615
616 TP_fast_assign(
d4c08f2a 617 __entry->rcuname = rcuname;
300df91c
PM
618 __entry->rhp = rhp;
619 __entry->func = rhp->func;
29c00b4a
PM
620 ),
621
d4c08f2a
PM
622 TP_printk("%s rhp=%p func=%pf",
623 __entry->rcuname, __entry->rhp, __entry->func)
29c00b4a
PM
624);
625
626/*
300df91c 627 * Tracepoint for the invocation of a single RCU callback of the special
d4c08f2a
PM
628 * kfree() form. The first argument is the RCU flavor, the second
629 * argument is a pointer to the RCU callback, and the third argument
630 * is the offset of the callback within the enclosing RCU-protected
631 * data structure.
29c00b4a
PM
632 */
633TRACE_EVENT(rcu_invoke_kfree_callback,
634
e66c33d5 635 TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset),
29c00b4a 636
d4c08f2a 637 TP_ARGS(rcuname, rhp, offset),
29c00b4a
PM
638
639 TP_STRUCT__entry(
e66c33d5 640 __field(const char *, rcuname)
d4c08f2a 641 __field(void *, rhp)
300df91c 642 __field(unsigned long, offset)
29c00b4a
PM
643 ),
644
645 TP_fast_assign(
d4c08f2a 646 __entry->rcuname = rcuname;
300df91c 647 __entry->rhp = rhp;
29c00b4a
PM
648 __entry->offset = offset;
649 ),
650
d4c08f2a
PM
651 TP_printk("%s rhp=%p func=%ld",
652 __entry->rcuname, __entry->rhp, __entry->offset)
29c00b4a
PM
653);
654
655/*
300df91c 656 * Tracepoint for exiting rcu_do_batch after RCU callbacks have been
4968c300
PM
657 * invoked. The first argument is the name of the RCU flavor,
658 * the second argument is number of callbacks actually invoked,
659 * the third argument (cb) is whether or not any of the callbacks that
660 * were ready to invoke at the beginning of this batch are still
661 * queued, the fourth argument (nr) is the return value of need_resched(),
662 * the fifth argument (iit) is 1 if the current task is the idle task,
663 * and the sixth argument (risk) is the return value from
664 * rcu_is_callbacks_kthread().
29c00b4a
PM
665 */
666TRACE_EVENT(rcu_batch_end,
667
e66c33d5 668 TP_PROTO(const char *rcuname, int callbacks_invoked,
15f5191b 669 char cb, char nr, char iit, char risk),
29c00b4a 670
4968c300 671 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
29c00b4a
PM
672
673 TP_STRUCT__entry(
e66c33d5 674 __field(const char *, rcuname)
300df91c 675 __field(int, callbacks_invoked)
15f5191b
PM
676 __field(char, cb)
677 __field(char, nr)
678 __field(char, iit)
679 __field(char, risk)
29c00b4a
PM
680 ),
681
682 TP_fast_assign(
72fe701b 683 __entry->rcuname = rcuname;
300df91c 684 __entry->callbacks_invoked = callbacks_invoked;
4968c300
PM
685 __entry->cb = cb;
686 __entry->nr = nr;
687 __entry->iit = iit;
688 __entry->risk = risk;
689 ),
690
691 TP_printk("%s CBs-invoked=%d idle=%c%c%c%c",
692 __entry->rcuname, __entry->callbacks_invoked,
693 __entry->cb ? 'C' : '.',
694 __entry->nr ? 'S' : '.',
695 __entry->iit ? 'I' : '.',
696 __entry->risk ? 'R' : '.')
29c00b4a
PM
697);
698
91afaf30
PM
699/*
700 * Tracepoint for rcutorture readers. The first argument is the name
701 * of the RCU flavor from rcutorture's viewpoint and the second argument
d0af39e8
PM
702 * is the callback address. The third argument is the start time in
703 * seconds, and the last two arguments are the grace period numbers
704 * at the beginning and end of the read, respectively. Note that the
705 * callback address can be NULL.
91afaf30 706 */
b3c98314 707#define RCUTORTURENAME_LEN 8
91afaf30
PM
708TRACE_EVENT(rcu_torture_read,
709
e66c33d5 710 TP_PROTO(const char *rcutorturename, struct rcu_head *rhp,
52494535 711 unsigned long secs, unsigned long c_old, unsigned long c),
91afaf30 712
52494535 713 TP_ARGS(rcutorturename, rhp, secs, c_old, c),
91afaf30
PM
714
715 TP_STRUCT__entry(
b3c98314 716 __field(char, rcutorturename[RCUTORTURENAME_LEN])
91afaf30 717 __field(struct rcu_head *, rhp)
52494535
PM
718 __field(unsigned long, secs)
719 __field(unsigned long, c_old)
720 __field(unsigned long, c)
91afaf30
PM
721 ),
722
723 TP_fast_assign(
b3c98314
PM
724 strncpy(__entry->rcutorturename, rcutorturename,
725 RCUTORTURENAME_LEN);
726 __entry->rcutorturename[RCUTORTURENAME_LEN - 1] = 0;
91afaf30 727 __entry->rhp = rhp;
52494535
PM
728 __entry->secs = secs;
729 __entry->c_old = c_old;
730 __entry->c = c;
91afaf30
PM
731 ),
732
52494535
PM
733 TP_printk("%s torture read %p %luus c: %lu %lu",
734 __entry->rcutorturename, __entry->rhp,
735 __entry->secs, __entry->c_old, __entry->c)
91afaf30
PM
736);
737
a83eff0a
PM
738/*
739 * Tracepoint for _rcu_barrier() execution. The string "s" describes
740 * the _rcu_barrier phase:
d7e29933 741 * "Begin": _rcu_barrier() started.
d7e29933
PM
742 * "EarlyExit": _rcu_barrier() piggybacked, thus early exit.
743 * "Inc1": _rcu_barrier() piggyback check counter incremented.
744 * "OfflineNoCB": _rcu_barrier() found callback on never-online CPU
745 * "OnlineNoCB": _rcu_barrier() found online no-CBs CPU.
746 * "OnlineQ": _rcu_barrier() found online CPU with callbacks.
747 * "OnlineNQ": _rcu_barrier() found online CPU, no callbacks.
a83eff0a 748 * "IRQ": An rcu_barrier_callback() callback posted on remote CPU.
f92c734f 749 * "IRQNQ": An rcu_barrier_callback() callback found no callbacks.
a83eff0a
PM
750 * "CB": An rcu_barrier_callback() invoked a callback, not the last.
751 * "LastCB": An rcu_barrier_callback() invoked the last callback.
d7e29933 752 * "Inc2": _rcu_barrier() piggyback check counter incremented.
a83eff0a
PM
753 * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument
754 * is the count of remaining callbacks, and "done" is the piggybacking count.
755 */
756TRACE_EVENT(rcu_barrier,
757
e66c33d5 758 TP_PROTO(const char *rcuname, const char *s, int cpu, int cnt, unsigned long done),
a83eff0a
PM
759
760 TP_ARGS(rcuname, s, cpu, cnt, done),
761
762 TP_STRUCT__entry(
e66c33d5
SRRH
763 __field(const char *, rcuname)
764 __field(const char *, s)
a83eff0a
PM
765 __field(int, cpu)
766 __field(int, cnt)
767 __field(unsigned long, done)
768 ),
769
770 TP_fast_assign(
771 __entry->rcuname = rcuname;
772 __entry->s = s;
773 __entry->cpu = cpu;
774 __entry->cnt = cnt;
775 __entry->done = done;
776 ),
777
778 TP_printk("%s %s cpu %d remaining %d # %lu",
779 __entry->rcuname, __entry->s, __entry->cpu, __entry->cnt,
780 __entry->done)
781);
782
d4c08f2a
PM
783#else /* #ifdef CONFIG_RCU_TRACE */
784
785#define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0)
bd9f0686
PM
786#define trace_rcu_future_grace_period(rcuname, gpnum, completed, c, \
787 level, grplo, grphi, event) \
788 do { } while (0)
e087816d
PM
789#define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, \
790 qsmask) do { } while (0)
791#define trace_rcu_exp_grace_period(rcuname, gqseq, gpevent) \
792 do { } while (0)
793#define trace_rcu_exp_funnel_lock(rcuname, level, grplo, grphi, gpevent) \
794 do { } while (0)
9261dd0d 795#define trace_rcu_nocb_wake(rcuname, cpu, reason) do { } while (0)
d4c08f2a
PM
796#define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0)
797#define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0)
486e2593
PM
798#define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \
799 grplo, grphi, gp_tasks) do { } \
800 while (0)
d4c08f2a 801#define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0)
4145fa7f 802#define trace_rcu_dyntick(polarity, oldnesting, newnesting) do { } while (0)
433cdddc 803#define trace_rcu_prep_idle(reason) do { } while (0)
486e2593
PM
804#define trace_rcu_callback(rcuname, rhp, qlen_lazy, qlen) do { } while (0)
805#define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen_lazy, qlen) \
806 do { } while (0)
807#define trace_rcu_batch_start(rcuname, qlen_lazy, qlen, blimit) \
808 do { } while (0)
d4c08f2a
PM
809#define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0)
810#define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0)
4968c300
PM
811#define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \
812 do { } while (0)
52494535
PM
813#define trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
814 do { } while (0)
a83eff0a 815#define trace_rcu_barrier(name, s, cpu, cnt, done) do { } while (0)
d4c08f2a
PM
816
817#endif /* #else #ifdef CONFIG_RCU_TRACE */
818
29c00b4a
PM
819#endif /* _TRACE_RCU_H */
820
821/* This part must be outside protection */
822#include <trace/define_trace.h>