rcu.h 22 KB

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