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