1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #define TRACE_SYSTEM rcu
5 #if !defined(LTTNG_TRACE_RCU_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define LTTNG_TRACE_RCU_H
8 #include <lttng/lttng-tracepoint-event.h>
11 * Tracepoint for start/end markers used for utilization calculations.
12 * By convention, the string is of the following forms:
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.
18 * An "@" character within "<activity>" is a comment character: Data
19 * reduction scripts will ignore the "@" and the remainder of the line.
21 LTTNG_TRACEPOINT_EVENT(rcu_utilization
,
23 TP_PROTO(const char *s
),
32 #ifdef CONFIG_RCU_TRACE
34 #if defined(CONFIG_TREE_RCU)
37 * Tracepoint for grace-period events: starting and ending a grace
38 * period ("start" and "end", respectively), a CPU noting the start
39 * of a new grace period or the end of an old grace period ("cpustart"
40 * and "cpuend", respectively), a CPU passing through a quiescent
41 * state ("cpuqs"), a CPU coming online or going offline ("cpuonl"
42 * and "cpuofl", respectively), and a CPU being kicked for being too
43 * long in dyntick-idle mode ("kick").
45 LTTNG_TRACEPOINT_EVENT(rcu_grace_period
,
47 TP_PROTO(const char *rcuname
, unsigned long gp_seq
, const char *gpevent
),
49 TP_ARGS(rcuname
, gp_seq
, gpevent
),
52 ctf_string(rcuname
, rcuname
)
53 ctf_integer(unsigned long, gp_seq
, gp_seq
)
54 ctf_string(gpevent
, gpevent
)
59 * Tracepoint for grace-period-initialization events. These are
60 * distinguished by the type of RCU, the new grace-period number, the
61 * rcu_node structure level, the starting and ending CPU covered by the
62 * rcu_node structure, and the mask of CPUs that will be waited for.
63 * All but the type of RCU are extracted from the rcu_node structure.
65 LTTNG_TRACEPOINT_EVENT(rcu_grace_period_init
,
67 TP_PROTO(const char *rcuname
, unsigned long gp_seq
, u8 level
,
68 int grplo
, int grphi
, unsigned long qsmask
),
70 TP_ARGS(rcuname
, gp_seq
, level
, grplo
, grphi
, qsmask
),
73 ctf_string(rcuname
, rcuname
)
74 ctf_integer(unsigned long, gp_seq
, gp_seq
)
75 ctf_integer(u8
, level
, level
)
76 ctf_integer(int, grplo
, grplo
)
77 ctf_integer(int, grphi
, grphi
)
78 ctf_integer(unsigned long, qsmask
, qsmask
)
83 * Tracepoint for tasks blocking within preemptible-RCU read-side
84 * critical sections. Track the type of RCU (which one day might
85 * include SRCU), the grace-period number that the task is blocking
86 * (the current or the next), and the task's PID.
88 LTTNG_TRACEPOINT_EVENT(rcu_preempt_task
,
90 TP_PROTO(const char *rcuname
, int pid
, unsigned long gp_seq
),
92 TP_ARGS(rcuname
, pid
, gp_seq
),
95 ctf_string(rcuname
, rcuname
)
96 ctf_integer(unsigned long, gp_seq
, gp_seq
)
97 ctf_integer(int, pid
, pid
)
102 * Tracepoint for tasks that blocked within a given preemptible-RCU
103 * read-side critical section exiting that critical section. Track the
104 * type of RCU (which one day might include SRCU) and the task's PID.
106 LTTNG_TRACEPOINT_EVENT(rcu_unlock_preempted_task
,
108 TP_PROTO(const char *rcuname
, unsigned long gp_seq
, int pid
),
110 TP_ARGS(rcuname
, gp_seq
, pid
),
113 ctf_string(rcuname
, rcuname
)
114 ctf_integer(unsigned long, gp_seq
, gp_seq
)
115 ctf_integer(int, pid
, pid
)
120 * Tracepoint for quiescent-state-reporting events. These are
121 * distinguished by the type of RCU, the grace-period number, the
122 * mask of quiescent lower-level entities, the rcu_node structure level,
123 * the starting and ending CPU covered by the rcu_node structure, and
124 * whether there are any blocked tasks blocking the current grace period.
125 * All but the type of RCU are extracted from the rcu_node structure.
127 LTTNG_TRACEPOINT_EVENT(rcu_quiescent_state_report
,
129 TP_PROTO(const char *rcuname
, unsigned long gp_seq
,
130 unsigned long mask
, unsigned long qsmask
,
131 u8 level
, int grplo
, int grphi
, int gp_tasks
),
133 TP_ARGS(rcuname
, gp_seq
, mask
, qsmask
, level
, grplo
, grphi
, gp_tasks
),
136 ctf_string(rcuname
, rcuname
)
137 ctf_integer(unsigned long, gp_seq
, gp_seq
)
138 ctf_integer(unsigned long, mask
, mask
)
139 ctf_integer(unsigned long, qsmask
, qsmask
)
140 ctf_integer(u8
, level
, level
)
141 ctf_integer(int, grplo
, grplo
)
142 ctf_integer(int, grphi
, grphi
)
143 ctf_integer(u8
, gp_tasks
, gp_tasks
)
148 * Tracepoint for quiescent states detected by force_quiescent_state().
149 * These trace events include the type of RCU, the grace-period number
150 * that was blocked by the CPU, the CPU itself, and the type of quiescent
151 * state, which can be "dti" for dyntick-idle mode, "ofl" for CPU offline,
152 * or "kick" when kicking a CPU that has been in dyntick-idle mode for
155 LTTNG_TRACEPOINT_EVENT(rcu_fqs
,
157 TP_PROTO(const char *rcuname
, unsigned long gp_seq
, int cpu
, const char *qsevent
),
159 TP_ARGS(rcuname
, gp_seq
, cpu
, qsevent
),
162 ctf_integer(unsigned long, gp_seq
, gp_seq
)
163 ctf_integer(int, cpu
, cpu
)
164 ctf_string(rcuname
, rcuname
)
165 ctf_string(qsevent
, qsevent
)
172 * Tracepoint for dyntick-idle entry/exit events. These take a string
173 * as argument: "Start" for entering dyntick-idle mode, "End" for
174 * leaving it, "--=" for events moving towards idle, and "++=" for events
175 * moving away from idle. "Error on entry: not idle task" and "Error on
176 * exit: not idle task" indicate that a non-idle task is erroneously
177 * toying with the idle loop.
179 * These events also take a pair of numbers, which indicate the nesting
180 * depth before and after the event of interest. Note that task-related
181 * events use the upper bits of each number, while interrupt-related
182 * events use the lower bits.
184 LTTNG_TRACEPOINT_EVENT(rcu_dyntick
,
186 TP_PROTO(const char *polarity
, long oldnesting
, long newnesting
, int dynticks
),
188 TP_ARGS(polarity
, oldnesting
, newnesting
, dynticks
),
191 ctf_string(polarity
, polarity
)
192 ctf_integer(long, oldnesting
, oldnesting
)
193 ctf_integer(long, newnesting
, newnesting
)
194 ctf_integer(int, dynticks
, dynticks
)
199 * Tracepoint for RCU preparation for idle, the goal being to get RCU
200 * processing done so that the current CPU can shut off its scheduling
201 * clock and enter dyntick-idle mode. One way to accomplish this is
202 * to drain all RCU callbacks from this CPU, and the other is to have
203 * done everything RCU requires for the current grace period. In this
204 * latter case, the CPU will be awakened at the end of the current grace
205 * period in order to process the remainder of its callbacks.
207 * These tracepoints take a string as argument:
209 * "No callbacks": Nothing to do, no callbacks on this CPU.
210 * "In holdoff": Nothing to do, holding off after unsuccessful attempt.
211 * "Begin holdoff": Attempt failed, don't retry until next jiffy.
212 * "Dyntick with callbacks": Entering dyntick-idle despite callbacks.
213 * "Dyntick with lazy callbacks": Entering dyntick-idle w/lazy callbacks.
214 * "More callbacks": Still more callbacks, try again to clear them out.
215 * "Callbacks drained": All callbacks processed, off to dyntick idle!
216 * "Timer": Timer fired to cause CPU to continue processing callbacks.
217 * "Demigrate": Timer fired on wrong CPU, woke up correct CPU.
218 * "Cleanup after idle": Idle exited, timer canceled.
220 LTTNG_TRACEPOINT_EVENT(rcu_prep_idle
,
222 TP_PROTO(const char *reason
),
227 ctf_string(reason
, reason
)
232 * Tracepoint for the registration of a single RCU callback function.
233 * The first argument is the type of RCU, the second argument is
234 * a pointer to the RCU callback itself, the third element is the
235 * number of lazy callbacks queued, and the fourth element is the
236 * total number of callbacks queued.
238 LTTNG_TRACEPOINT_EVENT(rcu_callback
,
240 TP_PROTO(const char *rcuname
, struct rcu_head
*rhp
, long qlen
),
242 TP_ARGS(rcuname
, rhp
, qlen
),
245 ctf_string(rcuname
, rcuname
)
246 ctf_integer_hex(void *, rhp
, rhp
)
247 ctf_integer_hex(void *, func
, rhp
->func
)
248 ctf_integer(long, qlen
, qlen
)
253 * Tracepoint for the registration of a single RCU callback of the special
254 * kfree() form. The first argument is the RCU type, the second argument
255 * is a pointer to the RCU callback, the third argument is the offset
256 * of the callback within the enclosing RCU-protected data structure,
257 * the fourth argument is the number of lazy callbacks queued, and the
258 * fifth argument is the total number of callbacks queued.
260 LTTNG_TRACEPOINT_EVENT(rcu_kfree_callback
,
262 TP_PROTO(const char *rcuname
, struct rcu_head
*rhp
, unsigned long offset
,
265 TP_ARGS(rcuname
, rhp
, offset
, qlen
),
268 ctf_string(rcuname
, rcuname
)
269 ctf_integer_hex(void *, rhp
, rhp
)
270 ctf_integer_hex(unsigned long, offset
, offset
)
271 ctf_integer(long, qlen
, qlen
)
276 * Tracepoint for marking the beginning rcu_do_batch, performed to start
277 * RCU callback invocation. The first argument is the RCU flavor,
278 * the second is the number of lazy callbacks queued, the third is
279 * the total number of callbacks queued, and the fourth argument is
280 * the current RCU-callback batch limit.
282 LTTNG_TRACEPOINT_EVENT(rcu_batch_start
,
284 TP_PROTO(const char *rcuname
, long qlen
, long blimit
),
286 TP_ARGS(rcuname
, qlen
, blimit
),
289 ctf_string(rcuname
, rcuname
)
290 ctf_integer(long, qlen
, qlen
)
291 ctf_integer(long, blimit
, blimit
)
296 * Tracepoint for the invocation of a single RCU callback function.
297 * The first argument is the type of RCU, and the second argument is
298 * a pointer to the RCU callback itself.
300 LTTNG_TRACEPOINT_EVENT(rcu_invoke_callback
,
302 TP_PROTO(const char *rcuname
, struct rcu_head
*rhp
),
304 TP_ARGS(rcuname
, rhp
),
307 ctf_string(rcuname
, rcuname
)
308 ctf_integer_hex(void *, rhp
, rhp
)
309 ctf_integer_hex(void *, func
, rhp
->func
)
314 * Tracepoint for the invocation of a single RCU callback of the special
315 * kfree() form. The first argument is the RCU flavor, the second
316 * argument is a pointer to the RCU callback, and the third argument
317 * is the offset of the callback within the enclosing RCU-protected
320 LTTNG_TRACEPOINT_EVENT(rcu_invoke_kfree_callback
,
322 TP_PROTO(const char *rcuname
, struct rcu_head
*rhp
, unsigned long offset
),
324 TP_ARGS(rcuname
, rhp
, offset
),
327 ctf_string(rcuname
, rcuname
)
328 ctf_integer_hex(void *, rhp
, rhp
)
329 ctf_integer(unsigned long, offset
, offset
)
334 * Tracepoint for exiting rcu_do_batch after RCU callbacks have been
335 * invoked. The first argument is the name of the RCU flavor,
336 * the second argument is number of callbacks actually invoked,
337 * the third argument (cb) is whether or not any of the callbacks that
338 * were ready to invoke at the beginning of this batch are still
339 * queued, the fourth argument (nr) is the return value of need_resched(),
340 * the fifth argument (iit) is 1 if the current task is the idle task,
341 * and the sixth argument (risk) is the return value from
342 * rcu_is_callbacks_kthread().
344 LTTNG_TRACEPOINT_EVENT(rcu_batch_end
,
346 TP_PROTO(const char *rcuname
, int callbacks_invoked
,
347 char cb
, char nr
, char iit
, char risk
),
349 TP_ARGS(rcuname
, callbacks_invoked
, cb
, nr
, iit
, risk
),
352 ctf_string(rcuname
, rcuname
)
353 ctf_integer(int, callbacks_invoked
, callbacks_invoked
)
354 ctf_integer(char, cb
, cb
)
355 ctf_integer(char, nr
, nr
)
356 ctf_integer(char, iit
, iit
)
357 ctf_integer(char, risk
, risk
)
362 * Tracepoint for rcutorture readers. The first argument is the name
363 * of the RCU flavor from rcutorture's viewpoint and the second argument
364 * is the callback address.
366 LTTNG_TRACEPOINT_EVENT(rcu_torture_read
,
368 TP_PROTO(const char *rcutorturename
, struct rcu_head
*rhp
,
369 unsigned long secs
, unsigned long c_old
, unsigned long c
),
371 TP_ARGS(rcutorturename
, rhp
, secs
, c_old
, c
),
374 ctf_string(rcutorturename
, rcutorturename
)
375 ctf_integer_hex(struct rcu_head
*, rhp
, rhp
)
376 ctf_integer(unsigned long, secs
, secs
)
377 ctf_integer(unsigned long, c_old
, c_old
)
378 ctf_integer(unsigned long, c
, c
)
383 * Tracepoint for _rcu_barrier() execution. The string "s" describes
384 * the _rcu_barrier phase:
385 * "Begin": rcu_barrier_callback() started.
386 * "Check": rcu_barrier_callback() checking for piggybacking.
387 * "EarlyExit": rcu_barrier_callback() piggybacked, thus early exit.
388 * "Inc1": rcu_barrier_callback() piggyback check counter incremented.
389 * "Offline": rcu_barrier_callback() found offline CPU
390 * "OnlineQ": rcu_barrier_callback() found online CPU with callbacks.
391 * "OnlineNQ": rcu_barrier_callback() found online CPU, no callbacks.
392 * "IRQ": An rcu_barrier_callback() callback posted on remote CPU.
393 * "CB": An rcu_barrier_callback() invoked a callback, not the last.
394 * "LastCB": An rcu_barrier_callback() invoked the last callback.
395 * "Inc2": rcu_barrier_callback() piggyback check counter incremented.
396 * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument
397 * is the count of remaining callbacks, and "done" is the piggybacking count.
399 LTTNG_TRACEPOINT_EVENT(rcu_barrier
,
401 TP_PROTO(const char *rcuname
, const char *s
, int cpu
, int cnt
, unsigned long done
),
403 TP_ARGS(rcuname
, s
, cpu
, cnt
, done
),
406 ctf_string(rcuname
, rcuname
)
408 ctf_integer(int, cpu
, cpu
)
409 ctf_integer(int, cnt
, cnt
)
410 ctf_integer(unsigned long, done
, done
)
414 #else /* #ifdef CONFIG_RCU_TRACE */
416 #define trace_rcu_grace_period(rcuname, gp_seq, gpevent) do { } while (0)
417 #define trace_rcu_grace_period_init(rcuname, gp_seq, level, grplo, grphi, \
418 qsmask) do { } while (0)
419 #define trace_rcu_preempt_task(rcuname, pid, gp_seq) do { } while (0)
420 #define trace_rcu_unlock_preempted_task(rcuname, gp_seq, pid) do { } while (0)
421 #define trace_rcu_quiescent_state_report(rcuname, gp_seq, mask, qsmask, level, \
422 grplo, grphi, gp_tasks) do { } \
424 #define trace_rcu_fqs(rcuname, gp_seq, cpu, qsevent) do { } while (0)
426 #define trace_rcu_dyntick(polarity, oldnesting, newnesting, dyntick) do { } while (0)
427 #define trace_rcu_prep_idle(reason) do { } while (0)
428 #define trace_rcu_callback(rcuname, rhp, qlen_lazy, qlen) do { } while (0)
429 #define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen_lazy, qlen) \
431 #define trace_rcu_batch_start(rcuname, qlen_lazy, qlen, blimit) \
433 #define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0)
434 #define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0)
435 #define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \
437 #define trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
439 #define trace_rcu_barrier(name, s, cpu, cnt, done) do { } while (0)
440 #endif /* #else #ifdef CONFIG_RCU_TRACE */
442 #endif /* LTTNG_TRACE_RCU_H */
444 /* This part must be outside protection */
445 #include <lttng/define_trace.h>