rcu.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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(char *s),
  19. TP_ARGS(s),
  20. TP_STRUCT__entry(
  21. __field(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: starting and ending a grace
  32. * period ("start" and "end", respectively), a CPU noting the start
  33. * of a new grace period or the end of an old grace period ("cpustart"
  34. * and "cpuend", respectively), a CPU passing through a quiescent
  35. * state ("cpuqs"), a CPU coming online or going offline ("cpuonl"
  36. * and "cpuofl", respectively), and a CPU being kicked for being too
  37. * long in dyntick-idle mode ("kick").
  38. */
  39. TRACE_EVENT(rcu_grace_period,
  40. TP_PROTO(char *rcuname, unsigned long gpnum, char *gpevent),
  41. TP_ARGS(rcuname, gpnum, gpevent),
  42. TP_STRUCT__entry(
  43. __field(char *, rcuname)
  44. __field(unsigned long, gpnum)
  45. __field(char *, gpevent)
  46. ),
  47. TP_fast_assign(
  48. __entry->rcuname = rcuname;
  49. __entry->gpnum = gpnum;
  50. __entry->gpevent = gpevent;
  51. ),
  52. TP_printk("%s %lu %s",
  53. __entry->rcuname, __entry->gpnum, __entry->gpevent)
  54. );
  55. /*
  56. * Tracepoint for grace-period-initialization events. These are
  57. * distinguished by the type of RCU, the new grace-period number, the
  58. * rcu_node structure level, the starting and ending CPU covered by the
  59. * rcu_node structure, and the mask of CPUs that will be waited for.
  60. * All but the type of RCU are extracted from the rcu_node structure.
  61. */
  62. TRACE_EVENT(rcu_grace_period_init,
  63. TP_PROTO(char *rcuname, unsigned long gpnum, u8 level,
  64. int grplo, int grphi, unsigned long qsmask),
  65. TP_ARGS(rcuname, gpnum, level, grplo, grphi, qsmask),
  66. TP_STRUCT__entry(
  67. __field(char *, rcuname)
  68. __field(unsigned long, gpnum)
  69. __field(u8, level)
  70. __field(int, grplo)
  71. __field(int, grphi)
  72. __field(unsigned long, qsmask)
  73. ),
  74. TP_fast_assign(
  75. __entry->rcuname = rcuname;
  76. __entry->gpnum = gpnum;
  77. __entry->level = level;
  78. __entry->grplo = grplo;
  79. __entry->grphi = grphi;
  80. __entry->qsmask = qsmask;
  81. ),
  82. TP_printk("%s %lu %u %d %d %lx",
  83. __entry->rcuname, __entry->gpnum, __entry->level,
  84. __entry->grplo, __entry->grphi, __entry->qsmask)
  85. );
  86. /*
  87. * Tracepoint for tasks blocking within preemptible-RCU read-side
  88. * critical sections. Track the type of RCU (which one day might
  89. * include SRCU), the grace-period number that the task is blocking
  90. * (the current or the next), and the task's PID.
  91. */
  92. TRACE_EVENT(rcu_preempt_task,
  93. TP_PROTO(char *rcuname, int pid, unsigned long gpnum),
  94. TP_ARGS(rcuname, pid, gpnum),
  95. TP_STRUCT__entry(
  96. __field(char *, rcuname)
  97. __field(unsigned long, gpnum)
  98. __field(int, pid)
  99. ),
  100. TP_fast_assign(
  101. __entry->rcuname = rcuname;
  102. __entry->gpnum = gpnum;
  103. __entry->pid = pid;
  104. ),
  105. TP_printk("%s %lu %d",
  106. __entry->rcuname, __entry->gpnum, __entry->pid)
  107. );
  108. /*
  109. * Tracepoint for tasks that blocked within a given preemptible-RCU
  110. * read-side critical section exiting that critical section. Track the
  111. * type of RCU (which one day might include SRCU) and the task's PID.
  112. */
  113. TRACE_EVENT(rcu_unlock_preempted_task,
  114. TP_PROTO(char *rcuname, unsigned long gpnum, int pid),
  115. TP_ARGS(rcuname, gpnum, pid),
  116. TP_STRUCT__entry(
  117. __field(char *, rcuname)
  118. __field(unsigned long, gpnum)
  119. __field(int, pid)
  120. ),
  121. TP_fast_assign(
  122. __entry->rcuname = rcuname;
  123. __entry->gpnum = gpnum;
  124. __entry->pid = pid;
  125. ),
  126. TP_printk("%s %lu %d", __entry->rcuname, __entry->gpnum, __entry->pid)
  127. );
  128. /*
  129. * Tracepoint for quiescent-state-reporting events. These are
  130. * distinguished by the type of RCU, the grace-period number, the
  131. * mask of quiescent lower-level entities, the rcu_node structure level,
  132. * the starting and ending CPU covered by the rcu_node structure, and
  133. * whether there are any blocked tasks blocking the current grace period.
  134. * All but the type of RCU are extracted from the rcu_node structure.
  135. */
  136. TRACE_EVENT(rcu_quiescent_state_report,
  137. TP_PROTO(char *rcuname, unsigned long gpnum,
  138. unsigned long mask, unsigned long qsmask,
  139. u8 level, int grplo, int grphi, int gp_tasks),
  140. TP_ARGS(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks),
  141. TP_STRUCT__entry(
  142. __field(char *, rcuname)
  143. __field(unsigned long, gpnum)
  144. __field(unsigned long, mask)
  145. __field(unsigned long, qsmask)
  146. __field(u8, level)
  147. __field(int, grplo)
  148. __field(int, grphi)
  149. __field(u8, gp_tasks)
  150. ),
  151. TP_fast_assign(
  152. __entry->rcuname = rcuname;
  153. __entry->gpnum = gpnum;
  154. __entry->mask = mask;
  155. __entry->qsmask = qsmask;
  156. __entry->level = level;
  157. __entry->grplo = grplo;
  158. __entry->grphi = grphi;
  159. __entry->gp_tasks = gp_tasks;
  160. ),
  161. TP_printk("%s %lu %lx>%lx %u %d %d %u",
  162. __entry->rcuname, __entry->gpnum,
  163. __entry->mask, __entry->qsmask, __entry->level,
  164. __entry->grplo, __entry->grphi, __entry->gp_tasks)
  165. );
  166. /*
  167. * Tracepoint for quiescent states detected by force_quiescent_state().
  168. * These trace events include the type of RCU, the grace-period number
  169. * that was blocked by the CPU, the CPU itself, and the type of quiescent
  170. * state, which can be "dti" for dyntick-idle mode, "ofl" for CPU offline,
  171. * or "kick" when kicking a CPU that has been in dyntick-idle mode for
  172. * too long.
  173. */
  174. TRACE_EVENT(rcu_fqs,
  175. TP_PROTO(char *rcuname, unsigned long gpnum, int cpu, char *qsevent),
  176. TP_ARGS(rcuname, gpnum, cpu, qsevent),
  177. TP_STRUCT__entry(
  178. __field(char *, rcuname)
  179. __field(unsigned long, gpnum)
  180. __field(int, cpu)
  181. __field(char *, qsevent)
  182. ),
  183. TP_fast_assign(
  184. __entry->rcuname = rcuname;
  185. __entry->gpnum = gpnum;
  186. __entry->cpu = cpu;
  187. __entry->qsevent = qsevent;
  188. ),
  189. TP_printk("%s %lu %d %s",
  190. __entry->rcuname, __entry->gpnum,
  191. __entry->cpu, __entry->qsevent)
  192. );
  193. #endif /* #if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) */
  194. /*
  195. * Tracepoint for dyntick-idle entry/exit events. These take a string
  196. * as argument: "Start" for entering dyntick-idle mode and "End" for
  197. * leaving it.
  198. */
  199. TRACE_EVENT(rcu_dyntick,
  200. TP_PROTO(char *polarity),
  201. TP_ARGS(polarity),
  202. TP_STRUCT__entry(
  203. __field(char *, polarity)
  204. ),
  205. TP_fast_assign(
  206. __entry->polarity = polarity;
  207. ),
  208. TP_printk("%s", __entry->polarity)
  209. );
  210. /*
  211. * Tracepoint for the registration of a single RCU callback function.
  212. * The first argument is the type of RCU, the second argument is
  213. * a pointer to the RCU callback itself, and the third element is the
  214. * new RCU callback queue length for the current CPU.
  215. */
  216. TRACE_EVENT(rcu_callback,
  217. TP_PROTO(char *rcuname, struct rcu_head *rhp, long qlen),
  218. TP_ARGS(rcuname, rhp, qlen),
  219. TP_STRUCT__entry(
  220. __field(char *, rcuname)
  221. __field(void *, rhp)
  222. __field(void *, func)
  223. __field(long, qlen)
  224. ),
  225. TP_fast_assign(
  226. __entry->rcuname = rcuname;
  227. __entry->rhp = rhp;
  228. __entry->func = rhp->func;
  229. __entry->qlen = qlen;
  230. ),
  231. TP_printk("%s rhp=%p func=%pf %ld",
  232. __entry->rcuname, __entry->rhp, __entry->func, __entry->qlen)
  233. );
  234. /*
  235. * Tracepoint for the registration of a single RCU callback of the special
  236. * kfree() form. The first argument is the RCU type, the second argument
  237. * is a pointer to the RCU callback, the third argument is the offset
  238. * of the callback within the enclosing RCU-protected data structure,
  239. * and the fourth argument is the new RCU callback queue length for the
  240. * current CPU.
  241. */
  242. TRACE_EVENT(rcu_kfree_callback,
  243. TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset,
  244. long qlen),
  245. TP_ARGS(rcuname, rhp, offset, qlen),
  246. TP_STRUCT__entry(
  247. __field(char *, rcuname)
  248. __field(void *, rhp)
  249. __field(unsigned long, offset)
  250. __field(long, qlen)
  251. ),
  252. TP_fast_assign(
  253. __entry->rcuname = rcuname;
  254. __entry->rhp = rhp;
  255. __entry->offset = offset;
  256. __entry->qlen = qlen;
  257. ),
  258. TP_printk("%s rhp=%p func=%ld %ld",
  259. __entry->rcuname, __entry->rhp, __entry->offset,
  260. __entry->qlen)
  261. );
  262. /*
  263. * Tracepoint for marking the beginning rcu_do_batch, performed to start
  264. * RCU callback invocation. The first argument is the RCU flavor,
  265. * the second is the total number of callbacks (including those that
  266. * are not yet ready to be invoked), and the third argument is the
  267. * current RCU-callback batch limit.
  268. */
  269. TRACE_EVENT(rcu_batch_start,
  270. TP_PROTO(char *rcuname, long qlen, int blimit),
  271. TP_ARGS(rcuname, qlen, blimit),
  272. TP_STRUCT__entry(
  273. __field(char *, rcuname)
  274. __field(long, qlen)
  275. __field(int, blimit)
  276. ),
  277. TP_fast_assign(
  278. __entry->rcuname = rcuname;
  279. __entry->qlen = qlen;
  280. __entry->blimit = blimit;
  281. ),
  282. TP_printk("%s CBs=%ld bl=%d",
  283. __entry->rcuname, __entry->qlen, __entry->blimit)
  284. );
  285. /*
  286. * Tracepoint for the invocation of a single RCU callback function.
  287. * The first argument is the type of RCU, and the second argument is
  288. * a pointer to the RCU callback itself.
  289. */
  290. TRACE_EVENT(rcu_invoke_callback,
  291. TP_PROTO(char *rcuname, struct rcu_head *rhp),
  292. TP_ARGS(rcuname, rhp),
  293. TP_STRUCT__entry(
  294. __field(char *, rcuname)
  295. __field(void *, rhp)
  296. __field(void *, func)
  297. ),
  298. TP_fast_assign(
  299. __entry->rcuname = rcuname;
  300. __entry->rhp = rhp;
  301. __entry->func = rhp->func;
  302. ),
  303. TP_printk("%s rhp=%p func=%pf",
  304. __entry->rcuname, __entry->rhp, __entry->func)
  305. );
  306. /*
  307. * Tracepoint for the invocation of a single RCU callback of the special
  308. * kfree() form. The first argument is the RCU flavor, the second
  309. * argument is a pointer to the RCU callback, and the third argument
  310. * is the offset of the callback within the enclosing RCU-protected
  311. * data structure.
  312. */
  313. TRACE_EVENT(rcu_invoke_kfree_callback,
  314. TP_PROTO(char *rcuname, struct rcu_head *rhp, unsigned long offset),
  315. TP_ARGS(rcuname, rhp, offset),
  316. TP_STRUCT__entry(
  317. __field(char *, rcuname)
  318. __field(void *, rhp)
  319. __field(unsigned long, offset)
  320. ),
  321. TP_fast_assign(
  322. __entry->rcuname = rcuname;
  323. __entry->rhp = rhp;
  324. __entry->offset = offset;
  325. ),
  326. TP_printk("%s rhp=%p func=%ld",
  327. __entry->rcuname, __entry->rhp, __entry->offset)
  328. );
  329. /*
  330. * Tracepoint for exiting rcu_do_batch after RCU callbacks have been
  331. * invoked. The first argument is the name of the RCU flavor and
  332. * the second argument is number of callbacks actually invoked.
  333. */
  334. TRACE_EVENT(rcu_batch_end,
  335. TP_PROTO(char *rcuname, int callbacks_invoked),
  336. TP_ARGS(rcuname, callbacks_invoked),
  337. TP_STRUCT__entry(
  338. __field(char *, rcuname)
  339. __field(int, callbacks_invoked)
  340. ),
  341. TP_fast_assign(
  342. __entry->rcuname = rcuname;
  343. __entry->callbacks_invoked = callbacks_invoked;
  344. ),
  345. TP_printk("%s CBs-invoked=%d",
  346. __entry->rcuname, __entry->callbacks_invoked)
  347. );
  348. #else /* #ifdef CONFIG_RCU_TRACE */
  349. #define trace_rcu_grace_period(rcuname, gpnum, gpevent) do { } while (0)
  350. #define trace_rcu_grace_period_init(rcuname, gpnum, level, grplo, grphi, qsmask) do { } while (0)
  351. #define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0)
  352. #define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0)
  353. #define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, grplo, grphi, gp_tasks) do { } while (0)
  354. #define trace_rcu_fqs(rcuname, gpnum, cpu, qsevent) do { } while (0)
  355. #define trace_rcu_dyntick(polarity) do { } while (0)
  356. #define trace_rcu_callback(rcuname, rhp, qlen) do { } while (0)
  357. #define trace_rcu_kfree_callback(rcuname, rhp, offset, qlen) do { } while (0)
  358. #define trace_rcu_batch_start(rcuname, qlen, blimit) do { } while (0)
  359. #define trace_rcu_invoke_callback(rcuname, rhp) do { } while (0)
  360. #define trace_rcu_invoke_kfree_callback(rcuname, rhp, offset) do { } while (0)
  361. #define trace_rcu_batch_end(rcuname, callbacks_invoked) do { } while (0)
  362. #endif /* #else #ifdef CONFIG_RCU_TRACE */
  363. #endif /* _TRACE_RCU_H */
  364. /* This part must be outside protection */
  365. #include <trace/define_trace.h>