Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #undef TRACE_SYSTEM
0003 #define TRACE_SYSTEM rcu
0004 
0005 #if !defined(_TRACE_RCU_H) || defined(TRACE_HEADER_MULTI_READ)
0006 #define _TRACE_RCU_H
0007 
0008 #include <linux/tracepoint.h>
0009 
0010 #ifdef CONFIG_RCU_TRACE
0011 #define TRACE_EVENT_RCU TRACE_EVENT
0012 #else
0013 #define TRACE_EVENT_RCU TRACE_EVENT_NOP
0014 #endif
0015 
0016 /*
0017  * Tracepoint for start/end markers used for utilization calculations.
0018  * By convention, the string is of the following forms:
0019  *
0020  * "Start <activity>" -- Mark the start of the specified activity,
0021  *           such as "context switch".  Nesting is permitted.
0022  * "End <activity>" -- Mark the end of the specified activity.
0023  *
0024  * An "@" character within "<activity>" is a comment character: Data
0025  * reduction scripts will ignore the "@" and the remainder of the line.
0026  */
0027 TRACE_EVENT(rcu_utilization,
0028 
0029     TP_PROTO(const char *s),
0030 
0031     TP_ARGS(s),
0032 
0033     TP_STRUCT__entry(
0034         __field(const char *, s)
0035     ),
0036 
0037     TP_fast_assign(
0038         __entry->s = s;
0039     ),
0040 
0041     TP_printk("%s", __entry->s)
0042 );
0043 
0044 #if defined(CONFIG_TREE_RCU)
0045 
0046 /*
0047  * Tracepoint for grace-period events.  Takes a string identifying the
0048  * RCU flavor, the grace-period number, and a string identifying the
0049  * grace-period-related event as follows:
0050  *
0051  *  "AccReadyCB": CPU accelerates new callbacks to RCU_NEXT_READY_TAIL.
0052  *  "AccWaitCB": CPU accelerates new callbacks to RCU_WAIT_TAIL.
0053  *  "newreq": Request a new grace period.
0054  *  "start": Start a grace period.
0055  *  "cpustart": CPU first notices a grace-period start.
0056  *  "cpuqs": CPU passes through a quiescent state.
0057  *  "cpuonl": CPU comes online.
0058  *  "cpuofl": CPU goes offline.
0059  *  "cpuofl-bgp": CPU goes offline while blocking a grace period.
0060  *  "reqwait": GP kthread sleeps waiting for grace-period request.
0061  *  "reqwaitsig": GP kthread awakened by signal from reqwait state.
0062  *  "fqswait": GP kthread waiting until time to force quiescent states.
0063  *  "fqsstart": GP kthread starts forcing quiescent states.
0064  *  "fqsend": GP kthread done forcing quiescent states.
0065  *  "fqswaitsig": GP kthread awakened by signal from fqswait state.
0066  *  "end": End a grace period.
0067  *  "cpuend": CPU first notices a grace-period end.
0068  */
0069 TRACE_EVENT_RCU(rcu_grace_period,
0070 
0071     TP_PROTO(const char *rcuname, unsigned long gp_seq, const char *gpevent),
0072 
0073     TP_ARGS(rcuname, gp_seq, gpevent),
0074 
0075     TP_STRUCT__entry(
0076         __field(const char *, rcuname)
0077         __field(long, gp_seq)
0078         __field(const char *, gpevent)
0079     ),
0080 
0081     TP_fast_assign(
0082         __entry->rcuname = rcuname;
0083         __entry->gp_seq = (long)gp_seq;
0084         __entry->gpevent = gpevent;
0085     ),
0086 
0087     TP_printk("%s %ld %s",
0088           __entry->rcuname, __entry->gp_seq, __entry->gpevent)
0089 );
0090 
0091 /*
0092  * Tracepoint for future grace-period events.  The caller should pull
0093  * the data from the rcu_node structure, other than rcuname, which comes
0094  * from the rcu_state structure, and event, which is one of the following:
0095  *
0096  * "Cleanup": Clean up rcu_node structure after previous GP.
0097  * "CleanupMore": Clean up, and another GP is needed.
0098  * "EndWait": Complete wait.
0099  * "NoGPkthread": The RCU grace-period kthread has not yet started.
0100  * "Prestarted": Someone beat us to the request
0101  * "Startedleaf": Leaf node marked for future GP.
0102  * "Startedleafroot": All nodes from leaf to root marked for future GP.
0103  * "Startedroot": Requested a nocb grace period based on root-node data.
0104  * "Startleaf": Request a grace period based on leaf-node data.
0105  * "StartWait": Start waiting for the requested grace period.
0106  */
0107 TRACE_EVENT_RCU(rcu_future_grace_period,
0108 
0109     TP_PROTO(const char *rcuname, unsigned long gp_seq,
0110          unsigned long gp_seq_req, u8 level, int grplo, int grphi,
0111          const char *gpevent),
0112 
0113     TP_ARGS(rcuname, gp_seq, gp_seq_req, level, grplo, grphi, gpevent),
0114 
0115     TP_STRUCT__entry(
0116         __field(const char *, rcuname)
0117         __field(long, gp_seq)
0118         __field(long, gp_seq_req)
0119         __field(u8, level)
0120         __field(int, grplo)
0121         __field(int, grphi)
0122         __field(const char *, gpevent)
0123     ),
0124 
0125     TP_fast_assign(
0126         __entry->rcuname = rcuname;
0127         __entry->gp_seq = (long)gp_seq;
0128         __entry->gp_seq_req = (long)gp_seq_req;
0129         __entry->level = level;
0130         __entry->grplo = grplo;
0131         __entry->grphi = grphi;
0132         __entry->gpevent = gpevent;
0133     ),
0134 
0135     TP_printk("%s %ld %ld %u %d %d %s",
0136           __entry->rcuname, (long)__entry->gp_seq, (long)__entry->gp_seq_req, __entry->level,
0137           __entry->grplo, __entry->grphi, __entry->gpevent)
0138 );
0139 
0140 /*
0141  * Tracepoint for grace-period-initialization events.  These are
0142  * distinguished by the type of RCU, the new grace-period number, the
0143  * rcu_node structure level, the starting and ending CPU covered by the
0144  * rcu_node structure, and the mask of CPUs that will be waited for.
0145  * All but the type of RCU are extracted from the rcu_node structure.
0146  */
0147 TRACE_EVENT_RCU(rcu_grace_period_init,
0148 
0149     TP_PROTO(const char *rcuname, unsigned long gp_seq, u8 level,
0150          int grplo, int grphi, unsigned long qsmask),
0151 
0152     TP_ARGS(rcuname, gp_seq, level, grplo, grphi, qsmask),
0153 
0154     TP_STRUCT__entry(
0155         __field(const char *, rcuname)
0156         __field(long, gp_seq)
0157         __field(u8, level)
0158         __field(int, grplo)
0159         __field(int, grphi)
0160         __field(unsigned long, qsmask)
0161     ),
0162 
0163     TP_fast_assign(
0164         __entry->rcuname = rcuname;
0165         __entry->gp_seq = (long)gp_seq;
0166         __entry->level = level;
0167         __entry->grplo = grplo;
0168         __entry->grphi = grphi;
0169         __entry->qsmask = qsmask;
0170     ),
0171 
0172     TP_printk("%s %ld %u %d %d %lx",
0173           __entry->rcuname, __entry->gp_seq, __entry->level,
0174           __entry->grplo, __entry->grphi, __entry->qsmask)
0175 );
0176 
0177 /*
0178  * Tracepoint for expedited grace-period events.  Takes a string identifying
0179  * the RCU flavor, the expedited grace-period sequence number, and a string
0180  * identifying the grace-period-related event as follows:
0181  *
0182  *  "snap": Captured snapshot of expedited grace period sequence number.
0183  *  "start": Started a real expedited grace period.
0184  *  "reset": Started resetting the tree
0185  *  "select": Started selecting the CPUs to wait on.
0186  *  "selectofl": Selected CPU partially offline.
0187  *  "startwait": Started waiting on selected CPUs.
0188  *  "end": Ended a real expedited grace period.
0189  *  "endwake": Woke piggybackers up.
0190  *  "done": Someone else did the expedited grace period for us.
0191  */
0192 TRACE_EVENT_RCU(rcu_exp_grace_period,
0193 
0194     TP_PROTO(const char *rcuname, unsigned long gpseq, const char *gpevent),
0195 
0196     TP_ARGS(rcuname, gpseq, gpevent),
0197 
0198     TP_STRUCT__entry(
0199         __field(const char *, rcuname)
0200         __field(long, gpseq)
0201         __field(const char *, gpevent)
0202     ),
0203 
0204     TP_fast_assign(
0205         __entry->rcuname = rcuname;
0206         __entry->gpseq = (long)gpseq;
0207         __entry->gpevent = gpevent;
0208     ),
0209 
0210     TP_printk("%s %ld %s",
0211           __entry->rcuname, __entry->gpseq, __entry->gpevent)
0212 );
0213 
0214 /*
0215  * Tracepoint for expedited grace-period funnel-locking events.  Takes a
0216  * string identifying the RCU flavor, an integer identifying the rcu_node
0217  * combining-tree level, another pair of integers identifying the lowest-
0218  * and highest-numbered CPU associated with the current rcu_node structure,
0219  * and a string.  identifying the grace-period-related event as follows:
0220  *
0221  *  "nxtlvl": Advance to next level of rcu_node funnel
0222  *  "wait": Wait for someone else to do expedited GP
0223  */
0224 TRACE_EVENT_RCU(rcu_exp_funnel_lock,
0225 
0226     TP_PROTO(const char *rcuname, u8 level, int grplo, int grphi,
0227          const char *gpevent),
0228 
0229     TP_ARGS(rcuname, level, grplo, grphi, gpevent),
0230 
0231     TP_STRUCT__entry(
0232         __field(const char *, rcuname)
0233         __field(u8, level)
0234         __field(int, grplo)
0235         __field(int, grphi)
0236         __field(const char *, gpevent)
0237     ),
0238 
0239     TP_fast_assign(
0240         __entry->rcuname = rcuname;
0241         __entry->level = level;
0242         __entry->grplo = grplo;
0243         __entry->grphi = grphi;
0244         __entry->gpevent = gpevent;
0245     ),
0246 
0247     TP_printk("%s %d %d %d %s",
0248           __entry->rcuname, __entry->level, __entry->grplo,
0249           __entry->grphi, __entry->gpevent)
0250 );
0251 
0252 #ifdef CONFIG_RCU_NOCB_CPU
0253 /*
0254  * Tracepoint for RCU no-CBs CPU callback handoffs.  This event is intended
0255  * to assist debugging of these handoffs.
0256  *
0257  * The first argument is the name of the RCU flavor, and the second is
0258  * the number of the offloaded CPU are extracted.  The third and final
0259  * argument is a string as follows:
0260  *
0261  * "AlreadyAwake": The to-be-awakened rcuo kthread is already awake.
0262  * "Bypass": rcuo GP kthread sees non-empty ->nocb_bypass.
0263  * "CBSleep": rcuo CB kthread sleeping waiting for CBs.
0264  * "Check": rcuo GP kthread checking specified CPU for work.
0265  * "DeferredWake": Timer expired or polled check, time to wake.
0266  * "DoWake": The to-be-awakened rcuo kthread needs to be awakened.
0267  * "EndSleep": Done waiting for GP for !rcu_nocb_poll.
0268  * "FirstBQ": New CB to empty ->nocb_bypass (->cblist maybe non-empty).
0269  * "FirstBQnoWake": FirstBQ plus rcuo kthread need not be awakened.
0270  * "FirstBQwake": FirstBQ plus rcuo kthread must be awakened.
0271  * "FirstQ": New CB to empty ->cblist (->nocb_bypass maybe non-empty).
0272  * "NeedWaitGP": rcuo GP kthread must wait on a grace period.
0273  * "Poll": Start of new polling cycle for rcu_nocb_poll.
0274  * "Sleep": Sleep waiting for GP for !rcu_nocb_poll.
0275  * "Timer": Deferred-wake timer expired.
0276  * "WakeEmptyIsDeferred": Wake rcuo kthread later, first CB to empty list.
0277  * "WakeEmpty": Wake rcuo kthread, first CB to empty list.
0278  * "WakeNot": Don't wake rcuo kthread.
0279  * "WakeNotPoll": Don't wake rcuo kthread because it is polling.
0280  * "WakeOvfIsDeferred": Wake rcuo kthread later, CB list is huge.
0281  * "WakeBypassIsDeferred": Wake rcuo kthread later, bypass list is contended.
0282  * "WokeEmpty": rcuo CB kthread woke to find empty list.
0283  */
0284 TRACE_EVENT_RCU(rcu_nocb_wake,
0285 
0286     TP_PROTO(const char *rcuname, int cpu, const char *reason),
0287 
0288     TP_ARGS(rcuname, cpu, reason),
0289 
0290     TP_STRUCT__entry(
0291         __field(const char *, rcuname)
0292         __field(int, cpu)
0293         __field(const char *, reason)
0294     ),
0295 
0296     TP_fast_assign(
0297         __entry->rcuname = rcuname;
0298         __entry->cpu = cpu;
0299         __entry->reason = reason;
0300     ),
0301 
0302     TP_printk("%s %d %s", __entry->rcuname, __entry->cpu, __entry->reason)
0303 );
0304 #endif
0305 
0306 /*
0307  * Tracepoint for tasks blocking within preemptible-RCU read-side
0308  * critical sections.  Track the type of RCU (which one day might
0309  * include SRCU), the grace-period number that the task is blocking
0310  * (the current or the next), and the task's PID.
0311  */
0312 TRACE_EVENT_RCU(rcu_preempt_task,
0313 
0314     TP_PROTO(const char *rcuname, int pid, unsigned long gp_seq),
0315 
0316     TP_ARGS(rcuname, pid, gp_seq),
0317 
0318     TP_STRUCT__entry(
0319         __field(const char *, rcuname)
0320         __field(long, gp_seq)
0321         __field(int, pid)
0322     ),
0323 
0324     TP_fast_assign(
0325         __entry->rcuname = rcuname;
0326         __entry->gp_seq = (long)gp_seq;
0327         __entry->pid = pid;
0328     ),
0329 
0330     TP_printk("%s %ld %d",
0331           __entry->rcuname, __entry->gp_seq, __entry->pid)
0332 );
0333 
0334 /*
0335  * Tracepoint for tasks that blocked within a given preemptible-RCU
0336  * read-side critical section exiting that critical section.  Track the
0337  * type of RCU (which one day might include SRCU) and the task's PID.
0338  */
0339 TRACE_EVENT_RCU(rcu_unlock_preempted_task,
0340 
0341     TP_PROTO(const char *rcuname, unsigned long gp_seq, int pid),
0342 
0343     TP_ARGS(rcuname, gp_seq, pid),
0344 
0345     TP_STRUCT__entry(
0346         __field(const char *, rcuname)
0347         __field(long, gp_seq)
0348         __field(int, pid)
0349     ),
0350 
0351     TP_fast_assign(
0352         __entry->rcuname = rcuname;
0353         __entry->gp_seq = (long)gp_seq;
0354         __entry->pid = pid;
0355     ),
0356 
0357     TP_printk("%s %ld %d", __entry->rcuname, __entry->gp_seq, __entry->pid)
0358 );
0359 
0360 /*
0361  * Tracepoint for quiescent-state-reporting events.  These are
0362  * distinguished by the type of RCU, the grace-period number, the
0363  * mask of quiescent lower-level entities, the rcu_node structure level,
0364  * the starting and ending CPU covered by the rcu_node structure, and
0365  * whether there are any blocked tasks blocking the current grace period.
0366  * All but the type of RCU are extracted from the rcu_node structure.
0367  */
0368 TRACE_EVENT_RCU(rcu_quiescent_state_report,
0369 
0370     TP_PROTO(const char *rcuname, unsigned long gp_seq,
0371          unsigned long mask, unsigned long qsmask,
0372          u8 level, int grplo, int grphi, int gp_tasks),
0373 
0374     TP_ARGS(rcuname, gp_seq, mask, qsmask, level, grplo, grphi, gp_tasks),
0375 
0376     TP_STRUCT__entry(
0377         __field(const char *, rcuname)
0378         __field(long, gp_seq)
0379         __field(unsigned long, mask)
0380         __field(unsigned long, qsmask)
0381         __field(u8, level)
0382         __field(int, grplo)
0383         __field(int, grphi)
0384         __field(u8, gp_tasks)
0385     ),
0386 
0387     TP_fast_assign(
0388         __entry->rcuname = rcuname;
0389         __entry->gp_seq = (long)gp_seq;
0390         __entry->mask = mask;
0391         __entry->qsmask = qsmask;
0392         __entry->level = level;
0393         __entry->grplo = grplo;
0394         __entry->grphi = grphi;
0395         __entry->gp_tasks = gp_tasks;
0396     ),
0397 
0398     TP_printk("%s %ld %lx>%lx %u %d %d %u",
0399           __entry->rcuname, __entry->gp_seq,
0400           __entry->mask, __entry->qsmask, __entry->level,
0401           __entry->grplo, __entry->grphi, __entry->gp_tasks)
0402 );
0403 
0404 /*
0405  * Tracepoint for quiescent states detected by force_quiescent_state().
0406  * These trace events include the type of RCU, the grace-period number
0407  * that was blocked by the CPU, the CPU itself, and the type of quiescent
0408  * state, which can be "dti" for dyntick-idle mode or "kick" when kicking
0409  * a CPU that has been in dyntick-idle mode for too long.
0410  */
0411 TRACE_EVENT_RCU(rcu_fqs,
0412 
0413     TP_PROTO(const char *rcuname, unsigned long gp_seq, int cpu, const char *qsevent),
0414 
0415     TP_ARGS(rcuname, gp_seq, cpu, qsevent),
0416 
0417     TP_STRUCT__entry(
0418         __field(const char *, rcuname)
0419         __field(long, gp_seq)
0420         __field(int, cpu)
0421         __field(const char *, qsevent)
0422     ),
0423 
0424     TP_fast_assign(
0425         __entry->rcuname = rcuname;
0426         __entry->gp_seq = (long)gp_seq;
0427         __entry->cpu = cpu;
0428         __entry->qsevent = qsevent;
0429     ),
0430 
0431     TP_printk("%s %ld %d %s",
0432           __entry->rcuname, __entry->gp_seq,
0433           __entry->cpu, __entry->qsevent)
0434 );
0435 
0436 /*
0437  * Tracepoint for RCU stall events. Takes a string identifying the RCU flavor
0438  * and a string identifying which function detected the RCU stall as follows:
0439  *
0440  *  "StallDetected": Scheduler-tick detects other CPU's stalls.
0441  *  "SelfDetected": Scheduler-tick detects a current CPU's stall.
0442  *  "ExpeditedStall": Expedited grace period detects stalls.
0443  */
0444 TRACE_EVENT(rcu_stall_warning,
0445 
0446     TP_PROTO(const char *rcuname, const char *msg),
0447 
0448     TP_ARGS(rcuname, msg),
0449 
0450     TP_STRUCT__entry(
0451         __field(const char *, rcuname)
0452         __field(const char *, msg)
0453     ),
0454 
0455     TP_fast_assign(
0456         __entry->rcuname = rcuname;
0457         __entry->msg = msg;
0458     ),
0459 
0460     TP_printk("%s %s",
0461           __entry->rcuname, __entry->msg)
0462 );
0463 
0464 #endif /* #if defined(CONFIG_TREE_RCU) */
0465 
0466 /*
0467  * Tracepoint for dyntick-idle entry/exit events.  These take 2 strings
0468  * as argument:
0469  * polarity: "Start", "End", "StillNonIdle" for entering, exiting or still not
0470  *            being in dyntick-idle mode.
0471  * context: "USER" or "IDLE" or "IRQ".
0472  * NMIs nested in IRQs are inferred with dynticks_nesting > 1 in IRQ context.
0473  *
0474  * These events also take a pair of numbers, which indicate the nesting
0475  * depth before and after the event of interest, and a third number that is
0476  * the ->dynticks counter.  Note that task-related and interrupt-related
0477  * events use two separate counters, and that the "++=" and "--=" events
0478  * for irq/NMI will change the counter by two, otherwise by one.
0479  */
0480 TRACE_EVENT_RCU(rcu_dyntick,
0481 
0482     TP_PROTO(const char *polarity, long oldnesting, long newnesting, int dynticks),
0483 
0484     TP_ARGS(polarity, oldnesting, newnesting, dynticks),
0485 
0486     TP_STRUCT__entry(
0487         __field(const char *, polarity)
0488         __field(long, oldnesting)
0489         __field(long, newnesting)
0490         __field(int, dynticks)
0491     ),
0492 
0493     TP_fast_assign(
0494         __entry->polarity = polarity;
0495         __entry->oldnesting = oldnesting;
0496         __entry->newnesting = newnesting;
0497         __entry->dynticks = dynticks;
0498     ),
0499 
0500     TP_printk("%s %lx %lx %#3x", __entry->polarity,
0501           __entry->oldnesting, __entry->newnesting,
0502           __entry->dynticks & 0xfff)
0503 );
0504 
0505 /*
0506  * Tracepoint for the registration of a single RCU callback function.
0507  * The first argument is the type of RCU, the second argument is
0508  * a pointer to the RCU callback itself, the third element is the
0509  * number of lazy callbacks queued, and the fourth element is the
0510  * total number of callbacks queued.
0511  */
0512 TRACE_EVENT_RCU(rcu_callback,
0513 
0514     TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen),
0515 
0516     TP_ARGS(rcuname, rhp, qlen),
0517 
0518     TP_STRUCT__entry(
0519         __field(const char *, rcuname)
0520         __field(void *, rhp)
0521         __field(void *, func)
0522         __field(long, qlen)
0523     ),
0524 
0525     TP_fast_assign(
0526         __entry->rcuname = rcuname;
0527         __entry->rhp = rhp;
0528         __entry->func = rhp->func;
0529         __entry->qlen = qlen;
0530     ),
0531 
0532     TP_printk("%s rhp=%p func=%ps %ld",
0533           __entry->rcuname, __entry->rhp, __entry->func,
0534           __entry->qlen)
0535 );
0536 
0537 TRACE_EVENT_RCU(rcu_segcb_stats,
0538 
0539         TP_PROTO(struct rcu_segcblist *rs, const char *ctx),
0540 
0541         TP_ARGS(rs, ctx),
0542 
0543         TP_STRUCT__entry(
0544             __field(const char *, ctx)
0545             __array(unsigned long, gp_seq, RCU_CBLIST_NSEGS)
0546             __array(long, seglen, RCU_CBLIST_NSEGS)
0547         ),
0548 
0549         TP_fast_assign(
0550             __entry->ctx = ctx;
0551             memcpy(__entry->seglen, rs->seglen, RCU_CBLIST_NSEGS * sizeof(long));
0552             memcpy(__entry->gp_seq, rs->gp_seq, RCU_CBLIST_NSEGS * sizeof(unsigned long));
0553 
0554         ),
0555 
0556         TP_printk("%s seglen: (DONE=%ld, WAIT=%ld, NEXT_READY=%ld, NEXT=%ld) "
0557               "gp_seq: (DONE=%lu, WAIT=%lu, NEXT_READY=%lu, NEXT=%lu)", __entry->ctx,
0558               __entry->seglen[0], __entry->seglen[1], __entry->seglen[2], __entry->seglen[3],
0559               __entry->gp_seq[0], __entry->gp_seq[1], __entry->gp_seq[2], __entry->gp_seq[3])
0560 
0561 );
0562 
0563 /*
0564  * Tracepoint for the registration of a single RCU callback of the special
0565  * kvfree() form.  The first argument is the RCU type, the second argument
0566  * is a pointer to the RCU callback, the third argument is the offset
0567  * of the callback within the enclosing RCU-protected data structure,
0568  * the fourth argument is the number of lazy callbacks queued, and the
0569  * fifth argument is the total number of callbacks queued.
0570  */
0571 TRACE_EVENT_RCU(rcu_kvfree_callback,
0572 
0573     TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset,
0574          long qlen),
0575 
0576     TP_ARGS(rcuname, rhp, offset, qlen),
0577 
0578     TP_STRUCT__entry(
0579         __field(const char *, rcuname)
0580         __field(void *, rhp)
0581         __field(unsigned long, offset)
0582         __field(long, qlen)
0583     ),
0584 
0585     TP_fast_assign(
0586         __entry->rcuname = rcuname;
0587         __entry->rhp = rhp;
0588         __entry->offset = offset;
0589         __entry->qlen = qlen;
0590     ),
0591 
0592     TP_printk("%s rhp=%p func=%ld %ld",
0593           __entry->rcuname, __entry->rhp, __entry->offset,
0594           __entry->qlen)
0595 );
0596 
0597 /*
0598  * Tracepoint for marking the beginning rcu_do_batch, performed to start
0599  * RCU callback invocation.  The first argument is the RCU flavor,
0600  * the second is the number of lazy callbacks queued, the third is
0601  * the total number of callbacks queued, and the fourth argument is
0602  * the current RCU-callback batch limit.
0603  */
0604 TRACE_EVENT_RCU(rcu_batch_start,
0605 
0606     TP_PROTO(const char *rcuname, long qlen, long blimit),
0607 
0608     TP_ARGS(rcuname, qlen, blimit),
0609 
0610     TP_STRUCT__entry(
0611         __field(const char *, rcuname)
0612         __field(long, qlen)
0613         __field(long, blimit)
0614     ),
0615 
0616     TP_fast_assign(
0617         __entry->rcuname = rcuname;
0618         __entry->qlen = qlen;
0619         __entry->blimit = blimit;
0620     ),
0621 
0622     TP_printk("%s CBs=%ld bl=%ld",
0623           __entry->rcuname, __entry->qlen, __entry->blimit)
0624 );
0625 
0626 /*
0627  * Tracepoint for the invocation of a single RCU callback function.
0628  * The first argument is the type of RCU, and the second argument is
0629  * a pointer to the RCU callback itself.
0630  */
0631 TRACE_EVENT_RCU(rcu_invoke_callback,
0632 
0633     TP_PROTO(const char *rcuname, struct rcu_head *rhp),
0634 
0635     TP_ARGS(rcuname, rhp),
0636 
0637     TP_STRUCT__entry(
0638         __field(const char *, rcuname)
0639         __field(void *, rhp)
0640         __field(void *, func)
0641     ),
0642 
0643     TP_fast_assign(
0644         __entry->rcuname = rcuname;
0645         __entry->rhp = rhp;
0646         __entry->func = rhp->func;
0647     ),
0648 
0649     TP_printk("%s rhp=%p func=%ps",
0650           __entry->rcuname, __entry->rhp, __entry->func)
0651 );
0652 
0653 /*
0654  * Tracepoint for the invocation of a single RCU callback of the special
0655  * kvfree() form.  The first argument is the RCU flavor, the second
0656  * argument is a pointer to the RCU callback, and the third argument
0657  * is the offset of the callback within the enclosing RCU-protected
0658  * data structure.
0659  */
0660 TRACE_EVENT_RCU(rcu_invoke_kvfree_callback,
0661 
0662     TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset),
0663 
0664     TP_ARGS(rcuname, rhp, offset),
0665 
0666     TP_STRUCT__entry(
0667         __field(const char *, rcuname)
0668         __field(void *, rhp)
0669         __field(unsigned long, offset)
0670     ),
0671 
0672     TP_fast_assign(
0673         __entry->rcuname = rcuname;
0674         __entry->rhp = rhp;
0675         __entry->offset = offset;
0676     ),
0677 
0678     TP_printk("%s rhp=%p func=%ld",
0679           __entry->rcuname, __entry->rhp, __entry->offset)
0680 );
0681 
0682 /*
0683  * Tracepoint for the invocation of a single RCU callback of the special
0684  * kfree_bulk() form. The first argument is the RCU flavor, the second
0685  * argument is a number of elements in array to free, the third is an
0686  * address of the array holding nr_records entries.
0687  */
0688 TRACE_EVENT_RCU(rcu_invoke_kfree_bulk_callback,
0689 
0690     TP_PROTO(const char *rcuname, unsigned long nr_records, void **p),
0691 
0692     TP_ARGS(rcuname, nr_records, p),
0693 
0694     TP_STRUCT__entry(
0695         __field(const char *, rcuname)
0696         __field(unsigned long, nr_records)
0697         __field(void **, p)
0698     ),
0699 
0700     TP_fast_assign(
0701         __entry->rcuname = rcuname;
0702         __entry->nr_records = nr_records;
0703         __entry->p = p;
0704     ),
0705 
0706     TP_printk("%s bulk=0x%p nr_records=%lu",
0707         __entry->rcuname, __entry->p, __entry->nr_records)
0708 );
0709 
0710 /*
0711  * Tracepoint for exiting rcu_do_batch after RCU callbacks have been
0712  * invoked.  The first argument is the name of the RCU flavor,
0713  * the second argument is number of callbacks actually invoked,
0714  * the third argument (cb) is whether or not any of the callbacks that
0715  * were ready to invoke at the beginning of this batch are still
0716  * queued, the fourth argument (nr) is the return value of need_resched(),
0717  * the fifth argument (iit) is 1 if the current task is the idle task,
0718  * and the sixth argument (risk) is the return value from
0719  * rcu_is_callbacks_kthread().
0720  */
0721 TRACE_EVENT_RCU(rcu_batch_end,
0722 
0723     TP_PROTO(const char *rcuname, int callbacks_invoked,
0724          char cb, char nr, char iit, char risk),
0725 
0726     TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
0727 
0728     TP_STRUCT__entry(
0729         __field(const char *, rcuname)
0730         __field(int, callbacks_invoked)
0731         __field(char, cb)
0732         __field(char, nr)
0733         __field(char, iit)
0734         __field(char, risk)
0735     ),
0736 
0737     TP_fast_assign(
0738         __entry->rcuname = rcuname;
0739         __entry->callbacks_invoked = callbacks_invoked;
0740         __entry->cb = cb;
0741         __entry->nr = nr;
0742         __entry->iit = iit;
0743         __entry->risk = risk;
0744     ),
0745 
0746     TP_printk("%s CBs-invoked=%d idle=%c%c%c%c",
0747           __entry->rcuname, __entry->callbacks_invoked,
0748           __entry->cb ? 'C' : '.',
0749           __entry->nr ? 'S' : '.',
0750           __entry->iit ? 'I' : '.',
0751           __entry->risk ? 'R' : '.')
0752 );
0753 
0754 /*
0755  * Tracepoint for rcutorture readers.  The first argument is the name
0756  * of the RCU flavor from rcutorture's viewpoint and the second argument
0757  * is the callback address.  The third argument is the start time in
0758  * seconds, and the last two arguments are the grace period numbers
0759  * at the beginning and end of the read, respectively.  Note that the
0760  * callback address can be NULL.
0761  */
0762 #define RCUTORTURENAME_LEN 8
0763 TRACE_EVENT_RCU(rcu_torture_read,
0764 
0765     TP_PROTO(const char *rcutorturename, struct rcu_head *rhp,
0766          unsigned long secs, unsigned long c_old, unsigned long c),
0767 
0768     TP_ARGS(rcutorturename, rhp, secs, c_old, c),
0769 
0770     TP_STRUCT__entry(
0771         __field(char, rcutorturename[RCUTORTURENAME_LEN])
0772         __field(struct rcu_head *, rhp)
0773         __field(unsigned long, secs)
0774         __field(unsigned long, c_old)
0775         __field(unsigned long, c)
0776     ),
0777 
0778     TP_fast_assign(
0779         strncpy(__entry->rcutorturename, rcutorturename,
0780             RCUTORTURENAME_LEN);
0781         __entry->rcutorturename[RCUTORTURENAME_LEN - 1] = 0;
0782         __entry->rhp = rhp;
0783         __entry->secs = secs;
0784         __entry->c_old = c_old;
0785         __entry->c = c;
0786     ),
0787 
0788     TP_printk("%s torture read %p %luus c: %lu %lu",
0789           __entry->rcutorturename, __entry->rhp,
0790           __entry->secs, __entry->c_old, __entry->c)
0791 );
0792 
0793 /*
0794  * Tracepoint for rcu_barrier() execution.  The string "s" describes
0795  * the rcu_barrier phase:
0796  *  "Begin": rcu_barrier() started.
0797  *  "CB": An rcu_barrier_callback() invoked a callback, not the last.
0798  *  "EarlyExit": rcu_barrier() piggybacked, thus early exit.
0799  *  "Inc1": rcu_barrier() piggyback check counter incremented.
0800  *  "Inc2": rcu_barrier() piggyback check counter incremented.
0801  *  "IRQ": An rcu_barrier_callback() callback posted on remote CPU.
0802  *  "IRQNQ": An rcu_barrier_callback() callback found no callbacks.
0803  *  "LastCB": An rcu_barrier_callback() invoked the last callback.
0804  *  "NQ": rcu_barrier() found a CPU with no callbacks.
0805  *  "OnlineQ": rcu_barrier() found online CPU with callbacks.
0806  * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument
0807  * is the count of remaining callbacks, and "done" is the piggybacking count.
0808  */
0809 TRACE_EVENT_RCU(rcu_barrier,
0810 
0811     TP_PROTO(const char *rcuname, const char *s, int cpu, int cnt, unsigned long done),
0812 
0813     TP_ARGS(rcuname, s, cpu, cnt, done),
0814 
0815     TP_STRUCT__entry(
0816         __field(const char *, rcuname)
0817         __field(const char *, s)
0818         __field(int, cpu)
0819         __field(int, cnt)
0820         __field(unsigned long, done)
0821     ),
0822 
0823     TP_fast_assign(
0824         __entry->rcuname = rcuname;
0825         __entry->s = s;
0826         __entry->cpu = cpu;
0827         __entry->cnt = cnt;
0828         __entry->done = done;
0829     ),
0830 
0831     TP_printk("%s %s cpu %d remaining %d # %lu",
0832           __entry->rcuname, __entry->s, __entry->cpu, __entry->cnt,
0833           __entry->done)
0834 );
0835 
0836 #endif /* _TRACE_RCU_H */
0837 
0838 /* This part must be outside protection */
0839 #include <trace/define_trace.h>