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