rcu.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  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_TREE_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. * "WakeOvf": Wake rcuo kthread, CB list is huge.
  155. * "WakeNot": Don't wake rcuo kthread.
  156. * "WakeNotPoll": Don't wake rcuo kthread because it is polling.
  157. * "Poll": Start of new polling cycle for rcu_nocb_poll.
  158. * "Sleep": Sleep waiting for CBs for !rcu_nocb_poll.
  159. * "WokeEmpty": rcuo kthread woke to find empty list.
  160. * "WokeNonEmpty": rcuo kthread woke to find non-empty list.
  161. * "WaitQueue": Enqueue partially done, timed wait for it to complete.
  162. * "WokeQueue": Partial enqueue now complete.
  163. */
  164. TRACE_EVENT(rcu_nocb_wake,
  165. TP_PROTO(const char *rcuname, int cpu, const char *reason),
  166. TP_ARGS(rcuname, cpu, reason),
  167. TP_STRUCT__entry(
  168. __field(const char *, rcuname)
  169. __field(int, cpu)
  170. __field(const char *, reason)
  171. ),
  172. TP_fast_assign(
  173. __entry->rcuname = rcuname;
  174. __entry->cpu = cpu;
  175. __entry->reason = reason;
  176. ),
  177. TP_printk("%s %d %s", __entry->rcuname, __entry->cpu, __entry->reason)
  178. );
  179. /*
  180. * Tracepoint for tasks blocking within preemptible-RCU read-side
  181. * critical sections. Track the type of RCU (which one day might
  182. * include SRCU), the grace-period number that the task is blocking
  183. * (the current or the next), and the task's PID.
  184. */
  185. TRACE_EVENT(rcu_preempt_task,
  186. TP_PROTO(const char *rcuname, int pid, unsigned long gpnum),
  187. TP_ARGS(rcuname, pid, gpnum),
  188. TP_STRUCT__entry(
  189. __field(const char *, rcuname)
  190. __field(unsigned long, gpnum)
  191. __field(int, pid)
  192. ),
  193. TP_fast_assign(
  194. __entry->rcuname = rcuname;
  195. __entry->gpnum = gpnum;
  196. __entry->pid = pid;
  197. ),
  198. TP_printk("%s %lu %d",
  199. __entry->rcuname, __entry->gpnum, __entry->pid)
  200. );
  201. /*
  202. * Tracepoint for tasks that blocked within a given preemptible-RCU
  203. * read-side critical section exiting that critical section. Track the
  204. * type of RCU (which one day might include SRCU) and the task's PID.
  205. */
  206. TRACE_EVENT(rcu_unlock_preempted_task,
  207. TP_PROTO(const char *rcuname, unsigned long gpnum, int pid),
  208. TP_ARGS(rcuname, gpnum, pid),
  209. TP_STRUCT__entry(
  210. __field(const char *, rcuname)
  211. __field(unsigned long, gpnum)
  212. __field(int, pid)
  213. ),
  214. TP_fast_assign(
  215. __entry->rcuname = rcuname;
  216. __entry->gpnum = gpnum;
  217. __entry->pid = pid;
  218. ),
  219. TP_printk("%s %lu %d", __entry->rcuname, __entry->gpnum, __entry->pid)
  220. );
  221. /*
  222. * Tracepoint for quiescent-state-reporting events. These are
  223. * distinguished by the type of RCU, the grace-period number, the
  224. * mask of quiescent lower-level entities, the rcu_node structure level,
  225. * the starting and ending CPU covered by the rcu_node structure, and
  226. * whether there are any blocked tasks blocking the current grace period.
  227. * All but the type of RCU are extracted from the rcu_node structure.
  228. */
  229. TRACE_EVENT(rcu_quiescent_state_report,
  230. TP_PROTO(const char *rcuname, unsigned long gpnum,
  231. unsigned long mask, unsigned long qsmask,
  232. u8 level, int grplo, int grphi, int gp_tasks),
  233. TP_ARGS(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks),
  234. TP_STRUCT__entry(
  235. __field(const char *, rcuname)
  236. __field(unsigned long, gpnum)
  237. __field(unsigned long, mask)
  238. __field(unsigned long, qsmask)
  239. __field(u8, level)
  240. __field(int, grplo)
  241. __field(int, grphi)
  242. __field(u8, gp_tasks)
  243. ),
  244. TP_fast_assign(
  245. __entry->rcuname = rcuname;
  246. __entry->gpnum = gpnum;
  247. __entry->mask = mask;
  248. __entry->qsmask = qsmask;
  249. __entry->level = level;
  250. __entry->grplo = grplo;
  251. __entry->grphi = grphi;
  252. __entry->gp_tasks = gp_tasks;
  253. ),
  254. TP_printk("%s %lu %lx>%lx %u %d %d %u",
  255. __entry->rcuname, __entry->gpnum,
  256. __entry->mask, __entry->qsmask, __entry->level,
  257. __entry->grplo, __entry->grphi, __entry->gp_tasks)
  258. );
  259. /*
  260. * Tracepoint for quiescent states detected by force_quiescent_state().
  261. * These trace events include the type of RCU, the grace-period number
  262. * that was blocked by the CPU, the CPU itself, and the type of quiescent
  263. * state, which can be "dti" for dyntick-idle mode, "ofl" for CPU offline,
  264. * or "kick" when kicking a CPU that has been in dyntick-idle mode for
  265. * too long.
  266. */
  267. TRACE_EVENT(rcu_fqs,
  268. TP_PROTO(const char *rcuname, unsigned long gpnum, int cpu, const char *qsevent),
  269. TP_ARGS(rcuname, gpnum, cpu, qsevent),
  270. TP_STRUCT__entry(
  271. __field(const char *, rcuname)
  272. __field(unsigned long, gpnum)
  273. __field(int, cpu)
  274. __field(const char *, qsevent)
  275. ),
  276. TP_fast_assign(
  277. __entry->rcuname = rcuname;
  278. __entry->gpnum = gpnum;
  279. __entry->cpu = cpu;
  280. __entry->qsevent = qsevent;
  281. ),
  282. TP_printk("%s %lu %d %s",
  283. __entry->rcuname, __entry->gpnum,
  284. __entry->cpu, __entry->qsevent)
  285. );
  286. #endif /* #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) */
  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. TRACE_EVENT(rcu_dyntick,
  301. TP_PROTO(const char *polarity, long long oldnesting, long long newnesting),
  302. TP_ARGS(polarity, oldnesting, newnesting),
  303. TP_STRUCT__entry(
  304. __field(const char *, polarity)
  305. __field(long long, oldnesting)
  306. __field(long long, newnesting)
  307. ),
  308. TP_fast_assign(
  309. __entry->polarity = polarity;
  310. __entry->oldnesting = oldnesting;
  311. __entry->newnesting = newnesting;
  312. ),
  313. TP_printk("%s %llx %llx", __entry->polarity,
  314. __entry->oldnesting, __entry->newnesting)
  315. );
  316. /*
  317. * Tracepoint for RCU preparation for idle, the goal being to get RCU
  318. * processing done so that the current CPU can shut off its scheduling
  319. * clock and enter dyntick-idle mode. One way to accomplish this is
  320. * to drain all RCU callbacks from this CPU, and the other is to have
  321. * done everything RCU requires for the current grace period. In this
  322. * latter case, the CPU will be awakened at the end of the current grace
  323. * period in order to process the remainder of its callbacks.
  324. *
  325. * These tracepoints take a string as argument:
  326. *
  327. * "No callbacks": Nothing to do, no callbacks on this CPU.
  328. * "In holdoff": Nothing to do, holding off after unsuccessful attempt.
  329. * "Begin holdoff": Attempt failed, don't retry until next jiffy.
  330. * "Dyntick with callbacks": Entering dyntick-idle despite callbacks.
  331. * "Dyntick with lazy callbacks": Entering dyntick-idle w/lazy callbacks.
  332. * "More callbacks": Still more callbacks, try again to clear them out.
  333. * "Callbacks drained": All callbacks processed, off to dyntick idle!
  334. * "Timer": Timer fired to cause CPU to continue processing callbacks.
  335. * "Demigrate": Timer fired on wrong CPU, woke up correct CPU.
  336. * "Cleanup after idle": Idle exited, timer canceled.
  337. */
  338. TRACE_EVENT(rcu_prep_idle,
  339. TP_PROTO(const char *reason),
  340. TP_ARGS(reason),
  341. TP_STRUCT__entry(
  342. __field(const char *, reason)
  343. ),
  344. TP_fast_assign(
  345. __entry->reason = reason;
  346. ),
  347. TP_printk("%s", __entry->reason)
  348. );
  349. /*
  350. * Tracepoint for the registration of a single RCU callback function.
  351. * The first argument is the type of RCU, the second argument is
  352. * a pointer to the RCU callback itself, the third element is the
  353. * number of lazy callbacks queued, and the fourth element is the
  354. * total number of callbacks queued.
  355. */
  356. TRACE_EVENT(rcu_callback,
  357. TP_PROTO(const char *rcuname, struct rcu_head *rhp, long qlen_lazy,
  358. long qlen),
  359. TP_ARGS(rcuname, rhp, qlen_lazy, qlen),
  360. TP_STRUCT__entry(
  361. __field(const char *, rcuname)
  362. __field(void *, rhp)
  363. __field(void *, func)
  364. __field(long, qlen_lazy)
  365. __field(long, qlen)
  366. ),
  367. TP_fast_assign(
  368. __entry->rcuname = rcuname;
  369. __entry->rhp = rhp;
  370. __entry->func = rhp->func;
  371. __entry->qlen_lazy = qlen_lazy;
  372. __entry->qlen = qlen;
  373. ),
  374. TP_printk("%s rhp=%p func=%pf %ld/%ld",
  375. __entry->rcuname, __entry->rhp, __entry->func,
  376. __entry->qlen_lazy, __entry->qlen)
  377. );
  378. /*
  379. * Tracepoint for the registration of a single RCU callback of the special
  380. * kfree() form. The first argument is the RCU type, the second argument
  381. * is a pointer to the RCU callback, the third argument is the offset
  382. * of the callback within the enclosing RCU-protected data structure,
  383. * the fourth argument is the number of lazy callbacks queued, and the
  384. * fifth argument is the total number of callbacks queued.
  385. */
  386. TRACE_EVENT(rcu_kfree_callback,
  387. TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset,
  388. long qlen_lazy, long qlen),
  389. TP_ARGS(rcuname, rhp, offset, qlen_lazy, qlen),
  390. TP_STRUCT__entry(
  391. __field(const char *, rcuname)
  392. __field(void *, rhp)
  393. __field(unsigned long, offset)
  394. __field(long, qlen_lazy)
  395. __field(long, qlen)
  396. ),
  397. TP_fast_assign(
  398. __entry->rcuname = rcuname;
  399. __entry->rhp = rhp;
  400. __entry->offset = offset;
  401. __entry->qlen_lazy = qlen_lazy;
  402. __entry->qlen = qlen;
  403. ),
  404. TP_printk("%s rhp=%p func=%ld %ld/%ld",
  405. __entry->rcuname, __entry->rhp, __entry->offset,
  406. __entry->qlen_lazy, __entry->qlen)
  407. );
  408. /*
  409. * Tracepoint for marking the beginning rcu_do_batch, performed to start
  410. * RCU callback invocation. The first argument is the RCU flavor,
  411. * the second is the number of lazy callbacks queued, the third is
  412. * the total number of callbacks queued, and the fourth argument is
  413. * the current RCU-callback batch limit.
  414. */
  415. TRACE_EVENT(rcu_batch_start,
  416. TP_PROTO(const char *rcuname, long qlen_lazy, long qlen, long blimit),
  417. TP_ARGS(rcuname, qlen_lazy, qlen, blimit),
  418. TP_STRUCT__entry(
  419. __field(const char *, rcuname)
  420. __field(long, qlen_lazy)
  421. __field(long, qlen)
  422. __field(long, blimit)
  423. ),
  424. TP_fast_assign(
  425. __entry->rcuname = rcuname;
  426. __entry->qlen_lazy = qlen_lazy;
  427. __entry->qlen = qlen;
  428. __entry->blimit = blimit;
  429. ),
  430. TP_printk("%s CBs=%ld/%ld bl=%ld",
  431. __entry->rcuname, __entry->qlen_lazy, __entry->qlen,
  432. __entry->blimit)
  433. );
  434. /*
  435. * Tracepoint for the invocation of a single RCU callback function.
  436. * The first argument is the type of RCU, and the second argument is
  437. * a pointer to the RCU callback itself.
  438. */
  439. TRACE_EVENT(rcu_invoke_callback,
  440. TP_PROTO(const char *rcuname, struct rcu_head *rhp),
  441. TP_ARGS(rcuname, rhp),
  442. TP_STRUCT__entry(
  443. __field(const char *, rcuname)
  444. __field(void *, rhp)
  445. __field(void *, func)
  446. ),
  447. TP_fast_assign(
  448. __entry->rcuname = rcuname;
  449. __entry->rhp = rhp;
  450. __entry->func = rhp->func;
  451. ),
  452. TP_printk("%s rhp=%p func=%pf",
  453. __entry->rcuname, __entry->rhp, __entry->func)
  454. );
  455. /*
  456. * Tracepoint for the invocation of a single RCU callback of the special
  457. * kfree() form. The first argument is the RCU flavor, the second
  458. * argument is a pointer to the RCU callback, and the third argument
  459. * is the offset of the callback within the enclosing RCU-protected
  460. * data structure.
  461. */
  462. TRACE_EVENT(rcu_invoke_kfree_callback,
  463. TP_PROTO(const char *rcuname, struct rcu_head *rhp, unsigned long offset),
  464. TP_ARGS(rcuname, rhp, offset),
  465. TP_STRUCT__entry(
  466. __field(const char *, rcuname)
  467. __field(void *, rhp)
  468. __field(unsigned long, offset)
  469. ),
  470. TP_fast_assign(
  471. __entry->rcuname = rcuname;
  472. __entry->rhp = rhp;
  473. __entry->offset = offset;
  474. ),
  475. TP_printk("%s rhp=%p func=%ld",
  476. __entry->rcuname, __entry->rhp, __entry->offset)
  477. );
  478. /*
  479. * Tracepoint for exiting rcu_do_batch after RCU callbacks have been
  480. * invoked. The first argument is the name of the RCU flavor,
  481. * the second argument is number of callbacks actually invoked,
  482. * the third argument (cb) is whether or not any of the callbacks that
  483. * were ready to invoke at the beginning of this batch are still
  484. * queued, the fourth argument (nr) is the return value of need_resched(),
  485. * the fifth argument (iit) is 1 if the current task is the idle task,
  486. * and the sixth argument (risk) is the return value from
  487. * rcu_is_callbacks_kthread().
  488. */
  489. TRACE_EVENT(rcu_batch_end,
  490. TP_PROTO(const char *rcuname, int callbacks_invoked,
  491. char cb, char nr, char iit, char risk),
  492. TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
  493. TP_STRUCT__entry(
  494. __field(const char *, rcuname)
  495. __field(int, callbacks_invoked)
  496. __field(char, cb)
  497. __field(char, nr)
  498. __field(char, iit)
  499. __field(char, risk)
  500. ),
  501. TP_fast_assign(
  502. __entry->rcuname = rcuname;
  503. __entry->callbacks_invoked = callbacks_invoked;
  504. __entry->cb = cb;
  505. __entry->nr = nr;
  506. __entry->iit = iit;
  507. __entry->risk = risk;
  508. ),
  509. TP_printk("%s CBs-invoked=%d idle=%c%c%c%c",
  510. __entry->rcuname, __entry->callbacks_invoked,
  511. __entry->cb ? 'C' : '.',
  512. __entry->nr ? 'S' : '.',
  513. __entry->iit ? 'I' : '.',
  514. __entry->risk ? 'R' : '.')
  515. );
  516. /*
  517. * Tracepoint for rcutorture readers. The first argument is the name
  518. * of the RCU flavor from rcutorture's viewpoint and the second argument
  519. * is the callback address.
  520. */
  521. TRACE_EVENT(rcu_torture_read,
  522. TP_PROTO(const char *rcutorturename, struct rcu_head *rhp,
  523. unsigned long secs, unsigned long c_old, unsigned long c),
  524. TP_ARGS(rcutorturename, rhp, secs, c_old, c),
  525. TP_STRUCT__entry(
  526. __field(const char *, rcutorturename)
  527. __field(struct rcu_head *, rhp)
  528. __field(unsigned long, secs)
  529. __field(unsigned long, c_old)
  530. __field(unsigned long, c)
  531. ),
  532. TP_fast_assign(
  533. __entry->rcutorturename = rcutorturename;
  534. __entry->rhp = rhp;
  535. __entry->secs = secs;
  536. __entry->c_old = c_old;
  537. __entry->c = c;
  538. ),
  539. TP_printk("%s torture read %p %luus c: %lu %lu",
  540. __entry->rcutorturename, __entry->rhp,
  541. __entry->secs, __entry->c_old, __entry->c)
  542. );
  543. /*
  544. * Tracepoint for _rcu_barrier() execution. The string "s" describes
  545. * the _rcu_barrier phase:
  546. * "Begin": rcu_barrier_callback() started.
  547. * "Check": rcu_barrier_callback() checking for piggybacking.
  548. * "EarlyExit": rcu_barrier_callback() piggybacked, thus early exit.
  549. * "Inc1": rcu_barrier_callback() piggyback check counter incremented.
  550. * "Offline": rcu_barrier_callback() found offline CPU
  551. * "OnlineNoCB": rcu_barrier_callback() found online no-CBs CPU.
  552. * "OnlineQ": rcu_barrier_callback() found online CPU with callbacks.
  553. * "OnlineNQ": rcu_barrier_callback() found online CPU, no callbacks.
  554. * "IRQ": An rcu_barrier_callback() callback posted on remote CPU.
  555. * "CB": An rcu_barrier_callback() invoked a callback, not the last.
  556. * "LastCB": An rcu_barrier_callback() invoked the last callback.
  557. * "Inc2": rcu_barrier_callback() piggyback check counter incremented.
  558. * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument
  559. * is the count of remaining callbacks, and "done" is the piggybacking count.
  560. */
  561. TRACE_EVENT(rcu_barrier,
  562. TP_PROTO(const char *rcuname, const char *s, int cpu, int cnt, unsigned long done),
  563. TP_ARGS(rcuname, s, cpu, cnt, done),
  564. TP_STRUCT__entry(
  565. __field(const char *, rcuname)
  566. __field(const char *, s)
  567. __field(int, cpu)
  568. __field(int, cnt)
  569. __field(unsigned long, done)
  570. ),
  571. TP_fast_assign(
  572. __entry->rcuname = rcuname;
  573. __entry->s = s;
  574. __entry->cpu = cpu;
  575. __entry->cnt = cnt;
  576. __entry->done = done;
  577. ),
  578. TP_printk("%s %s cpu %d remaining %d # %lu",
  579. __entry->rcuname, __entry->s, __entry->cpu, __entry->cnt,
  580. __entry->done)
  581. );
  582. #else /* #ifdef CONFIG_RCU_TRACE */
  583. #define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0)
  584. #define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, \
  585. qsmask) do { } while (0)
  586. #define trace_rcu_future_grace_period(rcuname, gpnum, completed, c, \
  587. level, grplo, grphi, event) \
  588. do { } while (0)
  589. #define trace_rcu_nocb_wake(rcuname, cpu, reason) do { } while (0)
  590. #define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0)
  591. #define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0)
  592. #define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \
  593. grplo, grphi, gp_tasks) do { } \
  594. while (0)
  595. #define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0)
  596. #define trace_rcu_dyntick(polarity, oldnesting, newnesting) do { } while (0)
  597. #define trace_rcu_prep_idle(reason) do { } while (0)
  598. #define trace_rcu_callback(rcuname, rhp, qlen_lazy, qlen) do { } while (0)
  599. #define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen_lazy, qlen) \
  600. do { } while (0)
  601. #define trace_rcu_batch_start(rcuname, qlen_lazy, qlen, blimit) \
  602. do { } while (0)
  603. #define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0)
  604. #define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0)
  605. #define trace_rcu_batch_end(rcuname, callbacks_invoked, cb, nr, iit, risk) \
  606. do { } while (0)
  607. #define trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
  608. do { } while (0)
  609. #define trace_rcu_barrier(name, s, cpu, cnt, done) do { } while (0)
  610. #endif /* #else #ifdef CONFIG_RCU_TRACE */
  611. #endif /* _TRACE_RCU_H */
  612. /* This part must be outside protection */
  613. #include <trace/define_trace.h>