| 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM rcu |
| 4 | |
| 5 | #if !defined(LTTNG_TRACE_RCU_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define LTTNG_TRACE_RCU_H |
| 7 | |
| 8 | #include <lttng/tracepoint-event.h> |
| 9 | #include <lttng/kernel-version.h> |
| 10 | |
| 11 | /* |
| 12 | * Tracepoint for start/end markers used for utilization calculations. |
| 13 | * By convention, the string is of the following forms: |
| 14 | * |
| 15 | * "Start <activity>" -- Mark the start of the specified activity, |
| 16 | * such as "context switch". Nesting is permitted. |
| 17 | * "End <activity>" -- Mark the end of the specified activity. |
| 18 | * |
| 19 | * An "@" character within "<activity>" is a comment character: Data |
| 20 | * reduction scripts will ignore the "@" and the remainder of the line. |
| 21 | */ |
| 22 | LTTNG_TRACEPOINT_EVENT(rcu_utilization, |
| 23 | |
| 24 | TP_PROTO(const char *s), |
| 25 | |
| 26 | TP_ARGS(s), |
| 27 | |
| 28 | TP_FIELDS( |
| 29 | ctf_string(s, s) |
| 30 | ) |
| 31 | ) |
| 32 | |
| 33 | #ifdef CONFIG_RCU_TRACE |
| 34 | |
| 35 | #if defined(CONFIG_TREE_RCU) \ |
| 36 | || defined(CONFIG_PREEMPT_RCU) \ |
| 37 | || defined(CONFIG_TREE_PREEMPT_RCU) |
| 38 | |
| 39 | /* |
| 40 | * Tracepoint for grace-period events: starting and ending a grace |
| 41 | * period ("start" and "end", respectively), a CPU noting the start |
| 42 | * of a new grace period or the end of an old grace period ("cpustart" |
| 43 | * and "cpuend", respectively), a CPU passing through a quiescent |
| 44 | * state ("cpuqs"), a CPU coming online or going offline ("cpuonl" |
| 45 | * and "cpuofl", respectively), and a CPU being kicked for being too |
| 46 | * long in dyntick-idle mode ("kick"). |
| 47 | */ |
| 48 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,19,0) || \ |
| 49 | LTTNG_RHEL_KERNEL_RANGE(4,18,0,80,0,0, 4,19,0,0,0,0)) |
| 50 | LTTNG_TRACEPOINT_EVENT(rcu_grace_period, |
| 51 | |
| 52 | TP_PROTO(const char *rcuname, unsigned long gp_seq, const char *gpevent), |
| 53 | |
| 54 | TP_ARGS(rcuname, gp_seq, gpevent), |
| 55 | |
| 56 | TP_FIELDS( |
| 57 | ctf_string(rcuname, rcuname) |
| 58 | ctf_integer(unsigned long, gp_seq, gp_seq) |
| 59 | ctf_string(gpevent, gpevent) |
| 60 | ) |
| 61 | ) |
| 62 | #else |
| 63 | LTTNG_TRACEPOINT_EVENT(rcu_grace_period, |
| 64 | |
| 65 | TP_PROTO(const char *rcuname, unsigned long gpnum, const char *gpevent), |
| 66 | |
| 67 | TP_ARGS(rcuname, gpnum, gpevent), |
| 68 | |
| 69 | TP_FIELDS( |
| 70 | ctf_string(rcuname, rcuname) |
| 71 | ctf_integer(unsigned long, gpnum, gpnum) |
| 72 | ctf_string(gpevent, gpevent) |
| 73 | ) |
| 74 | ) |
| 75 | #endif |
| 76 | |
| 77 | /* |
| 78 | * Tracepoint for grace-period-initialization events. These are |
| 79 | * distinguished by the type of RCU, the new grace-period number, the |
| 80 | * rcu_node structure level, the starting and ending CPU covered by the |
| 81 | * rcu_node structure, and the mask of CPUs that will be waited for. |
| 82 | * All but the type of RCU are extracted from the rcu_node structure. |
| 83 | */ |
| 84 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,19,0) || \ |
| 85 | LTTNG_RHEL_KERNEL_RANGE(4,18,0,80,0,0, 4,19,0,0,0,0)) |
| 86 | LTTNG_TRACEPOINT_EVENT(rcu_grace_period_init, |
| 87 | |
| 88 | TP_PROTO(const char *rcuname, unsigned long gp_seq, u8 level, |
| 89 | int grplo, int grphi, unsigned long qsmask), |
| 90 | |
| 91 | TP_ARGS(rcuname, gp_seq, level, grplo, grphi, qsmask), |
| 92 | |
| 93 | TP_FIELDS( |
| 94 | ctf_string(rcuname, rcuname) |
| 95 | ctf_integer(unsigned long, gp_seq, gp_seq) |
| 96 | ctf_integer(u8, level, level) |
| 97 | ctf_integer(int, grplo, grplo) |
| 98 | ctf_integer(int, grphi, grphi) |
| 99 | ctf_integer(unsigned long, qsmask, qsmask) |
| 100 | ) |
| 101 | ) |
| 102 | #else |
| 103 | LTTNG_TRACEPOINT_EVENT(rcu_grace_period_init, |
| 104 | |
| 105 | TP_PROTO(const char *rcuname, unsigned long gpnum, u8 level, |
| 106 | int grplo, int grphi, unsigned long qsmask), |
| 107 | |
| 108 | TP_ARGS(rcuname, gpnum, level, grplo, grphi, qsmask), |
| 109 | |
| 110 | TP_FIELDS( |
| 111 | ctf_string(rcuname, rcuname) |
| 112 | ctf_integer(unsigned long, gpnum, gpnum) |
| 113 | ctf_integer(u8, level, level) |
| 114 | ctf_integer(int, grplo, grplo) |
| 115 | ctf_integer(int, grphi, grphi) |
| 116 | ctf_integer(unsigned long, qsmask, qsmask) |
| 117 | ) |
| 118 | ) |
| 119 | #endif |
| 120 | |
| 121 | /* |
| 122 | * Tracepoint for tasks blocking within preemptible-RCU read-side |
| 123 | * critical sections. Track the type of RCU (which one day might |
| 124 | * include SRCU), the grace-period number that the task is blocking |
| 125 | * (the current or the next), and the task's PID. |
| 126 | */ |
| 127 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,19,0) || \ |
| 128 | LTTNG_RHEL_KERNEL_RANGE(4,18,0,80,0,0, 4,19,0,0,0,0)) |
| 129 | LTTNG_TRACEPOINT_EVENT(rcu_preempt_task, |
| 130 | |
| 131 | TP_PROTO(const char *rcuname, int pid, unsigned long gp_seq), |
| 132 | |
| 133 | TP_ARGS(rcuname, pid, gp_seq), |
| 134 | |
| 135 | TP_FIELDS( |
| 136 | ctf_string(rcuname, rcuname) |
| 137 | ctf_integer(unsigned long, gp_seq, gp_seq) |
| 138 | ctf_integer(int, pid, pid) |
| 139 | ) |
| 140 | ) |
| 141 | #else |
| 142 | LTTNG_TRACEPOINT_EVENT(rcu_preempt_task, |
| 143 | |
| 144 | TP_PROTO(const char *rcuname, int pid, unsigned long gpnum), |
| 145 | |
| 146 | TP_ARGS(rcuname, pid, gpnum), |
| 147 | |
| 148 | TP_FIELDS( |
| 149 | ctf_string(rcuname, rcuname) |
| 150 | ctf_integer(unsigned long, gpnum, gpnum) |
| 151 | ctf_integer(int, pid, pid) |
| 152 | ) |
| 153 | ) |
| 154 | #endif |
| 155 | |
| 156 | /* |
| 157 | * Tracepoint for tasks that blocked within a given preemptible-RCU |
| 158 | * read-side critical section exiting that critical section. Track the |
| 159 | * type of RCU (which one day might include SRCU) and the task's PID. |
| 160 | */ |
| 161 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,19,0) || \ |
| 162 | LTTNG_RHEL_KERNEL_RANGE(4,18,0,80,0,0, 4,19,0,0,0,0)) |
| 163 | LTTNG_TRACEPOINT_EVENT(rcu_unlock_preempted_task, |
| 164 | |
| 165 | TP_PROTO(const char *rcuname, unsigned long gp_seq, int pid), |
| 166 | |
| 167 | TP_ARGS(rcuname, gp_seq, pid), |
| 168 | |
| 169 | TP_FIELDS( |
| 170 | ctf_string(rcuname, rcuname) |
| 171 | ctf_integer(unsigned long, gp_seq, gp_seq) |
| 172 | ctf_integer(int, pid, pid) |
| 173 | ) |
| 174 | ) |
| 175 | #else |
| 176 | LTTNG_TRACEPOINT_EVENT(rcu_unlock_preempted_task, |
| 177 | |
| 178 | TP_PROTO(const char *rcuname, unsigned long gpnum, int pid), |
| 179 | |
| 180 | TP_ARGS(rcuname, gpnum, pid), |
| 181 | |
| 182 | TP_FIELDS( |
| 183 | ctf_string(rcuname, rcuname) |
| 184 | ctf_integer(unsigned long, gpnum, gpnum) |
| 185 | ctf_integer(int, pid, pid) |
| 186 | ) |
| 187 | ) |
| 188 | #endif |
| 189 | |
| 190 | /* |
| 191 | * Tracepoint for quiescent-state-reporting events. These are |
| 192 | * distinguished by the type of RCU, the grace-period number, the |
| 193 | * mask of quiescent lower-level entities, the rcu_node structure level, |
| 194 | * the starting and ending CPU covered by the rcu_node structure, and |
| 195 | * whether there are any blocked tasks blocking the current grace period. |
| 196 | * All but the type of RCU are extracted from the rcu_node structure. |
| 197 | */ |
| 198 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,19,0) || \ |
| 199 | LTTNG_RHEL_KERNEL_RANGE(4,18,0,80,0,0, 4,19,0,0,0,0)) |
| 200 | LTTNG_TRACEPOINT_EVENT(rcu_quiescent_state_report, |
| 201 | |
| 202 | TP_PROTO(const char *rcuname, unsigned long gp_seq, |
| 203 | unsigned long mask, unsigned long qsmask, |
| 204 | u8 level, int grplo, int grphi, int gp_tasks), |
| 205 | |
| 206 | TP_ARGS(rcuname, gp_seq, mask, qsmask, level, grplo, grphi, gp_tasks), |
| 207 | |
| 208 | TP_FIELDS( |
| 209 | ctf_string(rcuname, rcuname) |
| 210 | ctf_integer(unsigned long, gp_seq, gp_seq) |
| 211 | ctf_integer(unsigned long, mask, mask) |
| 212 | ctf_integer(unsigned long, qsmask, qsmask) |
| 213 | ctf_integer(u8, level, level) |
| 214 | ctf_integer(int, grplo, grplo) |
| 215 | ctf_integer(int, grphi, grphi) |
| 216 | ctf_integer(u8, gp_tasks, gp_tasks) |
| 217 | ) |
| 218 | ) |
| 219 | #else |
| 220 | LTTNG_TRACEPOINT_EVENT(rcu_quiescent_state_report, |
| 221 | |
| 222 | TP_PROTO(const char *rcuname, unsigned long gpnum, |
| 223 | unsigned long mask, unsigned long qsmask, |
| 224 | u8 level, int grplo, int grphi, int gp_tasks), |
| 225 | |
| 226 | TP_ARGS(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks), |
| 227 | |
| 228 | TP_FIELDS( |
| 229 | ctf_string(rcuname, rcuname) |
| 230 | ctf_integer(unsigned long, gpnum, gpnum) |
| 231 | ctf_integer(unsigned long, mask, mask) |
| 232 | ctf_integer(unsigned long, qsmask, qsmask) |
| 233 | ctf_integer(u8, level, level) |
| 234 | ctf_integer(int, grplo, grplo) |
| 235 | ctf_integer(int, grphi, grphi) |
| 236 | ctf_integer(u8, gp_tasks, gp_tasks) |
| 237 | ) |
| 238 | ) |
| 239 | #endif |
| 240 | |
| 241 | /* |
| 242 | * Tracepoint for quiescent states detected by force_quiescent_state(). |
| 243 | * These trace events include the type of RCU, the grace-period number |
| 244 | * that was blocked by the CPU, the CPU itself, and the type of quiescent |
| 245 | * state, which can be "dti" for dyntick-idle mode, "ofl" for CPU offline, |
| 246 | * or "kick" when kicking a CPU that has been in dyntick-idle mode for |
| 247 | * too long. |
| 248 | */ |
| 249 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,19,0) || \ |
| 250 | LTTNG_RHEL_KERNEL_RANGE(4,18,0,80,0,0, 4,19,0,0,0,0)) |
| 251 | LTTNG_TRACEPOINT_EVENT(rcu_fqs, |
| 252 | |
| 253 | TP_PROTO(const char *rcuname, unsigned long gp_seq, int cpu, const char *qsevent), |
| 254 | |
| 255 | TP_ARGS(rcuname, gp_seq, cpu, qsevent), |
| 256 | |
| 257 | TP_FIELDS( |
| 258 | ctf_integer(unsigned long, gp_seq, gp_seq) |
| 259 | ctf_integer(int, cpu, cpu) |
| 260 | ctf_string(rcuname, rcuname) |
| 261 | ctf_string(qsevent, qsevent) |
| 262 | ) |
| 263 | ) |
| 264 | #else |
| 265 | LTTNG_TRACEPOINT_EVENT(rcu_fqs, |
| 266 | |
| 267 | TP_PROTO(const char *rcuname, unsigned long gpnum, int cpu, const char *qsevent), |
| 268 | |
| 269 | TP_ARGS(rcuname, gpnum, cpu, qsevent), |
| 270 | |
| 271 | TP_FIELDS( |
| 272 | ctf_integer(unsigned long, gpnum, gpnum) |
| 273 | ctf_integer(int, cpu, cpu) |
| 274 | ctf_string(rcuname, rcuname) |
| 275 | ctf_string(qsevent, qsevent) |
| 276 | ) |
| 277 | ) |
| 278 | #endif |
| 279 | |
| 280 | #endif /* |
| 281 | * #if defined(CONFIG_TREE_RCU) |
| 282 | * || (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,19,0) |
| 283 | * && defined(CONFIG_PREEMPT_RCU)) |
| 284 | * || defined(CONFIG_TREE_PREEMPT_RCU) |
| 285 | */ |
| 286 | |
| 287 | /* |
| 288 | * Tracepoint for dyntick-idle entry/exit events. These take a string |
| 289 | * as argument: "Start" for entering dyntick-idle mode, "End" for |
| 290 | * leaving it, "--=" for events moving towards idle, and "++=" for events |
| 291 | * moving away from idle. "Error on entry: not idle task" and "Error on |
| 292 | * exit: not idle task" indicate that a non-idle task is erroneously |
| 293 | * toying with the idle loop. |
| 294 | * |
| 295 | * These events also take a pair of numbers, which indicate the nesting |
| 296 | * depth before and after the event of interest. Note that task-related |
| 297 | * events use the upper bits of each number, while interrupt-related |
| 298 | * events use the lower bits. |
| 299 | */ |
| 300 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0)) \ |
| 301 | || LTTNG_KERNEL_RANGE(5,5,6, 5,6,0) \ |
| 302 | || LTTNG_KERNEL_RANGE(5,4,22, 5,5,0) \ |
| 303 | || LTTNG_UBUNTU_KERNEL_RANGE(5,0,21,46, 5,1,0,0) |
| 304 | LTTNG_TRACEPOINT_EVENT(rcu_dyntick, |
| 305 | |
| 306 | TP_PROTO(const char *polarity, long oldnesting, long newnesting, int dynticks), |
| 307 | |
| 308 | TP_ARGS(polarity, oldnesting, newnesting, dynticks), |
| 309 | |
| 310 | TP_FIELDS( |
| 311 | ctf_string(polarity, polarity) |
| 312 | ctf_integer(long, oldnesting, oldnesting) |
| 313 | ctf_integer(long, newnesting, newnesting) |
| 314 | ctf_integer(int, dynticks, dynticks) |
| 315 | ) |
| 316 | ) |
| 317 | |
| 318 | #elif (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,16,0)) |
| 319 | LTTNG_TRACEPOINT_EVENT(rcu_dyntick, |
| 320 | |
| 321 | TP_PROTO(const char *polarity, long oldnesting, long newnesting, atomic_t dynticks), |
| 322 | |
| 323 | TP_ARGS(polarity, oldnesting, newnesting, dynticks), |
| 324 | |
| 325 | TP_FIELDS( |
| 326 | ctf_string(polarity, polarity) |
| 327 | ctf_integer(long, oldnesting, oldnesting) |
| 328 | ctf_integer(long, newnesting, newnesting) |
| 329 | ctf_integer(int, dynticks, atomic_read(&dynticks)) |
| 330 | ) |
| 331 | ) |
| 332 | |
| 333 | #else |
| 334 | LTTNG_TRACEPOINT_EVENT(rcu_dyntick, |
| 335 | |
| 336 | TP_PROTO(const char *polarity, long long oldnesting, long long newnesting), |
| 337 | |
| 338 | TP_ARGS(polarity, oldnesting, newnesting), |
| 339 | |
| 340 | TP_FIELDS( |
| 341 | ctf_string(polarity, polarity) |
| 342 | ctf_integer(long long, oldnesting, oldnesting) |
| 343 | ctf_integer(long long, newnesting, newnesting) |
| 344 | ) |
| 345 | ) |
| 346 | #endif |
| 347 | |
| 348 | |
| 349 | /* |
| 350 | * Tracepoint for RCU preparation for idle, the goal being to get RCU |
| 351 | * processing done so that the current CPU can shut off its scheduling |
| 352 | * clock and enter dyntick-idle mode. One way to accomplish this is |
| 353 | * to drain all RCU callbacks from this CPU, and the other is to have |
| 354 | * done everything RCU requires for the current grace period. In this |
| 355 | * latter case, the CPU will be awakened at the end of the current grace |
| 356 | * period in order to process the remainder of its callbacks. |
| 357 | * |
| 358 | * These tracepoints take a string as argument: |
| 359 | * |
| 360 | * "No callbacks": Nothing to do, no callbacks on this CPU. |
| 361 | * "In holdoff": Nothing to do, holding off after unsuccessful attempt. |
| 362 | * "Begin holdoff": Attempt failed, don't retry until next jiffy. |
| 363 | * "Dyntick with callbacks": Entering dyntick-idle despite callbacks. |
| 364 | * "Dyntick with lazy callbacks": Entering dyntick-idle w/lazy callbacks. |
| 365 | * "More callbacks": Still more callbacks, try again to clear them out. |
| 366 | * "Callbacks drained": All callbacks processed, off to dyntick idle! |
| 367 | * "Timer": Timer fired to cause CPU to continue processing callbacks. |
| 368 | * "Demigrate": Timer fired on wrong CPU, woke up correct CPU. |
| 369 | * "Cleanup after idle": Idle exited, timer canceled. |
| 370 | */ |
| 371 | LTTNG_TRACEPOINT_EVENT(rcu_prep_idle, |
| 372 | |
| 373 | TP_PROTO(const char *reason), |
| 374 | |
| 375 | TP_ARGS(reason), |
| 376 | |
| 377 | TP_FIELDS( |
| 378 | ctf_string(reason, reason) |
| 379 | ) |
| 380 | ) |
| 381 | |
| 382 | /* |
| 383 | * Tracepoint for the registration of a single RCU callback function. |
| 384 | * The first argument is the type of RCU, the second argument is |
| 385 | * a pointer to the RCU callback itself, the third element is the |
| 386 | * number of lazy callbacks queued, and the fourth element is the |
| 387 | * total number of callbacks queued. |
| 388 | */ |
| 389 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0)) |
| 390 | LTTNG_TRACEPOINT_EVENT(rcu_callback, |
| 391 | |
| 392 | TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen), |
| 393 | |
| 394 | TP_ARGS(rcuname, rhp, qlen), |
| 395 | |
| 396 | TP_FIELDS( |
| 397 | ctf_string(rcuname, rcuname) |
| 398 | ctf_integer_hex(void *, rhp, rhp) |
| 399 | ctf_integer_hex(void *, func, rhp->func) |
| 400 | ctf_integer(long, qlen, qlen) |
| 401 | ) |
| 402 | ) |
| 403 | #else |
| 404 | LTTNG_TRACEPOINT_EVENT(rcu_callback, |
| 405 | |
| 406 | TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen_lazy, |
| 407 | long qlen), |
| 408 | |
| 409 | TP_ARGS(rcuname, rhp, qlen_lazy, qlen), |
| 410 | |
| 411 | TP_FIELDS( |
| 412 | ctf_string(rcuname, rcuname) |
| 413 | ctf_integer_hex(void *, rhp, rhp) |
| 414 | ctf_integer_hex(void *, func, rhp->func) |
| 415 | ctf_integer(long, qlen_lazy, qlen_lazy) |
| 416 | ctf_integer(long, qlen, qlen) |
| 417 | ) |
| 418 | ) |
| 419 | #endif |
| 420 | |
| 421 | |
| 422 | /* |
| 423 | * Tracepoint for the registration of a single RCU callback of the special |
| 424 | * kfree() form. The first argument is the RCU type, the second argument |
| 425 | * is a pointer to the RCU callback, the third argument is the offset |
| 426 | * of the callback within the enclosing RCU-protected data structure, |
| 427 | * the fourth argument is the number of lazy callbacks queued, and the |
| 428 | * fifth argument is the total number of callbacks queued. |
| 429 | */ |
| 430 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0)) |
| 431 | LTTNG_TRACEPOINT_EVENT(rcu_kfree_callback, |
| 432 | |
| 433 | TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset, |
| 434 | long qlen), |
| 435 | |
| 436 | TP_ARGS(rcuname, rhp, offset, qlen), |
| 437 | |
| 438 | TP_FIELDS( |
| 439 | ctf_string(rcuname, rcuname) |
| 440 | ctf_integer_hex(void *, rhp, rhp) |
| 441 | ctf_integer_hex(unsigned long, offset, offset) |
| 442 | ctf_integer(long, qlen, qlen) |
| 443 | ) |
| 444 | ) |
| 445 | #else |
| 446 | LTTNG_TRACEPOINT_EVENT(rcu_kfree_callback, |
| 447 | |
| 448 | TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset, |
| 449 | long qlen_lazy, long qlen), |
| 450 | |
| 451 | TP_ARGS(rcuname, rhp, offset, qlen_lazy, qlen), |
| 452 | |
| 453 | TP_FIELDS( |
| 454 | ctf_string(rcuname, rcuname) |
| 455 | ctf_integer_hex(void *, rhp, rhp) |
| 456 | ctf_integer_hex(unsigned long, offset, offset) |
| 457 | ctf_integer(long, qlen_lazy, qlen_lazy) |
| 458 | ctf_integer(long, qlen, qlen) |
| 459 | ) |
| 460 | ) |
| 461 | #endif |
| 462 | |
| 463 | /* |
| 464 | * Tracepoint for marking the beginning rcu_do_batch, performed to start |
| 465 | * RCU callback invocation. The first argument is the RCU flavor, |
| 466 | * the second is the number of lazy callbacks queued, the third is |
| 467 | * the total number of callbacks queued, and the fourth argument is |
| 468 | * the current RCU-callback batch limit. |
| 469 | */ |
| 470 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0)) |
| 471 | LTTNG_TRACEPOINT_EVENT(rcu_batch_start, |
| 472 | |
| 473 | TP_PROTO(const char *rcuname, long qlen, long blimit), |
| 474 | |
| 475 | TP_ARGS(rcuname, qlen, blimit), |
| 476 | |
| 477 | TP_FIELDS( |
| 478 | ctf_string(rcuname, rcuname) |
| 479 | ctf_integer(long, qlen, qlen) |
| 480 | ctf_integer(long, blimit, blimit) |
| 481 | ) |
| 482 | ) |
| 483 | #else |
| 484 | LTTNG_TRACEPOINT_EVENT(rcu_batch_start, |
| 485 | |
| 486 | TP_PROTO(const char *rcuname, long qlen_lazy, long qlen, long blimit), |
| 487 | |
| 488 | TP_ARGS(rcuname, qlen_lazy, qlen, blimit), |
| 489 | |
| 490 | TP_FIELDS( |
| 491 | ctf_string(rcuname, rcuname) |
| 492 | ctf_integer(long, qlen_lazy, qlen_lazy) |
| 493 | ctf_integer(long, qlen, qlen) |
| 494 | ctf_integer(long, blimit, blimit) |
| 495 | ) |
| 496 | ) |
| 497 | #endif |
| 498 | |
| 499 | /* |
| 500 | * Tracepoint for the invocation of a single RCU callback function. |
| 501 | * The first argument is the type of RCU, and the second argument is |
| 502 | * a pointer to the RCU callback itself. |
| 503 | */ |
| 504 | LTTNG_TRACEPOINT_EVENT(rcu_invoke_callback, |
| 505 | |
| 506 | TP_PROTO(const char *rcuname, struct rcu_head *rhp), |
| 507 | |
| 508 | TP_ARGS(rcuname, rhp), |
| 509 | |
| 510 | TP_FIELDS( |
| 511 | ctf_string(rcuname, rcuname) |
| 512 | ctf_integer_hex(void *, rhp, rhp) |
| 513 | ctf_integer_hex(void *, func, rhp->func) |
| 514 | ) |
| 515 | ) |
| 516 | |
| 517 | /* |
| 518 | * Tracepoint for the invocation of a single RCU callback of the special |
| 519 | * kfree() form. The first argument is the RCU flavor, the second |
| 520 | * argument is a pointer to the RCU callback, and the third argument |
| 521 | * is the offset of the callback within the enclosing RCU-protected |
| 522 | * data structure. |
| 523 | */ |
| 524 | LTTNG_TRACEPOINT_EVENT(rcu_invoke_kfree_callback, |
| 525 | |
| 526 | TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset), |
| 527 | |
| 528 | TP_ARGS(rcuname, rhp, offset), |
| 529 | |
| 530 | TP_FIELDS( |
| 531 | ctf_string(rcuname, rcuname) |
| 532 | ctf_integer_hex(void *, rhp, rhp) |
| 533 | ctf_integer(unsigned long, offset, offset) |
| 534 | ) |
| 535 | ) |
| 536 | |
| 537 | /* |
| 538 | * Tracepoint for exiting rcu_do_batch after RCU callbacks have been |
| 539 | * invoked. The first argument is the name of the RCU flavor, |
| 540 | * the second argument is number of callbacks actually invoked, |
| 541 | * the third argument (cb) is whether or not any of the callbacks that |
| 542 | * were ready to invoke at the beginning of this batch are still |
| 543 | * queued, the fourth argument (nr) is the return value of need_resched(), |
| 544 | * the fifth argument (iit) is 1 if the current task is the idle task, |
| 545 | * and the sixth argument (risk) is the return value from |
| 546 | * rcu_is_callbacks_kthread(). |
| 547 | */ |
| 548 | LTTNG_TRACEPOINT_EVENT(rcu_batch_end, |
| 549 | |
| 550 | TP_PROTO(const char *rcuname, int callbacks_invoked, |
| 551 | char cb, char nr, char iit, char risk), |
| 552 | |
| 553 | TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk), |
| 554 | |
| 555 | TP_FIELDS( |
| 556 | ctf_string(rcuname, rcuname) |
| 557 | ctf_integer(int, callbacks_invoked, callbacks_invoked) |
| 558 | ctf_integer(char, cb, cb) |
| 559 | ctf_integer(char, nr, nr) |
| 560 | ctf_integer(char, iit, iit) |
| 561 | ctf_integer(char, risk, risk) |
| 562 | ) |
| 563 | ) |
| 564 | |
| 565 | /* |
| 566 | * Tracepoint for rcutorture readers. The first argument is the name |
| 567 | * of the RCU flavor from rcutorture's viewpoint and the second argument |
| 568 | * is the callback address. |
| 569 | */ |
| 570 | LTTNG_TRACEPOINT_EVENT(rcu_torture_read, |
| 571 | |
| 572 | TP_PROTO(const char *rcutorturename, struct rcu_head *rhp, |
| 573 | unsigned long secs, unsigned long c_old, unsigned long c), |
| 574 | |
| 575 | TP_ARGS(rcutorturename, rhp, secs, c_old, c), |
| 576 | |
| 577 | TP_FIELDS( |
| 578 | ctf_string(rcutorturename, rcutorturename) |
| 579 | ctf_integer_hex(struct rcu_head *, rhp, rhp) |
| 580 | ctf_integer(unsigned long, secs, secs) |
| 581 | ctf_integer(unsigned long, c_old, c_old) |
| 582 | ctf_integer(unsigned long, c, c) |
| 583 | ) |
| 584 | ) |
| 585 | |
| 586 | /* |
| 587 | * Tracepoint for _rcu_barrier() execution. The string "s" describes |
| 588 | * the _rcu_barrier phase: |
| 589 | * "Begin": rcu_barrier_callback() started. |
| 590 | * "Check": rcu_barrier_callback() checking for piggybacking. |
| 591 | * "EarlyExit": rcu_barrier_callback() piggybacked, thus early exit. |
| 592 | * "Inc1": rcu_barrier_callback() piggyback check counter incremented. |
| 593 | * "Offline": rcu_barrier_callback() found offline CPU |
| 594 | * "OnlineQ": rcu_barrier_callback() found online CPU with callbacks. |
| 595 | * "OnlineNQ": rcu_barrier_callback() found online CPU, no callbacks. |
| 596 | * "IRQ": An rcu_barrier_callback() callback posted on remote CPU. |
| 597 | * "CB": An rcu_barrier_callback() invoked a callback, not the last. |
| 598 | * "LastCB": An rcu_barrier_callback() invoked the last callback. |
| 599 | * "Inc2": rcu_barrier_callback() piggyback check counter incremented. |
| 600 | * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument |
| 601 | * is the count of remaining callbacks, and "done" is the piggybacking count. |
| 602 | */ |
| 603 | LTTNG_TRACEPOINT_EVENT(rcu_barrier, |
| 604 | |
| 605 | TP_PROTO(const char *rcuname, const char *s, int cpu, int cnt, unsigned long done), |
| 606 | |
| 607 | TP_ARGS(rcuname, s, cpu, cnt, done), |
| 608 | |
| 609 | TP_FIELDS( |
| 610 | ctf_string(rcuname, rcuname) |
| 611 | ctf_string(s, s) |
| 612 | ctf_integer(int, cpu, cpu) |
| 613 | ctf_integer(int, cnt, cnt) |
| 614 | ctf_integer(unsigned long, done, done) |
| 615 | ) |
| 616 | ) |
| 617 | |
| 618 | #else /* #ifdef CONFIG_RCU_TRACE */ |
| 619 | |
| 620 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,19,0) || \ |
| 621 | LTTNG_RHEL_KERNEL_RANGE(4,18,0,80,0,0, 4,19,0,0,0,0)) |
| 622 | #define trace_rcu_grace_period(rcuname, gp_seq, gpevent) do { } while (0) |
| 623 | #define trace_rcu_grace_period_init(rcuname, gp_seq, level, grplo, grphi, \ |
| 624 | qsmask) do { } while (0) |
| 625 | #define trace_rcu_preempt_task(rcuname, pid, gp_seq) do { } while (0) |
| 626 | #define trace_rcu_unlock_preempted_task(rcuname, gp_seq, pid) do { } while (0) |
| 627 | #define trace_rcu_quiescent_state_report(rcuname, gp_seq, mask, qsmask, level, \ |
| 628 | grplo, grphi, gp_tasks) do { } \ |
| 629 | while (0) |
| 630 | #define trace_rcu_fqs(rcuname, gp_seq, cpu, qsevent) do { } while (0) |
| 631 | #else |
| 632 | #define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0) |
| 633 | #define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, \ |
| 634 | qsmask) do { } while (0) |
| 635 | #define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0) |
| 636 | #define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0) |
| 637 | #define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \ |
| 638 | grplo, grphi, gp_tasks) do { } \ |
| 639 | while (0) |
| 640 | #define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0) |
| 641 | #endif |
| 642 | |
| 643 | #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,16,0)) |
| 644 | #define trace_rcu_dyntick(polarity, oldnesting, newnesting, dyntick) do { } while (0) |
| 645 | #else |
| 646 | #define trace_rcu_dyntick(polarity, oldnesting, newnesting) do { } while (0) |
| 647 | #endif |
| 648 | |
| 649 | #define trace_rcu_prep_idle(reason) do { } while (0) |
| 650 | #define trace_rcu_callback(rcuname, rhp, qlen_lazy, qlen) do { } while (0) |
| 651 | #define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen_lazy, qlen) \ |
| 652 | do { } while (0) |
| 653 | #define trace_rcu_batch_start(rcuname, qlen_lazy, qlen, blimit) \ |
| 654 | do { } while (0) |
| 655 | #define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0) |
| 656 | #define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0) |
| 657 | #define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \ |
| 658 | do { } while (0) |
| 659 | #define trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \ |
| 660 | do { } while (0) |
| 661 | #define trace_rcu_barrier(name, s, cpu, cnt, done) do { } while (0) |
| 662 | #endif /* #else #ifdef CONFIG_RCU_TRACE */ |
| 663 | |
| 664 | #endif /* LTTNG_TRACE_RCU_H */ |
| 665 | |
| 666 | /* This part must be outside protection */ |
| 667 | #include <lttng/define_trace.h> |