2 #define TRACE_SYSTEM rcu
4 #if !defined(_TRACE_RCU_H) || defined(TRACE_HEADER_MULTI_READ)
7 #include <linux/tracepoint.h>
10 * Tracepoint for start/end markers used for utilization calculations.
11 * By convention, the string is of the following forms:
13 * "Start <activity>" -- Mark the start of the specified activity,
14 * such as "context switch". Nesting is permitted.
15 * "End <activity>" -- Mark the end of the specified activity.
17 * An "@" character within "<activity>" is a comment character: Data
18 * reduction scripts will ignore the "@" and the remainder of the line.
20 TRACE_EVENT(rcu_utilization,
22 TP_PROTO(const char *s),
27 __field(const char *, s)
34 TP_printk("%s", __entry->s)
37 #ifdef CONFIG_RCU_TRACE
39 #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
42 * Tracepoint for grace-period events. Takes a string identifying the
43 * RCU flavor, the grace-period number, and a string identifying the
44 * grace-period-related event as follows:
46 * "AccReadyCB": CPU acclerates new callbacks to RCU_NEXT_READY_TAIL.
47 * "AccWaitCB": CPU accelerates new callbacks to RCU_WAIT_TAIL.
48 * "newreq": Request a new grace period.
49 * "start": Start a grace period.
50 * "cpustart": CPU first notices a grace-period start.
51 * "cpuqs": CPU passes through a quiescent state.
52 * "cpuonl": CPU comes online.
53 * "cpuofl": CPU goes offline.
54 * "reqwait": GP kthread sleeps waiting for grace-period request.
55 * "reqwaitsig": GP kthread awakened by signal from reqwait state.
56 * "fqswait": GP kthread waiting until time to force quiescent states.
57 * "fqsstart": GP kthread starts forcing quiescent states.
58 * "fqsend": GP kthread done forcing quiescent states.
59 * "fqswaitsig": GP kthread awakened by signal from fqswait state.
60 * "end": End a grace period.
61 * "cpuend": CPU first notices a grace-period end.
63 TRACE_EVENT(rcu_grace_period,
65 TP_PROTO(const char *rcuname, unsigned long gpnum, const char *gpevent),
67 TP_ARGS(rcuname, gpnum, gpevent),
70 __field(const char *, rcuname)
71 __field(unsigned long, gpnum)
72 __field(const char *, gpevent)
76 __entry->rcuname = rcuname;
77 __entry->gpnum = gpnum;
78 __entry->gpevent = gpevent;
81 TP_printk("%s %lu %s",
82 __entry->rcuname, __entry->gpnum, __entry->gpevent)
86 * Tracepoint for future grace-period events, including those for no-callbacks
87 * CPUs. The caller should pull the data from the rcu_node structure,
88 * other than rcuname, which comes from the rcu_state structure, and event,
89 * which is one of the following:
91 * "Startleaf": Request a nocb grace period based on leaf-node data.
92 * "Startedleaf": Leaf-node start proved sufficient.
93 * "Startedleafroot": Leaf-node start proved sufficient after checking root.
94 * "Startedroot": Requested a nocb grace period based on root-node data.
95 * "StartWait": Start waiting for the requested grace period.
96 * "ResumeWait": Resume waiting after signal.
97 * "EndWait": Complete wait.
98 * "Cleanup": Clean up rcu_node structure after previous GP.
99 * "CleanupMore": Clean up, and another no-CB GP is needed.
101 TRACE_EVENT(rcu_future_grace_period,
103 TP_PROTO(const char *rcuname, unsigned long gpnum, unsigned long completed,
104 unsigned long c, u8 level, int grplo, int grphi,
105 const char *gpevent),
107 TP_ARGS(rcuname, gpnum, completed, c, level, grplo, grphi, gpevent),
110 __field(const char *, rcuname)
111 __field(unsigned long, gpnum)
112 __field(unsigned long, completed)
113 __field(unsigned long, c)
117 __field(const char *, gpevent)
121 __entry->rcuname = rcuname;
122 __entry->gpnum = gpnum;
123 __entry->completed = completed;
125 __entry->level = level;
126 __entry->grplo = grplo;
127 __entry->grphi = grphi;
128 __entry->gpevent = gpevent;
131 TP_printk("%s %lu %lu %lu %u %d %d %s",
132 __entry->rcuname, __entry->gpnum, __entry->completed,
133 __entry->c, __entry->level, __entry->grplo, __entry->grphi,
138 * Tracepoint for grace-period-initialization events. These are
139 * distinguished by the type of RCU, the new grace-period number, the
140 * rcu_node structure level, the starting and ending CPU covered by the
141 * rcu_node structure, and the mask of CPUs that will be waited for.
142 * All but the type of RCU are extracted from the rcu_node structure.
144 TRACE_EVENT(rcu_grace_period_init,
146 TP_PROTO(const char *rcuname, unsigned long gpnum, u8 level,
147 int grplo, int grphi, unsigned long qsmask),
149 TP_ARGS(rcuname, gpnum, level, grplo, grphi, qsmask),
152 __field(const char *, rcuname)
153 __field(unsigned long, gpnum)
157 __field(unsigned long, qsmask)
161 __entry->rcuname = rcuname;
162 __entry->gpnum = gpnum;
163 __entry->level = level;
164 __entry->grplo = grplo;
165 __entry->grphi = grphi;
166 __entry->qsmask = qsmask;
169 TP_printk("%s %lu %u %d %d %lx",
170 __entry->rcuname, __entry->gpnum, __entry->level,
171 __entry->grplo, __entry->grphi, __entry->qsmask)
175 * Tracepoint for tasks blocking within preemptible-RCU read-side
176 * critical sections. Track the type of RCU (which one day might
177 * include SRCU), the grace-period number that the task is blocking
178 * (the current or the next), and the task's PID.
180 TRACE_EVENT(rcu_preempt_task,
182 TP_PROTO(const char *rcuname, int pid, unsigned long gpnum),
184 TP_ARGS(rcuname, pid, gpnum),
187 __field(const char *, rcuname)
188 __field(unsigned long, gpnum)
193 __entry->rcuname = rcuname;
194 __entry->gpnum = gpnum;
198 TP_printk("%s %lu %d",
199 __entry->rcuname, __entry->gpnum, __entry->pid)
203 * Tracepoint for tasks that blocked within a given preemptible-RCU
204 * read-side critical section exiting that critical section. Track the
205 * type of RCU (which one day might include SRCU) and the task's PID.
207 TRACE_EVENT(rcu_unlock_preempted_task,
209 TP_PROTO(const char *rcuname, unsigned long gpnum, int pid),
211 TP_ARGS(rcuname, gpnum, pid),
214 __field(const char *, rcuname)
215 __field(unsigned long, gpnum)
220 __entry->rcuname = rcuname;
221 __entry->gpnum = gpnum;
225 TP_printk("%s %lu %d", __entry->rcuname, __entry->gpnum, __entry->pid)
229 * Tracepoint for quiescent-state-reporting events. These are
230 * distinguished by the type of RCU, the grace-period number, the
231 * mask of quiescent lower-level entities, the rcu_node structure level,
232 * the starting and ending CPU covered by the rcu_node structure, and
233 * whether there are any blocked tasks blocking the current grace period.
234 * All but the type of RCU are extracted from the rcu_node structure.
236 TRACE_EVENT(rcu_quiescent_state_report,
238 TP_PROTO(const char *rcuname, unsigned long gpnum,
239 unsigned long mask, unsigned long qsmask,
240 u8 level, int grplo, int grphi, int gp_tasks),
242 TP_ARGS(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks),
245 __field(const char *, rcuname)
246 __field(unsigned long, gpnum)
247 __field(unsigned long, mask)
248 __field(unsigned long, qsmask)
252 __field(u8, gp_tasks)
256 __entry->rcuname = rcuname;
257 __entry->gpnum = gpnum;
258 __entry->mask = mask;
259 __entry->qsmask = qsmask;
260 __entry->level = level;
261 __entry->grplo = grplo;
262 __entry->grphi = grphi;
263 __entry->gp_tasks = gp_tasks;
266 TP_printk("%s %lu %lx>%lx %u %d %d %u",
267 __entry->rcuname, __entry->gpnum,
268 __entry->mask, __entry->qsmask, __entry->level,
269 __entry->grplo, __entry->grphi, __entry->gp_tasks)
273 * Tracepoint for quiescent states detected by force_quiescent_state().
274 * These trace events include the type of RCU, the grace-period number
275 * that was blocked by the CPU, the CPU itself, and the type of quiescent
276 * state, which can be "dti" for dyntick-idle mode, "ofl" for CPU offline,
277 * or "kick" when kicking a CPU that has been in dyntick-idle mode for
282 TP_PROTO(const char *rcuname, unsigned long gpnum, int cpu, const char *qsevent),
284 TP_ARGS(rcuname, gpnum, cpu, qsevent),
287 __field(const char *, rcuname)
288 __field(unsigned long, gpnum)
290 __field(const char *, qsevent)
294 __entry->rcuname = rcuname;
295 __entry->gpnum = gpnum;
297 __entry->qsevent = qsevent;
300 TP_printk("%s %lu %d %s",
301 __entry->rcuname, __entry->gpnum,
302 __entry->cpu, __entry->qsevent)
305 #endif /* #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) */
308 * Tracepoint for dyntick-idle entry/exit events. These take a string
309 * as argument: "Start" for entering dyntick-idle mode, "End" for
310 * leaving it, "--=" for events moving towards idle, and "++=" for events
311 * moving away from idle. "Error on entry: not idle task" and "Error on
312 * exit: not idle task" indicate that a non-idle task is erroneously
313 * toying with the idle loop.
315 * These events also take a pair of numbers, which indicate the nesting
316 * depth before and after the event of interest. Note that task-related
317 * events use the upper bits of each number, while interrupt-related
318 * events use the lower bits.
320 TRACE_EVENT(rcu_dyntick,
322 TP_PROTO(const char *polarity, long long oldnesting, long long newnesting),
324 TP_ARGS(polarity, oldnesting, newnesting),
327 __field(const char *, polarity)
328 __field(long long, oldnesting)
329 __field(long long, newnesting)
333 __entry->polarity = polarity;
334 __entry->oldnesting = oldnesting;
335 __entry->newnesting = newnesting;
338 TP_printk("%s %llx %llx", __entry->polarity,
339 __entry->oldnesting, __entry->newnesting)
343 * Tracepoint for RCU preparation for idle, the goal being to get RCU
344 * processing done so that the current CPU can shut off its scheduling
345 * clock and enter dyntick-idle mode. One way to accomplish this is
346 * to drain all RCU callbacks from this CPU, and the other is to have
347 * done everything RCU requires for the current grace period. In this
348 * latter case, the CPU will be awakened at the end of the current grace
349 * period in order to process the remainder of its callbacks.
351 * These tracepoints take a string as argument:
353 * "No callbacks": Nothing to do, no callbacks on this CPU.
354 * "In holdoff": Nothing to do, holding off after unsuccessful attempt.
355 * "Begin holdoff": Attempt failed, don't retry until next jiffy.
356 * "Dyntick with callbacks": Entering dyntick-idle despite callbacks.
357 * "Dyntick with lazy callbacks": Entering dyntick-idle w/lazy callbacks.
358 * "More callbacks": Still more callbacks, try again to clear them out.
359 * "Callbacks drained": All callbacks processed, off to dyntick idle!
360 * "Timer": Timer fired to cause CPU to continue processing callbacks.
361 * "Demigrate": Timer fired on wrong CPU, woke up correct CPU.
362 * "Cleanup after idle": Idle exited, timer canceled.
364 TRACE_EVENT(rcu_prep_idle,
366 TP_PROTO(const char *reason),
371 __field(const char *, reason)
375 __entry->reason = reason;
378 TP_printk("%s", __entry->reason)
382 * Tracepoint for the registration of a single RCU callback function.
383 * The first argument is the type of RCU, the second argument is
384 * a pointer to the RCU callback itself, the third element is the
385 * number of lazy callbacks queued, and the fourth element is the
386 * total number of callbacks queued.
388 TRACE_EVENT(rcu_callback,
390 TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen_lazy,
393 TP_ARGS(rcuname, rhp, qlen_lazy, qlen),
396 __field(const char *, rcuname)
398 __field(void *, func)
399 __field(long, qlen_lazy)
404 __entry->rcuname = rcuname;
406 __entry->func = rhp->func;
407 __entry->qlen_lazy = qlen_lazy;
408 __entry->qlen = qlen;
411 TP_printk("%s rhp=%p func=%pf %ld/%ld",
412 __entry->rcuname, __entry->rhp, __entry->func,
413 __entry->qlen_lazy, __entry->qlen)
417 * Tracepoint for the registration of a single RCU callback of the special
418 * kfree() form. The first argument is the RCU type, the second argument
419 * is a pointer to the RCU callback, the third argument is the offset
420 * of the callback within the enclosing RCU-protected data structure,
421 * the fourth argument is the number of lazy callbacks queued, and the
422 * fifth argument is the total number of callbacks queued.
424 TRACE_EVENT(rcu_kfree_callback,
426 TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset,
427 long qlen_lazy, long qlen),
429 TP_ARGS(rcuname, rhp, offset, qlen_lazy, qlen),
432 __field(const char *, rcuname)
434 __field(unsigned long, offset)
435 __field(long, qlen_lazy)
440 __entry->rcuname = rcuname;
442 __entry->offset = offset;
443 __entry->qlen_lazy = qlen_lazy;
444 __entry->qlen = qlen;
447 TP_printk("%s rhp=%p func=%ld %ld/%ld",
448 __entry->rcuname, __entry->rhp, __entry->offset,
449 __entry->qlen_lazy, __entry->qlen)
453 * Tracepoint for marking the beginning rcu_do_batch, performed to start
454 * RCU callback invocation. The first argument is the RCU flavor,
455 * the second is the number of lazy callbacks queued, the third is
456 * the total number of callbacks queued, and the fourth argument is
457 * the current RCU-callback batch limit.
459 TRACE_EVENT(rcu_batch_start,
461 TP_PROTO(const char *rcuname, long qlen_lazy, long qlen, long blimit),
463 TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
466 __field(const char *, rcuname)
467 __field(long, qlen_lazy)
469 __field(long, blimit)
473 __entry->rcuname = rcuname;
474 __entry->qlen_lazy = qlen_lazy;
475 __entry->qlen = qlen;
476 __entry->blimit = blimit;
479 TP_printk("%s CBs=%ld/%ld bl=%ld",
480 __entry->rcuname, __entry->qlen_lazy, __entry->qlen,
485 * Tracepoint for the invocation of a single RCU callback function.
486 * The first argument is the type of RCU, and the second argument is
487 * a pointer to the RCU callback itself.
489 TRACE_EVENT(rcu_invoke_callback,
491 TP_PROTO(const char *rcuname, struct rcu_head *rhp),
493 TP_ARGS(rcuname, rhp),
496 __field(const char *, rcuname)
498 __field(void *, func)
502 __entry->rcuname = rcuname;
504 __entry->func = rhp->func;
507 TP_printk("%s rhp=%p func=%pf",
508 __entry->rcuname, __entry->rhp, __entry->func)
512 * Tracepoint for the invocation of a single RCU callback of the special
513 * kfree() form. The first argument is the RCU flavor, the second
514 * argument is a pointer to the RCU callback, and the third argument
515 * is the offset of the callback within the enclosing RCU-protected
518 TRACE_EVENT(rcu_invoke_kfree_callback,
520 TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset),
522 TP_ARGS(rcuname, rhp, offset),
525 __field(const char *, rcuname)
527 __field(unsigned long, offset)
531 __entry->rcuname = rcuname;
533 __entry->offset = offset;
536 TP_printk("%s rhp=%p func=%ld",
537 __entry->rcuname, __entry->rhp, __entry->offset)
541 * Tracepoint for exiting rcu_do_batch after RCU callbacks have been
542 * invoked. The first argument is the name of the RCU flavor,
543 * the second argument is number of callbacks actually invoked,
544 * the third argument (cb) is whether or not any of the callbacks that
545 * were ready to invoke at the beginning of this batch are still
546 * queued, the fourth argument (nr) is the return value of need_resched(),
547 * the fifth argument (iit) is 1 if the current task is the idle task,
548 * and the sixth argument (risk) is the return value from
549 * rcu_is_callbacks_kthread().
551 TRACE_EVENT(rcu_batch_end,
553 TP_PROTO(const char *rcuname, int callbacks_invoked,
554 bool cb, bool nr, bool iit, bool risk),
556 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
559 __field(const char *, rcuname)
560 __field(int, callbacks_invoked)
568 __entry->rcuname = rcuname;
569 __entry->callbacks_invoked = callbacks_invoked;
573 __entry->risk = risk;
576 TP_printk("%s CBs-invoked=%d idle=%c%c%c%c",
577 __entry->rcuname, __entry->callbacks_invoked,
578 __entry->cb ? 'C' : '.',
579 __entry->nr ? 'S' : '.',
580 __entry->iit ? 'I' : '.',
581 __entry->risk ? 'R' : '.')
585 * Tracepoint for rcutorture readers. The first argument is the name
586 * of the RCU flavor from rcutorture's viewpoint and the second argument
587 * is the callback address.
589 TRACE_EVENT(rcu_torture_read,
591 TP_PROTO(const char *rcutorturename, struct rcu_head *rhp,
592 unsigned long secs, unsigned long c_old, unsigned long c),
594 TP_ARGS(rcutorturename, rhp, secs, c_old, c),
597 __field(const char *, rcutorturename)
598 __field(struct rcu_head *, rhp)
599 __field(unsigned long, secs)
600 __field(unsigned long, c_old)
601 __field(unsigned long, c)
605 __entry->rcutorturename = rcutorturename;
607 __entry->secs = secs;
608 __entry->c_old = c_old;
612 TP_printk("%s torture read %p %luus c: %lu %lu",
613 __entry->rcutorturename, __entry->rhp,
614 __entry->secs, __entry->c_old, __entry->c)
618 * Tracepoint for _rcu_barrier() execution. The string "s" describes
619 * the _rcu_barrier phase:
620 * "Begin": rcu_barrier_callback() started.
621 * "Check": rcu_barrier_callback() checking for piggybacking.
622 * "EarlyExit": rcu_barrier_callback() piggybacked, thus early exit.
623 * "Inc1": rcu_barrier_callback() piggyback check counter incremented.
624 * "Offline": rcu_barrier_callback() found offline CPU
625 * "OnlineNoCB": rcu_barrier_callback() found online no-CBs CPU.
626 * "OnlineQ": rcu_barrier_callback() found online CPU with callbacks.
627 * "OnlineNQ": rcu_barrier_callback() found online CPU, no callbacks.
628 * "IRQ": An rcu_barrier_callback() callback posted on remote CPU.
629 * "CB": An rcu_barrier_callback() invoked a callback, not the last.
630 * "LastCB": An rcu_barrier_callback() invoked the last callback.
631 * "Inc2": rcu_barrier_callback() piggyback check counter incremented.
632 * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument
633 * is the count of remaining callbacks, and "done" is the piggybacking count.
635 TRACE_EVENT(rcu_barrier,
637 TP_PROTO(const char *rcuname, const char *s, int cpu, int cnt, unsigned long done),
639 TP_ARGS(rcuname, s, cpu, cnt, done),
642 __field(const char *, rcuname)
643 __field(const char *, s)
646 __field(unsigned long, done)
650 __entry->rcuname = rcuname;
654 __entry->done = done;
657 TP_printk("%s %s cpu %d remaining %d # %lu",
658 __entry->rcuname, __entry->s, __entry->cpu, __entry->cnt,
662 #else /* #ifdef CONFIG_RCU_TRACE */
664 #define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0)
665 #define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, \
666 qsmask) do { } while (0)
667 #define trace_rcu_future_grace_period(rcuname, gpnum, completed, c, \
668 level, grplo, grphi, event) \
670 #define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0)
671 #define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0)
672 #define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \
673 grplo, grphi, gp_tasks) do { } \
675 #define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0)
676 #define trace_rcu_dyntick(polarity, oldnesting, newnesting) do { } while (0)
677 #define trace_rcu_prep_idle(reason) do { } while (0)
678 #define trace_rcu_callback(rcuname, rhp, qlen_lazy, qlen) do { } while (0)
679 #define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen_lazy, qlen) \
681 #define trace_rcu_batch_start(rcuname, qlen_lazy, qlen, blimit) \
683 #define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0)
684 #define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0)
685 #define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \
687 #define trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
689 #define trace_rcu_barrier(name, s, cpu, cnt, done) do { } while (0)
691 #endif /* #else #ifdef CONFIG_RCU_TRACE */
693 #endif /* _TRACE_RCU_H */
695 /* This part must be outside protection */
696 #include <trace/define_trace.h>