rcu.h 24 KB

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