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