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: starting and ending a grace
43 * period ("start" and "end", respectively), a CPU noting the start
44 * of a new grace period or the end of an old grace period ("cpustart"
45 * and "cpuend", respectively), a CPU passing through a quiescent
46 * state ("cpuqs"), a CPU coming online or going offline ("cpuonl"
47 * and "cpuofl", respectively), a CPU being kicked for being too
48 * long in dyntick-idle mode ("kick"), a CPU accelerating its new
49 * callbacks to RCU_NEXT_READY_TAIL ("AccReadyCB"), and a CPU
50 * accelerating its new callbacks to RCU_WAIT_TAIL ("AccWaitCB").
52 TRACE_EVENT(rcu_grace_period,
54 TP_PROTO(const char *rcuname, unsigned long gpnum, const char *gpevent),
56 TP_ARGS(rcuname, gpnum, gpevent),
59 __field(const char *, rcuname)
60 __field(unsigned long, gpnum)
61 __field(const char *, gpevent)
65 __entry->rcuname = rcuname;
66 __entry->gpnum = gpnum;
67 __entry->gpevent = gpevent;
70 TP_printk("%s %lu %s",
71 __entry->rcuname, __entry->gpnum, __entry->gpevent)
75 * Tracepoint for future grace-period events, including those for no-callbacks
76 * CPUs. The caller should pull the data from the rcu_node structure,
77 * other than rcuname, which comes from the rcu_state structure, and event,
78 * which is one of the following:
80 * "Startleaf": Request a nocb grace period based on leaf-node data.
81 * "Startedleaf": Leaf-node start proved sufficient.
82 * "Startedleafroot": Leaf-node start proved sufficient after checking root.
83 * "Startedroot": Requested a nocb grace period based on root-node data.
84 * "StartWait": Start waiting for the requested grace period.
85 * "ResumeWait": Resume waiting after signal.
86 * "EndWait": Complete wait.
87 * "Cleanup": Clean up rcu_node structure after previous GP.
88 * "CleanupMore": Clean up, and another no-CB GP is needed.
90 TRACE_EVENT(rcu_future_grace_period,
92 TP_PROTO(const char *rcuname, unsigned long gpnum, unsigned long completed,
93 unsigned long c, u8 level, int grplo, int grphi,
96 TP_ARGS(rcuname, gpnum, completed, c, level, grplo, grphi, gpevent),
99 __field(const char *, rcuname)
100 __field(unsigned long, gpnum)
101 __field(unsigned long, completed)
102 __field(unsigned long, c)
106 __field(const char *, gpevent)
110 __entry->rcuname = rcuname;
111 __entry->gpnum = gpnum;
112 __entry->completed = completed;
114 __entry->level = level;
115 __entry->grplo = grplo;
116 __entry->grphi = grphi;
117 __entry->gpevent = gpevent;
120 TP_printk("%s %lu %lu %lu %u %d %d %s",
121 __entry->rcuname, __entry->gpnum, __entry->completed,
122 __entry->c, __entry->level, __entry->grplo, __entry->grphi,
127 * Tracepoint for grace-period-initialization events. These are
128 * distinguished by the type of RCU, the new grace-period number, the
129 * rcu_node structure level, the starting and ending CPU covered by the
130 * rcu_node structure, and the mask of CPUs that will be waited for.
131 * All but the type of RCU are extracted from the rcu_node structure.
133 TRACE_EVENT(rcu_grace_period_init,
135 TP_PROTO(const char *rcuname, unsigned long gpnum, u8 level,
136 int grplo, int grphi, unsigned long qsmask),
138 TP_ARGS(rcuname, gpnum, level, grplo, grphi, qsmask),
141 __field(const char *, rcuname)
142 __field(unsigned long, gpnum)
146 __field(unsigned long, qsmask)
150 __entry->rcuname = rcuname;
151 __entry->gpnum = gpnum;
152 __entry->level = level;
153 __entry->grplo = grplo;
154 __entry->grphi = grphi;
155 __entry->qsmask = qsmask;
158 TP_printk("%s %lu %u %d %d %lx",
159 __entry->rcuname, __entry->gpnum, __entry->level,
160 __entry->grplo, __entry->grphi, __entry->qsmask)
164 * Tracepoint for tasks blocking within preemptible-RCU read-side
165 * critical sections. Track the type of RCU (which one day might
166 * include SRCU), the grace-period number that the task is blocking
167 * (the current or the next), and the task's PID.
169 TRACE_EVENT(rcu_preempt_task,
171 TP_PROTO(const char *rcuname, int pid, unsigned long gpnum),
173 TP_ARGS(rcuname, pid, gpnum),
176 __field(const char *, rcuname)
177 __field(unsigned long, gpnum)
182 __entry->rcuname = rcuname;
183 __entry->gpnum = gpnum;
187 TP_printk("%s %lu %d",
188 __entry->rcuname, __entry->gpnum, __entry->pid)
192 * Tracepoint for tasks that blocked within a given preemptible-RCU
193 * read-side critical section exiting that critical section. Track the
194 * type of RCU (which one day might include SRCU) and the task's PID.
196 TRACE_EVENT(rcu_unlock_preempted_task,
198 TP_PROTO(const char *rcuname, unsigned long gpnum, int pid),
200 TP_ARGS(rcuname, gpnum, pid),
203 __field(const char *, rcuname)
204 __field(unsigned long, gpnum)
209 __entry->rcuname = rcuname;
210 __entry->gpnum = gpnum;
214 TP_printk("%s %lu %d", __entry->rcuname, __entry->gpnum, __entry->pid)
218 * Tracepoint for quiescent-state-reporting events. These are
219 * distinguished by the type of RCU, the grace-period number, the
220 * mask of quiescent lower-level entities, the rcu_node structure level,
221 * the starting and ending CPU covered by the rcu_node structure, and
222 * whether there are any blocked tasks blocking the current grace period.
223 * All but the type of RCU are extracted from the rcu_node structure.
225 TRACE_EVENT(rcu_quiescent_state_report,
227 TP_PROTO(const char *rcuname, unsigned long gpnum,
228 unsigned long mask, unsigned long qsmask,
229 u8 level, int grplo, int grphi, int gp_tasks),
231 TP_ARGS(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks),
234 __field(const char *, rcuname)
235 __field(unsigned long, gpnum)
236 __field(unsigned long, mask)
237 __field(unsigned long, qsmask)
241 __field(u8, gp_tasks)
245 __entry->rcuname = rcuname;
246 __entry->gpnum = gpnum;
247 __entry->mask = mask;
248 __entry->qsmask = qsmask;
249 __entry->level = level;
250 __entry->grplo = grplo;
251 __entry->grphi = grphi;
252 __entry->gp_tasks = gp_tasks;
255 TP_printk("%s %lu %lx>%lx %u %d %d %u",
256 __entry->rcuname, __entry->gpnum,
257 __entry->mask, __entry->qsmask, __entry->level,
258 __entry->grplo, __entry->grphi, __entry->gp_tasks)
262 * Tracepoint for quiescent states detected by force_quiescent_state().
263 * These trace events include the type of RCU, the grace-period number
264 * that was blocked by the CPU, the CPU itself, and the type of quiescent
265 * state, which can be "dti" for dyntick-idle mode, "ofl" for CPU offline,
266 * or "kick" when kicking a CPU that has been in dyntick-idle mode for
271 TP_PROTO(const char *rcuname, unsigned long gpnum, int cpu, const char *qsevent),
273 TP_ARGS(rcuname, gpnum, cpu, qsevent),
276 __field(const char *, rcuname)
277 __field(unsigned long, gpnum)
279 __field(const char *, qsevent)
283 __entry->rcuname = rcuname;
284 __entry->gpnum = gpnum;
286 __entry->qsevent = qsevent;
289 TP_printk("%s %lu %d %s",
290 __entry->rcuname, __entry->gpnum,
291 __entry->cpu, __entry->qsevent)
294 #endif /* #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) */
297 * Tracepoint for dyntick-idle entry/exit events. These take a string
298 * as argument: "Start" for entering dyntick-idle mode, "End" for
299 * leaving it, "--=" for events moving towards idle, and "++=" for events
300 * moving away from idle. "Error on entry: not idle task" and "Error on
301 * exit: not idle task" indicate that a non-idle task is erroneously
302 * toying with the idle loop.
304 * These events also take a pair of numbers, which indicate the nesting
305 * depth before and after the event of interest. Note that task-related
306 * events use the upper bits of each number, while interrupt-related
307 * events use the lower bits.
309 TRACE_EVENT(rcu_dyntick,
311 TP_PROTO(const char *polarity, long long oldnesting, long long newnesting),
313 TP_ARGS(polarity, oldnesting, newnesting),
316 __field(const char *, polarity)
317 __field(long long, oldnesting)
318 __field(long long, newnesting)
322 __entry->polarity = polarity;
323 __entry->oldnesting = oldnesting;
324 __entry->newnesting = newnesting;
327 TP_printk("%s %llx %llx", __entry->polarity,
328 __entry->oldnesting, __entry->newnesting)
332 * Tracepoint for RCU preparation for idle, the goal being to get RCU
333 * processing done so that the current CPU can shut off its scheduling
334 * clock and enter dyntick-idle mode. One way to accomplish this is
335 * to drain all RCU callbacks from this CPU, and the other is to have
336 * done everything RCU requires for the current grace period. In this
337 * latter case, the CPU will be awakened at the end of the current grace
338 * period in order to process the remainder of its callbacks.
340 * These tracepoints take a string as argument:
342 * "No callbacks": Nothing to do, no callbacks on this CPU.
343 * "In holdoff": Nothing to do, holding off after unsuccessful attempt.
344 * "Begin holdoff": Attempt failed, don't retry until next jiffy.
345 * "Dyntick with callbacks": Entering dyntick-idle despite callbacks.
346 * "Dyntick with lazy callbacks": Entering dyntick-idle w/lazy callbacks.
347 * "More callbacks": Still more callbacks, try again to clear them out.
348 * "Callbacks drained": All callbacks processed, off to dyntick idle!
349 * "Timer": Timer fired to cause CPU to continue processing callbacks.
350 * "Demigrate": Timer fired on wrong CPU, woke up correct CPU.
351 * "Cleanup after idle": Idle exited, timer canceled.
353 TRACE_EVENT(rcu_prep_idle,
355 TP_PROTO(const char *reason),
360 __field(const char *, reason)
364 __entry->reason = reason;
367 TP_printk("%s", __entry->reason)
371 * Tracepoint for the registration of a single RCU callback function.
372 * The first argument is the type of RCU, the second argument is
373 * a pointer to the RCU callback itself, the third element is the
374 * number of lazy callbacks queued, and the fourth element is the
375 * total number of callbacks queued.
377 TRACE_EVENT(rcu_callback,
379 TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen_lazy,
382 TP_ARGS(rcuname, rhp, qlen_lazy, qlen),
385 __field(const char *, rcuname)
387 __field(void *, func)
388 __field(long, qlen_lazy)
393 __entry->rcuname = rcuname;
395 __entry->func = rhp->func;
396 __entry->qlen_lazy = qlen_lazy;
397 __entry->qlen = qlen;
400 TP_printk("%s rhp=%p func=%pf %ld/%ld",
401 __entry->rcuname, __entry->rhp, __entry->func,
402 __entry->qlen_lazy, __entry->qlen)
406 * Tracepoint for the registration of a single RCU callback of the special
407 * kfree() form. The first argument is the RCU type, the second argument
408 * is a pointer to the RCU callback, the third argument is the offset
409 * of the callback within the enclosing RCU-protected data structure,
410 * the fourth argument is the number of lazy callbacks queued, and the
411 * fifth argument is the total number of callbacks queued.
413 TRACE_EVENT(rcu_kfree_callback,
415 TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset,
416 long qlen_lazy, long qlen),
418 TP_ARGS(rcuname, rhp, offset, qlen_lazy, qlen),
421 __field(const char *, rcuname)
423 __field(unsigned long, offset)
424 __field(long, qlen_lazy)
429 __entry->rcuname = rcuname;
431 __entry->offset = offset;
432 __entry->qlen_lazy = qlen_lazy;
433 __entry->qlen = qlen;
436 TP_printk("%s rhp=%p func=%ld %ld/%ld",
437 __entry->rcuname, __entry->rhp, __entry->offset,
438 __entry->qlen_lazy, __entry->qlen)
442 * Tracepoint for marking the beginning rcu_do_batch, performed to start
443 * RCU callback invocation. The first argument is the RCU flavor,
444 * the second is the number of lazy callbacks queued, the third is
445 * the total number of callbacks queued, and the fourth argument is
446 * the current RCU-callback batch limit.
448 TRACE_EVENT(rcu_batch_start,
450 TP_PROTO(const char *rcuname, long qlen_lazy, long qlen, long blimit),
452 TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
455 __field(const char *, rcuname)
456 __field(long, qlen_lazy)
458 __field(long, blimit)
462 __entry->rcuname = rcuname;
463 __entry->qlen_lazy = qlen_lazy;
464 __entry->qlen = qlen;
465 __entry->blimit = blimit;
468 TP_printk("%s CBs=%ld/%ld bl=%ld",
469 __entry->rcuname, __entry->qlen_lazy, __entry->qlen,
474 * Tracepoint for the invocation of a single RCU callback function.
475 * The first argument is the type of RCU, and the second argument is
476 * a pointer to the RCU callback itself.
478 TRACE_EVENT(rcu_invoke_callback,
480 TP_PROTO(const char *rcuname, struct rcu_head *rhp),
482 TP_ARGS(rcuname, rhp),
485 __field(const char *, rcuname)
487 __field(void *, func)
491 __entry->rcuname = rcuname;
493 __entry->func = rhp->func;
496 TP_printk("%s rhp=%p func=%pf",
497 __entry->rcuname, __entry->rhp, __entry->func)
501 * Tracepoint for the invocation of a single RCU callback of the special
502 * kfree() form. The first argument is the RCU flavor, the second
503 * argument is a pointer to the RCU callback, and the third argument
504 * is the offset of the callback within the enclosing RCU-protected
507 TRACE_EVENT(rcu_invoke_kfree_callback,
509 TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset),
511 TP_ARGS(rcuname, rhp, offset),
514 __field(const char *, rcuname)
516 __field(unsigned long, offset)
520 __entry->rcuname = rcuname;
522 __entry->offset = offset;
525 TP_printk("%s rhp=%p func=%ld",
526 __entry->rcuname, __entry->rhp, __entry->offset)
530 * Tracepoint for exiting rcu_do_batch after RCU callbacks have been
531 * invoked. The first argument is the name of the RCU flavor,
532 * the second argument is number of callbacks actually invoked,
533 * the third argument (cb) is whether or not any of the callbacks that
534 * were ready to invoke at the beginning of this batch are still
535 * queued, the fourth argument (nr) is the return value of need_resched(),
536 * the fifth argument (iit) is 1 if the current task is the idle task,
537 * and the sixth argument (risk) is the return value from
538 * rcu_is_callbacks_kthread().
540 TRACE_EVENT(rcu_batch_end,
542 TP_PROTO(const char *rcuname, int callbacks_invoked,
543 bool cb, bool nr, bool iit, bool risk),
545 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
548 __field(const char *, rcuname)
549 __field(int, callbacks_invoked)
557 __entry->rcuname = rcuname;
558 __entry->callbacks_invoked = callbacks_invoked;
562 __entry->risk = risk;
565 TP_printk("%s CBs-invoked=%d idle=%c%c%c%c",
566 __entry->rcuname, __entry->callbacks_invoked,
567 __entry->cb ? 'C' : '.',
568 __entry->nr ? 'S' : '.',
569 __entry->iit ? 'I' : '.',
570 __entry->risk ? 'R' : '.')
574 * Tracepoint for rcutorture readers. The first argument is the name
575 * of the RCU flavor from rcutorture's viewpoint and the second argument
576 * is the callback address.
578 TRACE_EVENT(rcu_torture_read,
580 TP_PROTO(const char *rcutorturename, struct rcu_head *rhp,
581 unsigned long secs, unsigned long c_old, unsigned long c),
583 TP_ARGS(rcutorturename, rhp, secs, c_old, c),
586 __field(const char *, rcutorturename)
587 __field(struct rcu_head *, rhp)
588 __field(unsigned long, secs)
589 __field(unsigned long, c_old)
590 __field(unsigned long, c)
594 __entry->rcutorturename = rcutorturename;
596 __entry->secs = secs;
597 __entry->c_old = c_old;
601 TP_printk("%s torture read %p %luus c: %lu %lu",
602 __entry->rcutorturename, __entry->rhp,
603 __entry->secs, __entry->c_old, __entry->c)
607 * Tracepoint for _rcu_barrier() execution. The string "s" describes
608 * the _rcu_barrier phase:
609 * "Begin": rcu_barrier_callback() started.
610 * "Check": rcu_barrier_callback() checking for piggybacking.
611 * "EarlyExit": rcu_barrier_callback() piggybacked, thus early exit.
612 * "Inc1": rcu_barrier_callback() piggyback check counter incremented.
613 * "Offline": rcu_barrier_callback() found offline CPU
614 * "OnlineNoCB": rcu_barrier_callback() found online no-CBs CPU.
615 * "OnlineQ": rcu_barrier_callback() found online CPU with callbacks.
616 * "OnlineNQ": rcu_barrier_callback() found online CPU, no callbacks.
617 * "IRQ": An rcu_barrier_callback() callback posted on remote CPU.
618 * "CB": An rcu_barrier_callback() invoked a callback, not the last.
619 * "LastCB": An rcu_barrier_callback() invoked the last callback.
620 * "Inc2": rcu_barrier_callback() piggyback check counter incremented.
621 * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument
622 * is the count of remaining callbacks, and "done" is the piggybacking count.
624 TRACE_EVENT(rcu_barrier,
626 TP_PROTO(const char *rcuname, const char *s, int cpu, int cnt, unsigned long done),
628 TP_ARGS(rcuname, s, cpu, cnt, done),
631 __field(const char *, rcuname)
632 __field(const char *, s)
635 __field(unsigned long, done)
639 __entry->rcuname = rcuname;
643 __entry->done = done;
646 TP_printk("%s %s cpu %d remaining %d # %lu",
647 __entry->rcuname, __entry->s, __entry->cpu, __entry->cnt,
651 #else /* #ifdef CONFIG_RCU_TRACE */
653 #define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0)
654 #define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, \
655 qsmask) do { } while (0)
656 #define trace_rcu_future_grace_period(rcuname, gpnum, completed, c, \
657 level, grplo, grphi, event) \
659 #define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0)
660 #define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0)
661 #define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \
662 grplo, grphi, gp_tasks) do { } \
664 #define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0)
665 #define trace_rcu_dyntick(polarity, oldnesting, newnesting) do { } while (0)
666 #define trace_rcu_prep_idle(reason) do { } while (0)
667 #define trace_rcu_callback(rcuname, rhp, qlen_lazy, qlen) do { } while (0)
668 #define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen_lazy, qlen) \
670 #define trace_rcu_batch_start(rcuname, qlen_lazy, qlen, blimit) \
672 #define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0)
673 #define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0)
674 #define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \
676 #define trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
678 #define trace_rcu_barrier(name, s, cpu, cnt, done) do { } while (0)
680 #endif /* #else #ifdef CONFIG_RCU_TRACE */
682 #endif /* _TRACE_RCU_H */
684 /* This part must be outside protection */
685 #include <trace/define_trace.h>