Linux 3.9-rc4
[linux-2.6/cjktty.git] / include / trace / events / rcu.h
blob1918e832da4ffce61d1a057bd706ed52f81b07ce
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM rcu
4 #if !defined(_TRACE_RCU_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_RCU_H
7 #include <linux/tracepoint.h>
9 /*
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(char *s),
24 TP_ARGS(s),
26 TP_STRUCT__entry(
27 __field(char *, s)
30 TP_fast_assign(
31 __entry->s = 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(char *rcuname, unsigned long gpnum, char *gpevent),
56 TP_ARGS(rcuname, gpnum, gpevent),
58 TP_STRUCT__entry(
59 __field(char *, rcuname)
60 __field(unsigned long, gpnum)
61 __field(char *, gpevent)
64 TP_fast_assign(
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 grace-period-initialization events. These are
76 * distinguished by the type of RCU, the new grace-period number, the
77 * rcu_node structure level, the starting and ending CPU covered by the
78 * rcu_node structure, and the mask of CPUs that will be waited for.
79 * All but the type of RCU are extracted from the rcu_node structure.
81 TRACE_EVENT(rcu_grace_period_init,
83 TP_PROTO(char *rcuname, unsigned long gpnum, u8 level,
84 int grplo, int grphi, unsigned long qsmask),
86 TP_ARGS(rcuname, gpnum, level, grplo, grphi, qsmask),
88 TP_STRUCT__entry(
89 __field(char *, rcuname)
90 __field(unsigned long, gpnum)
91 __field(u8, level)
92 __field(int, grplo)
93 __field(int, grphi)
94 __field(unsigned long, qsmask)
97 TP_fast_assign(
98 __entry->rcuname = rcuname;
99 __entry->gpnum = gpnum;
100 __entry->level = level;
101 __entry->grplo = grplo;
102 __entry->grphi = grphi;
103 __entry->qsmask = qsmask;
106 TP_printk("%s %lu %u %d %d %lx",
107 __entry->rcuname, __entry->gpnum, __entry->level,
108 __entry->grplo, __entry->grphi, __entry->qsmask)
112 * Tracepoint for tasks blocking within preemptible-RCU read-side
113 * critical sections. Track the type of RCU (which one day might
114 * include SRCU), the grace-period number that the task is blocking
115 * (the current or the next), and the task's PID.
117 TRACE_EVENT(rcu_preempt_task,
119 TP_PROTO(char *rcuname, int pid, unsigned long gpnum),
121 TP_ARGS(rcuname, pid, gpnum),
123 TP_STRUCT__entry(
124 __field(char *, rcuname)
125 __field(unsigned long, gpnum)
126 __field(int, pid)
129 TP_fast_assign(
130 __entry->rcuname = rcuname;
131 __entry->gpnum = gpnum;
132 __entry->pid = pid;
135 TP_printk("%s %lu %d",
136 __entry->rcuname, __entry->gpnum, __entry->pid)
140 * Tracepoint for tasks that blocked within a given preemptible-RCU
141 * read-side critical section exiting that critical section. Track the
142 * type of RCU (which one day might include SRCU) and the task's PID.
144 TRACE_EVENT(rcu_unlock_preempted_task,
146 TP_PROTO(char *rcuname, unsigned long gpnum, int pid),
148 TP_ARGS(rcuname, gpnum, pid),
150 TP_STRUCT__entry(
151 __field(char *, rcuname)
152 __field(unsigned long, gpnum)
153 __field(int, pid)
156 TP_fast_assign(
157 __entry->rcuname = rcuname;
158 __entry->gpnum = gpnum;
159 __entry->pid = pid;
162 TP_printk("%s %lu %d", __entry->rcuname, __entry->gpnum, __entry->pid)
166 * Tracepoint for quiescent-state-reporting events. These are
167 * distinguished by the type of RCU, the grace-period number, the
168 * mask of quiescent lower-level entities, the rcu_node structure level,
169 * the starting and ending CPU covered by the rcu_node structure, and
170 * whether there are any blocked tasks blocking the current grace period.
171 * All but the type of RCU are extracted from the rcu_node structure.
173 TRACE_EVENT(rcu_quiescent_state_report,
175 TP_PROTO(char *rcuname, unsigned long gpnum,
176 unsigned long mask, unsigned long qsmask,
177 u8 level, int grplo, int grphi, int gp_tasks),
179 TP_ARGS(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks),
181 TP_STRUCT__entry(
182 __field(char *, rcuname)
183 __field(unsigned long, gpnum)
184 __field(unsigned long, mask)
185 __field(unsigned long, qsmask)
186 __field(u8, level)
187 __field(int, grplo)
188 __field(int, grphi)
189 __field(u8, gp_tasks)
192 TP_fast_assign(
193 __entry->rcuname = rcuname;
194 __entry->gpnum = gpnum;
195 __entry->mask = mask;
196 __entry->qsmask = qsmask;
197 __entry->level = level;
198 __entry->grplo = grplo;
199 __entry->grphi = grphi;
200 __entry->gp_tasks = gp_tasks;
203 TP_printk("%s %lu %lx>%lx %u %d %d %u",
204 __entry->rcuname, __entry->gpnum,
205 __entry->mask, __entry->qsmask, __entry->level,
206 __entry->grplo, __entry->grphi, __entry->gp_tasks)
210 * Tracepoint for quiescent states detected by force_quiescent_state().
211 * These trace events include the type of RCU, the grace-period number
212 * that was blocked by the CPU, the CPU itself, and the type of quiescent
213 * state, which can be "dti" for dyntick-idle mode, "ofl" for CPU offline,
214 * or "kick" when kicking a CPU that has been in dyntick-idle mode for
215 * too long.
217 TRACE_EVENT(rcu_fqs,
219 TP_PROTO(char *rcuname, unsigned long gpnum, int cpu, char *qsevent),
221 TP_ARGS(rcuname, gpnum, cpu, qsevent),
223 TP_STRUCT__entry(
224 __field(char *, rcuname)
225 __field(unsigned long, gpnum)
226 __field(int, cpu)
227 __field(char *, qsevent)
230 TP_fast_assign(
231 __entry->rcuname = rcuname;
232 __entry->gpnum = gpnum;
233 __entry->cpu = cpu;
234 __entry->qsevent = qsevent;
237 TP_printk("%s %lu %d %s",
238 __entry->rcuname, __entry->gpnum,
239 __entry->cpu, __entry->qsevent)
242 #endif /* #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) */
245 * Tracepoint for dyntick-idle entry/exit events. These take a string
246 * as argument: "Start" for entering dyntick-idle mode, "End" for
247 * leaving it, "--=" for events moving towards idle, and "++=" for events
248 * moving away from idle. "Error on entry: not idle task" and "Error on
249 * exit: not idle task" indicate that a non-idle task is erroneously
250 * toying with the idle loop.
252 * These events also take a pair of numbers, which indicate the nesting
253 * depth before and after the event of interest. Note that task-related
254 * events use the upper bits of each number, while interrupt-related
255 * events use the lower bits.
257 TRACE_EVENT(rcu_dyntick,
259 TP_PROTO(char *polarity, long long oldnesting, long long newnesting),
261 TP_ARGS(polarity, oldnesting, newnesting),
263 TP_STRUCT__entry(
264 __field(char *, polarity)
265 __field(long long, oldnesting)
266 __field(long long, newnesting)
269 TP_fast_assign(
270 __entry->polarity = polarity;
271 __entry->oldnesting = oldnesting;
272 __entry->newnesting = newnesting;
275 TP_printk("%s %llx %llx", __entry->polarity,
276 __entry->oldnesting, __entry->newnesting)
280 * Tracepoint for RCU preparation for idle, the goal being to get RCU
281 * processing done so that the current CPU can shut off its scheduling
282 * clock and enter dyntick-idle mode. One way to accomplish this is
283 * to drain all RCU callbacks from this CPU, and the other is to have
284 * done everything RCU requires for the current grace period. In this
285 * latter case, the CPU will be awakened at the end of the current grace
286 * period in order to process the remainder of its callbacks.
288 * These tracepoints take a string as argument:
290 * "No callbacks": Nothing to do, no callbacks on this CPU.
291 * "In holdoff": Nothing to do, holding off after unsuccessful attempt.
292 * "Begin holdoff": Attempt failed, don't retry until next jiffy.
293 * "Dyntick with callbacks": Entering dyntick-idle despite callbacks.
294 * "Dyntick with lazy callbacks": Entering dyntick-idle w/lazy callbacks.
295 * "More callbacks": Still more callbacks, try again to clear them out.
296 * "Callbacks drained": All callbacks processed, off to dyntick idle!
297 * "Timer": Timer fired to cause CPU to continue processing callbacks.
298 * "Demigrate": Timer fired on wrong CPU, woke up correct CPU.
299 * "Cleanup after idle": Idle exited, timer canceled.
301 TRACE_EVENT(rcu_prep_idle,
303 TP_PROTO(char *reason),
305 TP_ARGS(reason),
307 TP_STRUCT__entry(
308 __field(char *, reason)
311 TP_fast_assign(
312 __entry->reason = reason;
315 TP_printk("%s", __entry->reason)
319 * Tracepoint for the registration of a single RCU callback function.
320 * The first argument is the type of RCU, the second argument is
321 * a pointer to the RCU callback itself, the third element is the
322 * number of lazy callbacks queued, and the fourth element is the
323 * total number of callbacks queued.
325 TRACE_EVENT(rcu_callback,
327 TP_PROTO(char *rcuname, struct rcu_head *rhp, long qlen_lazy,
328 long qlen),
330 TP_ARGS(rcuname, rhp, qlen_lazy, qlen),
332 TP_STRUCT__entry(
333 __field(char *, rcuname)
334 __field(void *, rhp)
335 __field(void *, func)
336 __field(long, qlen_lazy)
337 __field(long, qlen)
340 TP_fast_assign(
341 __entry->rcuname = rcuname;
342 __entry->rhp = rhp;
343 __entry->func = rhp->func;
344 __entry->qlen_lazy = qlen_lazy;
345 __entry->qlen = qlen;
348 TP_printk("%s rhp=%p func=%pf %ld/%ld",
349 __entry->rcuname, __entry->rhp, __entry->func,
350 __entry->qlen_lazy, __entry->qlen)
354 * Tracepoint for the registration of a single RCU callback of the special
355 * kfree() form. The first argument is the RCU type, the second argument
356 * is a pointer to the RCU callback, the third argument is the offset
357 * of the callback within the enclosing RCU-protected data structure,
358 * the fourth argument is the number of lazy callbacks queued, and the
359 * fifth argument is the total number of callbacks queued.
361 TRACE_EVENT(rcu_kfree_callback,
363 TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset,
364 long qlen_lazy, long qlen),
366 TP_ARGS(rcuname, rhp, offset, qlen_lazy, qlen),
368 TP_STRUCT__entry(
369 __field(char *, rcuname)
370 __field(void *, rhp)
371 __field(unsigned long, offset)
372 __field(long, qlen_lazy)
373 __field(long, qlen)
376 TP_fast_assign(
377 __entry->rcuname = rcuname;
378 __entry->rhp = rhp;
379 __entry->offset = offset;
380 __entry->qlen_lazy = qlen_lazy;
381 __entry->qlen = qlen;
384 TP_printk("%s rhp=%p func=%ld %ld/%ld",
385 __entry->rcuname, __entry->rhp, __entry->offset,
386 __entry->qlen_lazy, __entry->qlen)
390 * Tracepoint for marking the beginning rcu_do_batch, performed to start
391 * RCU callback invocation. The first argument is the RCU flavor,
392 * the second is the number of lazy callbacks queued, the third is
393 * the total number of callbacks queued, and the fourth argument is
394 * the current RCU-callback batch limit.
396 TRACE_EVENT(rcu_batch_start,
398 TP_PROTO(char *rcuname, long qlen_lazy, long qlen, long blimit),
400 TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
402 TP_STRUCT__entry(
403 __field(char *, rcuname)
404 __field(long, qlen_lazy)
405 __field(long, qlen)
406 __field(long, blimit)
409 TP_fast_assign(
410 __entry->rcuname = rcuname;
411 __entry->qlen_lazy = qlen_lazy;
412 __entry->qlen = qlen;
413 __entry->blimit = blimit;
416 TP_printk("%s CBs=%ld/%ld bl=%ld",
417 __entry->rcuname, __entry->qlen_lazy, __entry->qlen,
418 __entry->blimit)
422 * Tracepoint for the invocation of a single RCU callback function.
423 * The first argument is the type of RCU, and the second argument is
424 * a pointer to the RCU callback itself.
426 TRACE_EVENT(rcu_invoke_callback,
428 TP_PROTO(char *rcuname, struct rcu_head *rhp),
430 TP_ARGS(rcuname, rhp),
432 TP_STRUCT__entry(
433 __field(char *, rcuname)
434 __field(void *, rhp)
435 __field(void *, func)
438 TP_fast_assign(
439 __entry->rcuname = rcuname;
440 __entry->rhp = rhp;
441 __entry->func = rhp->func;
444 TP_printk("%s rhp=%p func=%pf",
445 __entry->rcuname, __entry->rhp, __entry->func)
449 * Tracepoint for the invocation of a single RCU callback of the special
450 * kfree() form. The first argument is the RCU flavor, the second
451 * argument is a pointer to the RCU callback, and the third argument
452 * is the offset of the callback within the enclosing RCU-protected
453 * data structure.
455 TRACE_EVENT(rcu_invoke_kfree_callback,
457 TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset),
459 TP_ARGS(rcuname, rhp, offset),
461 TP_STRUCT__entry(
462 __field(char *, rcuname)
463 __field(void *, rhp)
464 __field(unsigned long, offset)
467 TP_fast_assign(
468 __entry->rcuname = rcuname;
469 __entry->rhp = rhp;
470 __entry->offset = offset;
473 TP_printk("%s rhp=%p func=%ld",
474 __entry->rcuname, __entry->rhp, __entry->offset)
478 * Tracepoint for exiting rcu_do_batch after RCU callbacks have been
479 * invoked. The first argument is the name of the RCU flavor,
480 * the second argument is number of callbacks actually invoked,
481 * the third argument (cb) is whether or not any of the callbacks that
482 * were ready to invoke at the beginning of this batch are still
483 * queued, the fourth argument (nr) is the return value of need_resched(),
484 * the fifth argument (iit) is 1 if the current task is the idle task,
485 * and the sixth argument (risk) is the return value from
486 * rcu_is_callbacks_kthread().
488 TRACE_EVENT(rcu_batch_end,
490 TP_PROTO(char *rcuname, int callbacks_invoked,
491 bool cb, bool nr, bool iit, bool risk),
493 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
495 TP_STRUCT__entry(
496 __field(char *, rcuname)
497 __field(int, callbacks_invoked)
498 __field(bool, cb)
499 __field(bool, nr)
500 __field(bool, iit)
501 __field(bool, risk)
504 TP_fast_assign(
505 __entry->rcuname = rcuname;
506 __entry->callbacks_invoked = callbacks_invoked;
507 __entry->cb = cb;
508 __entry->nr = nr;
509 __entry->iit = iit;
510 __entry->risk = risk;
513 TP_printk("%s CBs-invoked=%d idle=%c%c%c%c",
514 __entry->rcuname, __entry->callbacks_invoked,
515 __entry->cb ? 'C' : '.',
516 __entry->nr ? 'S' : '.',
517 __entry->iit ? 'I' : '.',
518 __entry->risk ? 'R' : '.')
522 * Tracepoint for rcutorture readers. The first argument is the name
523 * of the RCU flavor from rcutorture's viewpoint and the second argument
524 * is the callback address.
526 TRACE_EVENT(rcu_torture_read,
528 TP_PROTO(char *rcutorturename, struct rcu_head *rhp,
529 unsigned long secs, unsigned long c_old, unsigned long c),
531 TP_ARGS(rcutorturename, rhp, secs, c_old, c),
533 TP_STRUCT__entry(
534 __field(char *, rcutorturename)
535 __field(struct rcu_head *, rhp)
536 __field(unsigned long, secs)
537 __field(unsigned long, c_old)
538 __field(unsigned long, c)
541 TP_fast_assign(
542 __entry->rcutorturename = rcutorturename;
543 __entry->rhp = rhp;
544 __entry->secs = secs;
545 __entry->c_old = c_old;
546 __entry->c = c;
549 TP_printk("%s torture read %p %luus c: %lu %lu",
550 __entry->rcutorturename, __entry->rhp,
551 __entry->secs, __entry->c_old, __entry->c)
555 * Tracepoint for _rcu_barrier() execution. The string "s" describes
556 * the _rcu_barrier phase:
557 * "Begin": rcu_barrier_callback() started.
558 * "Check": rcu_barrier_callback() checking for piggybacking.
559 * "EarlyExit": rcu_barrier_callback() piggybacked, thus early exit.
560 * "Inc1": rcu_barrier_callback() piggyback check counter incremented.
561 * "Offline": rcu_barrier_callback() found offline CPU
562 * "OnlineNoCB": rcu_barrier_callback() found online no-CBs CPU.
563 * "OnlineQ": rcu_barrier_callback() found online CPU with callbacks.
564 * "OnlineNQ": rcu_barrier_callback() found online CPU, no callbacks.
565 * "IRQ": An rcu_barrier_callback() callback posted on remote CPU.
566 * "CB": An rcu_barrier_callback() invoked a callback, not the last.
567 * "LastCB": An rcu_barrier_callback() invoked the last callback.
568 * "Inc2": rcu_barrier_callback() piggyback check counter incremented.
569 * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument
570 * is the count of remaining callbacks, and "done" is the piggybacking count.
572 TRACE_EVENT(rcu_barrier,
574 TP_PROTO(char *rcuname, char *s, int cpu, int cnt, unsigned long done),
576 TP_ARGS(rcuname, s, cpu, cnt, done),
578 TP_STRUCT__entry(
579 __field(char *, rcuname)
580 __field(char *, s)
581 __field(int, cpu)
582 __field(int, cnt)
583 __field(unsigned long, done)
586 TP_fast_assign(
587 __entry->rcuname = rcuname;
588 __entry->s = s;
589 __entry->cpu = cpu;
590 __entry->cnt = cnt;
591 __entry->done = done;
594 TP_printk("%s %s cpu %d remaining %d # %lu",
595 __entry->rcuname, __entry->s, __entry->cpu, __entry->cnt,
596 __entry->done)
599 #else /* #ifdef CONFIG_RCU_TRACE */
601 #define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0)
602 #define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, \
603 qsmask) do { } while (0)
604 #define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0)
605 #define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0)
606 #define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \
607 grplo, grphi, gp_tasks) do { } \
608 while (0)
609 #define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0)
610 #define trace_rcu_dyntick(polarity, oldnesting, newnesting) do { } while (0)
611 #define trace_rcu_prep_idle(reason) do { } while (0)
612 #define trace_rcu_callback(rcuname, rhp, qlen_lazy, qlen) do { } while (0)
613 #define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen_lazy, qlen) \
614 do { } while (0)
615 #define trace_rcu_batch_start(rcuname, qlen_lazy, qlen, blimit) \
616 do { } while (0)
617 #define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0)
618 #define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0)
619 #define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \
620 do { } while (0)
621 #define trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
622 do { } while (0)
623 #define trace_rcu_barrier(name, s, cpu, cnt, done) do { } while (0)
625 #endif /* #else #ifdef CONFIG_RCU_TRACE */
627 #endif /* _TRACE_RCU_H */
629 /* This part must be outside protection */
630 #include <trace/define_trace.h>