rcu.h 24 KB

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