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 * "start": Start a grace period.
49 * "cpustart": CPU first notices a grace-period start.
50 * "cpuqs": CPU passes through a quiescent state.
51 * "cpuonl": CPU comes online.
52 * "cpuofl": CPU goes offline.
53 * "reqwait": GP kthread sleeps waiting for grace-period request.
54 * "reqwaitsig": GP kthread awakened by signal from reqwait state.
55 * "fqswait": GP kthread waiting until time to force quiescent states.
56 * "fqsstart": GP kthread starts forcing quiescent states.
57 * "fqsend": GP kthread done forcing quiescent states.
58 * "fqswaitsig": GP kthread awakened by signal from fqswait state.
59 * "end": End a grace period.
60 * "cpuend": CPU first notices a grace-period end.
62 TRACE_EVENT(rcu_grace_period,
64 TP_PROTO(const char *rcuname, unsigned long gpnum, const char *gpevent),
66 TP_ARGS(rcuname, gpnum, gpevent),
69 __field(const char *, rcuname)
70 __field(unsigned long, gpnum)
71 __field(const char *, gpevent)
75 __entry->rcuname = rcuname;
76 __entry->gpnum = gpnum;
77 __entry->gpevent = gpevent;
80 TP_printk("%s %lu %s",
81 __entry->rcuname, __entry->gpnum, __entry->gpevent)
85 * Tracepoint for future grace-period events, including those for no-callbacks
86 * CPUs. The caller should pull the data from the rcu_node structure,
87 * other than rcuname, which comes from the rcu_state structure, and event,
88 * which is one of the following:
90 * "Startleaf": Request a nocb grace period based on leaf-node data.
91 * "Startedleaf": Leaf-node start proved sufficient.
92 * "Startedleafroot": Leaf-node start proved sufficient after checking root.
93 * "Startedroot": Requested a nocb grace period based on root-node data.
94 * "StartWait": Start waiting for the requested grace period.
95 * "ResumeWait": Resume waiting after signal.
96 * "EndWait": Complete wait.
97 * "Cleanup": Clean up rcu_node structure after previous GP.
98 * "CleanupMore": Clean up, and another no-CB GP is needed.
100 TRACE_EVENT(rcu_future_grace_period,
102 TP_PROTO(const char *rcuname, unsigned long gpnum, unsigned long completed,
103 unsigned long c, u8 level, int grplo, int grphi,
104 const char *gpevent),
106 TP_ARGS(rcuname, gpnum, completed, c, level, grplo, grphi, gpevent),
109 __field(const char *, rcuname)
110 __field(unsigned long, gpnum)
111 __field(unsigned long, completed)
112 __field(unsigned long, c)
116 __field(const char *, gpevent)
120 __entry->rcuname = rcuname;
121 __entry->gpnum = gpnum;
122 __entry->completed = completed;
124 __entry->level = level;
125 __entry->grplo = grplo;
126 __entry->grphi = grphi;
127 __entry->gpevent = gpevent;
130 TP_printk("%s %lu %lu %lu %u %d %d %s",
131 __entry->rcuname, __entry->gpnum, __entry->completed,
132 __entry->c, __entry->level, __entry->grplo, __entry->grphi,
137 * Tracepoint for grace-period-initialization events. These are
138 * distinguished by the type of RCU, the new grace-period number, the
139 * rcu_node structure level, the starting and ending CPU covered by the
140 * rcu_node structure, and the mask of CPUs that will be waited for.
141 * All but the type of RCU are extracted from the rcu_node structure.
143 TRACE_EVENT(rcu_grace_period_init,
145 TP_PROTO(const char *rcuname, unsigned long gpnum, u8 level,
146 int grplo, int grphi, unsigned long qsmask),
148 TP_ARGS(rcuname, gpnum, level, grplo, grphi, qsmask),
151 __field(const char *, rcuname)
152 __field(unsigned long, gpnum)
156 __field(unsigned long, qsmask)
160 __entry->rcuname = rcuname;
161 __entry->gpnum = gpnum;
162 __entry->level = level;
163 __entry->grplo = grplo;
164 __entry->grphi = grphi;
165 __entry->qsmask = qsmask;
168 TP_printk("%s %lu %u %d %d %lx",
169 __entry->rcuname, __entry->gpnum, __entry->level,
170 __entry->grplo, __entry->grphi, __entry->qsmask)
174 * Tracepoint for tasks blocking within preemptible-RCU read-side
175 * critical sections. Track the type of RCU (which one day might
176 * include SRCU), the grace-period number that the task is blocking
177 * (the current or the next), and the task's PID.
179 TRACE_EVENT(rcu_preempt_task,
181 TP_PROTO(const char *rcuname, int pid, unsigned long gpnum),
183 TP_ARGS(rcuname, pid, gpnum),
186 __field(const char *, rcuname)
187 __field(unsigned long, gpnum)
192 __entry->rcuname = rcuname;
193 __entry->gpnum = gpnum;
197 TP_printk("%s %lu %d",
198 __entry->rcuname, __entry->gpnum, __entry->pid)
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.
206 TRACE_EVENT(rcu_unlock_preempted_task,
208 TP_PROTO(const char *rcuname, unsigned long gpnum, int pid),
210 TP_ARGS(rcuname, gpnum, pid),
213 __field(const char *, rcuname)
214 __field(unsigned long, gpnum)
219 __entry->rcuname = rcuname;
220 __entry->gpnum = gpnum;
224 TP_printk("%s %lu %d", __entry->rcuname, __entry->gpnum, __entry->pid)
228 * Tracepoint for quiescent-state-reporting events. These are
229 * distinguished by the type of RCU, the grace-period number, the
230 * mask of quiescent lower-level entities, the rcu_node structure level,
231 * the starting and ending CPU covered by the rcu_node structure, and
232 * whether there are any blocked tasks blocking the current grace period.
233 * All but the type of RCU are extracted from the rcu_node structure.
235 TRACE_EVENT(rcu_quiescent_state_report,
237 TP_PROTO(const char *rcuname, unsigned long gpnum,
238 unsigned long mask, unsigned long qsmask,
239 u8 level, int grplo, int grphi, int gp_tasks),
241 TP_ARGS(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks),
244 __field(const char *, rcuname)
245 __field(unsigned long, gpnum)
246 __field(unsigned long, mask)
247 __field(unsigned long, qsmask)
251 __field(u8, gp_tasks)
255 __entry->rcuname = rcuname;
256 __entry->gpnum = gpnum;
257 __entry->mask = mask;
258 __entry->qsmask = qsmask;
259 __entry->level = level;
260 __entry->grplo = grplo;
261 __entry->grphi = grphi;
262 __entry->gp_tasks = gp_tasks;
265 TP_printk("%s %lu %lx>%lx %u %d %d %u",
266 __entry->rcuname, __entry->gpnum,
267 __entry->mask, __entry->qsmask, __entry->level,
268 __entry->grplo, __entry->grphi, __entry->gp_tasks)
272 * Tracepoint for quiescent states detected by force_quiescent_state().
273 * These trace events include the type of RCU, the grace-period number
274 * that was blocked by the CPU, the CPU itself, and the type of quiescent
275 * state, which can be "dti" for dyntick-idle mode, "ofl" for CPU offline,
276 * or "kick" when kicking a CPU that has been in dyntick-idle mode for
281 TP_PROTO(const char *rcuname, unsigned long gpnum, int cpu, const char *qsevent),
283 TP_ARGS(rcuname, gpnum, cpu, qsevent),
286 __field(const char *, rcuname)
287 __field(unsigned long, gpnum)
289 __field(const char *, qsevent)
293 __entry->rcuname = rcuname;
294 __entry->gpnum = gpnum;
296 __entry->qsevent = qsevent;
299 TP_printk("%s %lu %d %s",
300 __entry->rcuname, __entry->gpnum,
301 __entry->cpu, __entry->qsevent)
304 #endif /* #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) */
307 * Tracepoint for dyntick-idle entry/exit events. These take a string
308 * as argument: "Start" for entering dyntick-idle mode, "End" for
309 * leaving it, "--=" for events moving towards idle, and "++=" for events
310 * moving away from idle. "Error on entry: not idle task" and "Error on
311 * exit: not idle task" indicate that a non-idle task is erroneously
312 * toying with the idle loop.
314 * These events also take a pair of numbers, which indicate the nesting
315 * depth before and after the event of interest. Note that task-related
316 * events use the upper bits of each number, while interrupt-related
317 * events use the lower bits.
319 TRACE_EVENT(rcu_dyntick,
321 TP_PROTO(const char *polarity, long long oldnesting, long long newnesting),
323 TP_ARGS(polarity, oldnesting, newnesting),
326 __field(const char *, polarity)
327 __field(long long, oldnesting)
328 __field(long long, newnesting)
332 __entry->polarity = polarity;
333 __entry->oldnesting = oldnesting;
334 __entry->newnesting = newnesting;
337 TP_printk("%s %llx %llx", __entry->polarity,
338 __entry->oldnesting, __entry->newnesting)
342 * Tracepoint for RCU preparation for idle, the goal being to get RCU
343 * processing done so that the current CPU can shut off its scheduling
344 * clock and enter dyntick-idle mode. One way to accomplish this is
345 * to drain all RCU callbacks from this CPU, and the other is to have
346 * done everything RCU requires for the current grace period. In this
347 * latter case, the CPU will be awakened at the end of the current grace
348 * period in order to process the remainder of its callbacks.
350 * These tracepoints take a string as argument:
352 * "No callbacks": Nothing to do, no callbacks on this CPU.
353 * "In holdoff": Nothing to do, holding off after unsuccessful attempt.
354 * "Begin holdoff": Attempt failed, don't retry until next jiffy.
355 * "Dyntick with callbacks": Entering dyntick-idle despite callbacks.
356 * "Dyntick with lazy callbacks": Entering dyntick-idle w/lazy callbacks.
357 * "More callbacks": Still more callbacks, try again to clear them out.
358 * "Callbacks drained": All callbacks processed, off to dyntick idle!
359 * "Timer": Timer fired to cause CPU to continue processing callbacks.
360 * "Demigrate": Timer fired on wrong CPU, woke up correct CPU.
361 * "Cleanup after idle": Idle exited, timer canceled.
363 TRACE_EVENT(rcu_prep_idle,
365 TP_PROTO(const char *reason),
370 __field(const char *, reason)
374 __entry->reason = reason;
377 TP_printk("%s", __entry->reason)
381 * Tracepoint for the registration of a single RCU callback function.
382 * The first argument is the type of RCU, the second argument is
383 * a pointer to the RCU callback itself, the third element is the
384 * number of lazy callbacks queued, and the fourth element is the
385 * total number of callbacks queued.
387 TRACE_EVENT(rcu_callback,
389 TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen_lazy,
392 TP_ARGS(rcuname, rhp, qlen_lazy, qlen),
395 __field(const char *, rcuname)
397 __field(void *, func)
398 __field(long, qlen_lazy)
403 __entry->rcuname = rcuname;
405 __entry->func = rhp->func;
406 __entry->qlen_lazy = qlen_lazy;
407 __entry->qlen = qlen;
410 TP_printk("%s rhp=%p func=%pf %ld/%ld",
411 __entry->rcuname, __entry->rhp, __entry->func,
412 __entry->qlen_lazy, __entry->qlen)
416 * Tracepoint for the registration of a single RCU callback of the special
417 * kfree() form. The first argument is the RCU type, the second argument
418 * is a pointer to the RCU callback, the third argument is the offset
419 * of the callback within the enclosing RCU-protected data structure,
420 * the fourth argument is the number of lazy callbacks queued, and the
421 * fifth argument is the total number of callbacks queued.
423 TRACE_EVENT(rcu_kfree_callback,
425 TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset,
426 long qlen_lazy, long qlen),
428 TP_ARGS(rcuname, rhp, offset, qlen_lazy, qlen),
431 __field(const char *, rcuname)
433 __field(unsigned long, offset)
434 __field(long, qlen_lazy)
439 __entry->rcuname = rcuname;
441 __entry->offset = offset;
442 __entry->qlen_lazy = qlen_lazy;
443 __entry->qlen = qlen;
446 TP_printk("%s rhp=%p func=%ld %ld/%ld",
447 __entry->rcuname, __entry->rhp, __entry->offset,
448 __entry->qlen_lazy, __entry->qlen)
452 * Tracepoint for marking the beginning rcu_do_batch, performed to start
453 * RCU callback invocation. The first argument is the RCU flavor,
454 * the second is the number of lazy callbacks queued, the third is
455 * the total number of callbacks queued, and the fourth argument is
456 * the current RCU-callback batch limit.
458 TRACE_EVENT(rcu_batch_start,
460 TP_PROTO(const char *rcuname, long qlen_lazy, long qlen, long blimit),
462 TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
465 __field(const char *, rcuname)
466 __field(long, qlen_lazy)
468 __field(long, blimit)
472 __entry->rcuname = rcuname;
473 __entry->qlen_lazy = qlen_lazy;
474 __entry->qlen = qlen;
475 __entry->blimit = blimit;
478 TP_printk("%s CBs=%ld/%ld bl=%ld",
479 __entry->rcuname, __entry->qlen_lazy, __entry->qlen,
484 * Tracepoint for the invocation of a single RCU callback function.
485 * The first argument is the type of RCU, and the second argument is
486 * a pointer to the RCU callback itself.
488 TRACE_EVENT(rcu_invoke_callback,
490 TP_PROTO(const char *rcuname, struct rcu_head *rhp),
492 TP_ARGS(rcuname, rhp),
495 __field(const char *, rcuname)
497 __field(void *, func)
501 __entry->rcuname = rcuname;
503 __entry->func = rhp->func;
506 TP_printk("%s rhp=%p func=%pf",
507 __entry->rcuname, __entry->rhp, __entry->func)
511 * Tracepoint for the invocation of a single RCU callback of the special
512 * kfree() form. The first argument is the RCU flavor, the second
513 * argument is a pointer to the RCU callback, and the third argument
514 * is the offset of the callback within the enclosing RCU-protected
517 TRACE_EVENT(rcu_invoke_kfree_callback,
519 TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset),
521 TP_ARGS(rcuname, rhp, offset),
524 __field(const char *, rcuname)
526 __field(unsigned long, offset)
530 __entry->rcuname = rcuname;
532 __entry->offset = offset;
535 TP_printk("%s rhp=%p func=%ld",
536 __entry->rcuname, __entry->rhp, __entry->offset)
540 * Tracepoint for exiting rcu_do_batch after RCU callbacks have been
541 * invoked. The first argument is the name of the RCU flavor,
542 * the second argument is number of callbacks actually invoked,
543 * the third argument (cb) is whether or not any of the callbacks that
544 * were ready to invoke at the beginning of this batch are still
545 * queued, the fourth argument (nr) is the return value of need_resched(),
546 * the fifth argument (iit) is 1 if the current task is the idle task,
547 * and the sixth argument (risk) is the return value from
548 * rcu_is_callbacks_kthread().
550 TRACE_EVENT(rcu_batch_end,
552 TP_PROTO(const char *rcuname, int callbacks_invoked,
553 bool cb, bool nr, bool iit, bool risk),
555 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
558 __field(const char *, rcuname)
559 __field(int, callbacks_invoked)
567 __entry->rcuname = rcuname;
568 __entry->callbacks_invoked = callbacks_invoked;
572 __entry->risk = risk;
575 TP_printk("%s CBs-invoked=%d idle=%c%c%c%c",
576 __entry->rcuname, __entry->callbacks_invoked,
577 __entry->cb ? 'C' : '.',
578 __entry->nr ? 'S' : '.',
579 __entry->iit ? 'I' : '.',
580 __entry->risk ? 'R' : '.')
584 * Tracepoint for rcutorture readers. The first argument is the name
585 * of the RCU flavor from rcutorture's viewpoint and the second argument
586 * is the callback address.
588 TRACE_EVENT(rcu_torture_read,
590 TP_PROTO(const char *rcutorturename, struct rcu_head *rhp,
591 unsigned long secs, unsigned long c_old, unsigned long c),
593 TP_ARGS(rcutorturename, rhp, secs, c_old, c),
596 __field(const char *, rcutorturename)
597 __field(struct rcu_head *, rhp)
598 __field(unsigned long, secs)
599 __field(unsigned long, c_old)
600 __field(unsigned long, c)
604 __entry->rcutorturename = rcutorturename;
606 __entry->secs = secs;
607 __entry->c_old = c_old;
611 TP_printk("%s torture read %p %luus c: %lu %lu",
612 __entry->rcutorturename, __entry->rhp,
613 __entry->secs, __entry->c_old, __entry->c)
617 * Tracepoint for _rcu_barrier() execution. The string "s" describes
618 * the _rcu_barrier phase:
619 * "Begin": rcu_barrier_callback() started.
620 * "Check": rcu_barrier_callback() checking for piggybacking.
621 * "EarlyExit": rcu_barrier_callback() piggybacked, thus early exit.
622 * "Inc1": rcu_barrier_callback() piggyback check counter incremented.
623 * "Offline": rcu_barrier_callback() found offline CPU
624 * "OnlineNoCB": rcu_barrier_callback() found online no-CBs CPU.
625 * "OnlineQ": rcu_barrier_callback() found online CPU with callbacks.
626 * "OnlineNQ": rcu_barrier_callback() found online CPU, no callbacks.
627 * "IRQ": An rcu_barrier_callback() callback posted on remote CPU.
628 * "CB": An rcu_barrier_callback() invoked a callback, not the last.
629 * "LastCB": An rcu_barrier_callback() invoked the last callback.
630 * "Inc2": rcu_barrier_callback() piggyback check counter incremented.
631 * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument
632 * is the count of remaining callbacks, and "done" is the piggybacking count.
634 TRACE_EVENT(rcu_barrier,
636 TP_PROTO(const char *rcuname, const char *s, int cpu, int cnt, unsigned long done),
638 TP_ARGS(rcuname, s, cpu, cnt, done),
641 __field(const char *, rcuname)
642 __field(const char *, s)
645 __field(unsigned long, done)
649 __entry->rcuname = rcuname;
653 __entry->done = done;
656 TP_printk("%s %s cpu %d remaining %d # %lu",
657 __entry->rcuname, __entry->s, __entry->cpu, __entry->cnt,
661 #else /* #ifdef CONFIG_RCU_TRACE */
663 #define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0)
664 #define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, \
665 qsmask) do { } while (0)
666 #define trace_rcu_future_grace_period(rcuname, gpnum, completed, c, \
667 level, grplo, grphi, event) \
669 #define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0)
670 #define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0)
671 #define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \
672 grplo, grphi, gp_tasks) do { } \
674 #define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0)
675 #define trace_rcu_dyntick(polarity, oldnesting, newnesting) do { } while (0)
676 #define trace_rcu_prep_idle(reason) do { } while (0)
677 #define trace_rcu_callback(rcuname, rhp, qlen_lazy, qlen) do { } while (0)
678 #define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen_lazy, qlen) \
680 #define trace_rcu_batch_start(rcuname, qlen_lazy, qlen, blimit) \
682 #define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0)
683 #define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0)
684 #define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \
686 #define trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
688 #define trace_rcu_barrier(name, s, cpu, cnt, done) do { } while (0)
690 #endif /* #else #ifdef CONFIG_RCU_TRACE */
692 #endif /* _TRACE_RCU_H */
694 /* This part must be outside protection */
695 #include <trace/define_trace.h>