sunrpc.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM sunrpc
  4. #if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define _TRACE_SUNRPC_H
  6. #include <linux/sunrpc/sched.h>
  7. #include <linux/sunrpc/clnt.h>
  8. #include <linux/sunrpc/svc.h>
  9. #include <linux/sunrpc/xprtsock.h>
  10. #include <linux/sunrpc/svc_xprt.h>
  11. #include <net/tcp_states.h>
  12. #include <linux/net.h>
  13. #include <linux/tracepoint.h>
  14. DECLARE_EVENT_CLASS(rpc_task_status,
  15. TP_PROTO(struct rpc_task *task),
  16. TP_ARGS(task),
  17. TP_STRUCT__entry(
  18. __field(unsigned int, task_id)
  19. __field(unsigned int, client_id)
  20. __field(int, status)
  21. ),
  22. TP_fast_assign(
  23. __entry->task_id = task->tk_pid;
  24. __entry->client_id = task->tk_client->cl_clid;
  25. __entry->status = task->tk_status;
  26. ),
  27. TP_printk("task:%u@%u status=%d",
  28. __entry->task_id, __entry->client_id,
  29. __entry->status)
  30. );
  31. DEFINE_EVENT(rpc_task_status, rpc_call_status,
  32. TP_PROTO(struct rpc_task *task),
  33. TP_ARGS(task)
  34. );
  35. DEFINE_EVENT(rpc_task_status, rpc_bind_status,
  36. TP_PROTO(struct rpc_task *task),
  37. TP_ARGS(task)
  38. );
  39. TRACE_EVENT(rpc_connect_status,
  40. TP_PROTO(const struct rpc_task *task),
  41. TP_ARGS(task),
  42. TP_STRUCT__entry(
  43. __field(unsigned int, task_id)
  44. __field(unsigned int, client_id)
  45. __field(int, status)
  46. ),
  47. TP_fast_assign(
  48. __entry->task_id = task->tk_pid;
  49. __entry->client_id = task->tk_client->cl_clid;
  50. __entry->status = task->tk_status;
  51. ),
  52. TP_printk("task:%u@%u status=%d",
  53. __entry->task_id, __entry->client_id,
  54. __entry->status)
  55. );
  56. TRACE_EVENT(rpc_request,
  57. TP_PROTO(const struct rpc_task *task),
  58. TP_ARGS(task),
  59. TP_STRUCT__entry(
  60. __field(unsigned int, task_id)
  61. __field(unsigned int, client_id)
  62. __field(int, version)
  63. __field(bool, async)
  64. __string(progname, task->tk_client->cl_program->name)
  65. __string(procname, rpc_proc_name(task))
  66. ),
  67. TP_fast_assign(
  68. __entry->task_id = task->tk_pid;
  69. __entry->client_id = task->tk_client->cl_clid;
  70. __entry->version = task->tk_client->cl_vers;
  71. __entry->async = RPC_IS_ASYNC(task);
  72. __assign_str(progname, task->tk_client->cl_program->name)
  73. __assign_str(procname, rpc_proc_name(task))
  74. ),
  75. TP_printk("task:%u@%u %sv%d %s (%ssync)",
  76. __entry->task_id, __entry->client_id,
  77. __get_str(progname), __entry->version,
  78. __get_str(procname), __entry->async ? "a": ""
  79. )
  80. );
  81. DECLARE_EVENT_CLASS(rpc_task_running,
  82. TP_PROTO(const struct rpc_task *task, const void *action),
  83. TP_ARGS(task, action),
  84. TP_STRUCT__entry(
  85. __field(unsigned int, task_id)
  86. __field(unsigned int, client_id)
  87. __field(const void *, action)
  88. __field(unsigned long, runstate)
  89. __field(int, status)
  90. __field(unsigned short, flags)
  91. ),
  92. TP_fast_assign(
  93. __entry->client_id = task->tk_client ?
  94. task->tk_client->cl_clid : -1;
  95. __entry->task_id = task->tk_pid;
  96. __entry->action = action;
  97. __entry->runstate = task->tk_runstate;
  98. __entry->status = task->tk_status;
  99. __entry->flags = task->tk_flags;
  100. ),
  101. TP_printk("task:%u@%d flags=%4.4x state=%4.4lx status=%d action=%pf",
  102. __entry->task_id, __entry->client_id,
  103. __entry->flags,
  104. __entry->runstate,
  105. __entry->status,
  106. __entry->action
  107. )
  108. );
  109. DEFINE_EVENT(rpc_task_running, rpc_task_begin,
  110. TP_PROTO(const struct rpc_task *task, const void *action),
  111. TP_ARGS(task, action)
  112. );
  113. DEFINE_EVENT(rpc_task_running, rpc_task_run_action,
  114. TP_PROTO(const struct rpc_task *task, const void *action),
  115. TP_ARGS(task, action)
  116. );
  117. DEFINE_EVENT(rpc_task_running, rpc_task_complete,
  118. TP_PROTO(const struct rpc_task *task, const void *action),
  119. TP_ARGS(task, action)
  120. );
  121. DECLARE_EVENT_CLASS(rpc_task_queued,
  122. TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
  123. TP_ARGS(task, q),
  124. TP_STRUCT__entry(
  125. __field(unsigned int, task_id)
  126. __field(unsigned int, client_id)
  127. __field(unsigned long, timeout)
  128. __field(unsigned long, runstate)
  129. __field(int, status)
  130. __field(unsigned short, flags)
  131. __string(q_name, rpc_qname(q))
  132. ),
  133. TP_fast_assign(
  134. __entry->client_id = task->tk_client ?
  135. task->tk_client->cl_clid : -1;
  136. __entry->task_id = task->tk_pid;
  137. __entry->timeout = task->tk_timeout;
  138. __entry->runstate = task->tk_runstate;
  139. __entry->status = task->tk_status;
  140. __entry->flags = task->tk_flags;
  141. __assign_str(q_name, rpc_qname(q));
  142. ),
  143. TP_printk("task:%u@%d flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s",
  144. __entry->task_id, __entry->client_id,
  145. __entry->flags,
  146. __entry->runstate,
  147. __entry->status,
  148. __entry->timeout,
  149. __get_str(q_name)
  150. )
  151. );
  152. DEFINE_EVENT(rpc_task_queued, rpc_task_sleep,
  153. TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
  154. TP_ARGS(task, q)
  155. );
  156. DEFINE_EVENT(rpc_task_queued, rpc_task_wakeup,
  157. TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
  158. TP_ARGS(task, q)
  159. );
  160. TRACE_EVENT(rpc_stats_latency,
  161. TP_PROTO(
  162. const struct rpc_task *task,
  163. ktime_t backlog,
  164. ktime_t rtt,
  165. ktime_t execute
  166. ),
  167. TP_ARGS(task, backlog, rtt, execute),
  168. TP_STRUCT__entry(
  169. __field(unsigned int, task_id)
  170. __field(unsigned int, client_id)
  171. __field(u32, xid)
  172. __field(int, version)
  173. __string(progname, task->tk_client->cl_program->name)
  174. __string(procname, rpc_proc_name(task))
  175. __field(unsigned long, backlog)
  176. __field(unsigned long, rtt)
  177. __field(unsigned long, execute)
  178. ),
  179. TP_fast_assign(
  180. __entry->client_id = task->tk_client->cl_clid;
  181. __entry->task_id = task->tk_pid;
  182. __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
  183. __entry->version = task->tk_client->cl_vers;
  184. __assign_str(progname, task->tk_client->cl_program->name)
  185. __assign_str(procname, rpc_proc_name(task))
  186. __entry->backlog = ktime_to_us(backlog);
  187. __entry->rtt = ktime_to_us(rtt);
  188. __entry->execute = ktime_to_us(execute);
  189. ),
  190. TP_printk("task:%u@%d xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu",
  191. __entry->task_id, __entry->client_id, __entry->xid,
  192. __get_str(progname), __entry->version, __get_str(procname),
  193. __entry->backlog, __entry->rtt, __entry->execute)
  194. );
  195. /*
  196. * First define the enums in the below macros to be exported to userspace
  197. * via TRACE_DEFINE_ENUM().
  198. */
  199. #undef EM
  200. #undef EMe
  201. #define EM(a, b) TRACE_DEFINE_ENUM(a);
  202. #define EMe(a, b) TRACE_DEFINE_ENUM(a);
  203. #define RPC_SHOW_SOCKET \
  204. EM( SS_FREE, "FREE" ) \
  205. EM( SS_UNCONNECTED, "UNCONNECTED" ) \
  206. EM( SS_CONNECTING, "CONNECTING," ) \
  207. EM( SS_CONNECTED, "CONNECTED," ) \
  208. EMe(SS_DISCONNECTING, "DISCONNECTING" )
  209. #define rpc_show_socket_state(state) \
  210. __print_symbolic(state, RPC_SHOW_SOCKET)
  211. RPC_SHOW_SOCKET
  212. #define RPC_SHOW_SOCK \
  213. EM( TCP_ESTABLISHED, "ESTABLISHED" ) \
  214. EM( TCP_SYN_SENT, "SYN_SENT" ) \
  215. EM( TCP_SYN_RECV, "SYN_RECV" ) \
  216. EM( TCP_FIN_WAIT1, "FIN_WAIT1" ) \
  217. EM( TCP_FIN_WAIT2, "FIN_WAIT2" ) \
  218. EM( TCP_TIME_WAIT, "TIME_WAIT" ) \
  219. EM( TCP_CLOSE, "CLOSE" ) \
  220. EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" ) \
  221. EM( TCP_LAST_ACK, "LAST_ACK" ) \
  222. EM( TCP_LISTEN, "LISTEN" ) \
  223. EMe( TCP_CLOSING, "CLOSING" )
  224. #define rpc_show_sock_state(state) \
  225. __print_symbolic(state, RPC_SHOW_SOCK)
  226. RPC_SHOW_SOCK
  227. /*
  228. * Now redefine the EM() and EMe() macros to map the enums to the strings
  229. * that will be printed in the output.
  230. */
  231. #undef EM
  232. #undef EMe
  233. #define EM(a, b) {a, b},
  234. #define EMe(a, b) {a, b}
  235. DECLARE_EVENT_CLASS(xs_socket_event,
  236. TP_PROTO(
  237. struct rpc_xprt *xprt,
  238. struct socket *socket
  239. ),
  240. TP_ARGS(xprt, socket),
  241. TP_STRUCT__entry(
  242. __field(unsigned int, socket_state)
  243. __field(unsigned int, sock_state)
  244. __field(unsigned long long, ino)
  245. __string(dstaddr,
  246. xprt->address_strings[RPC_DISPLAY_ADDR])
  247. __string(dstport,
  248. xprt->address_strings[RPC_DISPLAY_PORT])
  249. ),
  250. TP_fast_assign(
  251. struct inode *inode = SOCK_INODE(socket);
  252. __entry->socket_state = socket->state;
  253. __entry->sock_state = socket->sk->sk_state;
  254. __entry->ino = (unsigned long long)inode->i_ino;
  255. __assign_str(dstaddr,
  256. xprt->address_strings[RPC_DISPLAY_ADDR]);
  257. __assign_str(dstport,
  258. xprt->address_strings[RPC_DISPLAY_PORT]);
  259. ),
  260. TP_printk(
  261. "socket:[%llu] dstaddr=%s/%s "
  262. "state=%u (%s) sk_state=%u (%s)",
  263. __entry->ino, __get_str(dstaddr), __get_str(dstport),
  264. __entry->socket_state,
  265. rpc_show_socket_state(__entry->socket_state),
  266. __entry->sock_state,
  267. rpc_show_sock_state(__entry->sock_state)
  268. )
  269. );
  270. #define DEFINE_RPC_SOCKET_EVENT(name) \
  271. DEFINE_EVENT(xs_socket_event, name, \
  272. TP_PROTO( \
  273. struct rpc_xprt *xprt, \
  274. struct socket *socket \
  275. ), \
  276. TP_ARGS(xprt, socket))
  277. DECLARE_EVENT_CLASS(xs_socket_event_done,
  278. TP_PROTO(
  279. struct rpc_xprt *xprt,
  280. struct socket *socket,
  281. int error
  282. ),
  283. TP_ARGS(xprt, socket, error),
  284. TP_STRUCT__entry(
  285. __field(int, error)
  286. __field(unsigned int, socket_state)
  287. __field(unsigned int, sock_state)
  288. __field(unsigned long long, ino)
  289. __string(dstaddr,
  290. xprt->address_strings[RPC_DISPLAY_ADDR])
  291. __string(dstport,
  292. xprt->address_strings[RPC_DISPLAY_PORT])
  293. ),
  294. TP_fast_assign(
  295. struct inode *inode = SOCK_INODE(socket);
  296. __entry->socket_state = socket->state;
  297. __entry->sock_state = socket->sk->sk_state;
  298. __entry->ino = (unsigned long long)inode->i_ino;
  299. __entry->error = error;
  300. __assign_str(dstaddr,
  301. xprt->address_strings[RPC_DISPLAY_ADDR]);
  302. __assign_str(dstport,
  303. xprt->address_strings[RPC_DISPLAY_PORT]);
  304. ),
  305. TP_printk(
  306. "error=%d socket:[%llu] dstaddr=%s/%s "
  307. "state=%u (%s) sk_state=%u (%s)",
  308. __entry->error,
  309. __entry->ino, __get_str(dstaddr), __get_str(dstport),
  310. __entry->socket_state,
  311. rpc_show_socket_state(__entry->socket_state),
  312. __entry->sock_state,
  313. rpc_show_sock_state(__entry->sock_state)
  314. )
  315. );
  316. #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
  317. DEFINE_EVENT(xs_socket_event_done, name, \
  318. TP_PROTO( \
  319. struct rpc_xprt *xprt, \
  320. struct socket *socket, \
  321. int error \
  322. ), \
  323. TP_ARGS(xprt, socket, error))
  324. DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change);
  325. DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect);
  326. DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error);
  327. DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
  328. DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
  329. DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
  330. DECLARE_EVENT_CLASS(rpc_xprt_event,
  331. TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
  332. TP_ARGS(xprt, xid, status),
  333. TP_STRUCT__entry(
  334. __field(u32, xid)
  335. __field(int, status)
  336. __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
  337. __string(port, xprt->address_strings[RPC_DISPLAY_PORT])
  338. ),
  339. TP_fast_assign(
  340. __entry->xid = be32_to_cpu(xid);
  341. __entry->status = status;
  342. __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
  343. __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
  344. ),
  345. TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr),
  346. __get_str(port), __entry->xid,
  347. __entry->status)
  348. );
  349. DEFINE_EVENT(rpc_xprt_event, xprt_timer,
  350. TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
  351. TP_ARGS(xprt, xid, status));
  352. DEFINE_EVENT(rpc_xprt_event, xprt_lookup_rqst,
  353. TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
  354. TP_ARGS(xprt, xid, status));
  355. DEFINE_EVENT(rpc_xprt_event, xprt_transmit,
  356. TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
  357. TP_ARGS(xprt, xid, status));
  358. DEFINE_EVENT(rpc_xprt_event, xprt_complete_rqst,
  359. TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
  360. TP_ARGS(xprt, xid, status));
  361. TRACE_EVENT(xprt_ping,
  362. TP_PROTO(const struct rpc_xprt *xprt, int status),
  363. TP_ARGS(xprt, status),
  364. TP_STRUCT__entry(
  365. __field(int, status)
  366. __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
  367. __string(port, xprt->address_strings[RPC_DISPLAY_PORT])
  368. ),
  369. TP_fast_assign(
  370. __entry->status = status;
  371. __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
  372. __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
  373. ),
  374. TP_printk("peer=[%s]:%s status=%d",
  375. __get_str(addr), __get_str(port), __entry->status)
  376. );
  377. TRACE_EVENT(xs_tcp_data_ready,
  378. TP_PROTO(struct rpc_xprt *xprt, int err, unsigned int total),
  379. TP_ARGS(xprt, err, total),
  380. TP_STRUCT__entry(
  381. __field(int, err)
  382. __field(unsigned int, total)
  383. __string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] :
  384. "(null)")
  385. __string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] :
  386. "(null)")
  387. ),
  388. TP_fast_assign(
  389. __entry->err = err;
  390. __entry->total = total;
  391. __assign_str(addr, xprt ?
  392. xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)");
  393. __assign_str(port, xprt ?
  394. xprt->address_strings[RPC_DISPLAY_PORT] : "(null)");
  395. ),
  396. TP_printk("peer=[%s]:%s err=%d total=%u", __get_str(addr),
  397. __get_str(port), __entry->err, __entry->total)
  398. );
  399. #define rpc_show_sock_xprt_flags(flags) \
  400. __print_flags(flags, "|", \
  401. { TCP_RCV_LAST_FRAG, "TCP_RCV_LAST_FRAG" }, \
  402. { TCP_RCV_COPY_FRAGHDR, "TCP_RCV_COPY_FRAGHDR" }, \
  403. { TCP_RCV_COPY_XID, "TCP_RCV_COPY_XID" }, \
  404. { TCP_RCV_COPY_DATA, "TCP_RCV_COPY_DATA" }, \
  405. { TCP_RCV_READ_CALLDIR, "TCP_RCV_READ_CALLDIR" }, \
  406. { TCP_RCV_COPY_CALLDIR, "TCP_RCV_COPY_CALLDIR" }, \
  407. { TCP_RPC_REPLY, "TCP_RPC_REPLY" })
  408. TRACE_EVENT(xs_tcp_data_recv,
  409. TP_PROTO(struct sock_xprt *xs),
  410. TP_ARGS(xs),
  411. TP_STRUCT__entry(
  412. __string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR])
  413. __string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT])
  414. __field(u32, xid)
  415. __field(unsigned long, flags)
  416. __field(unsigned long, copied)
  417. __field(unsigned int, reclen)
  418. __field(unsigned long, offset)
  419. ),
  420. TP_fast_assign(
  421. __assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]);
  422. __assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]);
  423. __entry->xid = be32_to_cpu(xs->tcp_xid);
  424. __entry->flags = xs->tcp_flags;
  425. __entry->copied = xs->tcp_copied;
  426. __entry->reclen = xs->tcp_reclen;
  427. __entry->offset = xs->tcp_offset;
  428. ),
  429. TP_printk("peer=[%s]:%s xid=0x%08x flags=%s copied=%lu reclen=%u offset=%lu",
  430. __get_str(addr), __get_str(port), __entry->xid,
  431. rpc_show_sock_xprt_flags(__entry->flags),
  432. __entry->copied, __entry->reclen, __entry->offset)
  433. );
  434. #define show_rqstp_flags(flags) \
  435. __print_flags(flags, "|", \
  436. { (1UL << RQ_SECURE), "RQ_SECURE"}, \
  437. { (1UL << RQ_LOCAL), "RQ_LOCAL"}, \
  438. { (1UL << RQ_USEDEFERRAL), "RQ_USEDEFERRAL"}, \
  439. { (1UL << RQ_DROPME), "RQ_DROPME"}, \
  440. { (1UL << RQ_SPLICE_OK), "RQ_SPLICE_OK"}, \
  441. { (1UL << RQ_VICTIM), "RQ_VICTIM"}, \
  442. { (1UL << RQ_BUSY), "RQ_BUSY"})
  443. TRACE_EVENT(svc_recv,
  444. TP_PROTO(struct svc_rqst *rqst, int len),
  445. TP_ARGS(rqst, len),
  446. TP_STRUCT__entry(
  447. __field(u32, xid)
  448. __field(int, len)
  449. __field(unsigned long, flags)
  450. __string(addr, rqst->rq_xprt->xpt_remotebuf)
  451. ),
  452. TP_fast_assign(
  453. __entry->xid = be32_to_cpu(rqst->rq_xid);
  454. __entry->len = len;
  455. __entry->flags = rqst->rq_flags;
  456. __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
  457. ),
  458. TP_printk("addr=%s xid=0x%08x len=%d flags=%s",
  459. __get_str(addr), __entry->xid, __entry->len,
  460. show_rqstp_flags(__entry->flags))
  461. );
  462. TRACE_EVENT(svc_process,
  463. TP_PROTO(const struct svc_rqst *rqst, const char *name),
  464. TP_ARGS(rqst, name),
  465. TP_STRUCT__entry(
  466. __field(u32, xid)
  467. __field(u32, vers)
  468. __field(u32, proc)
  469. __string(service, name)
  470. __string(addr, rqst->rq_xprt ?
  471. rqst->rq_xprt->xpt_remotebuf : "(null)")
  472. ),
  473. TP_fast_assign(
  474. __entry->xid = be32_to_cpu(rqst->rq_xid);
  475. __entry->vers = rqst->rq_vers;
  476. __entry->proc = rqst->rq_proc;
  477. __assign_str(service, name);
  478. __assign_str(addr, rqst->rq_xprt ?
  479. rqst->rq_xprt->xpt_remotebuf : "(null)");
  480. ),
  481. TP_printk("addr=%s xid=0x%08x service=%s vers=%u proc=%u",
  482. __get_str(addr), __entry->xid,
  483. __get_str(service), __entry->vers, __entry->proc)
  484. );
  485. DECLARE_EVENT_CLASS(svc_rqst_event,
  486. TP_PROTO(struct svc_rqst *rqst),
  487. TP_ARGS(rqst),
  488. TP_STRUCT__entry(
  489. __field(u32, xid)
  490. __field(unsigned long, flags)
  491. __string(addr, rqst->rq_xprt->xpt_remotebuf)
  492. ),
  493. TP_fast_assign(
  494. __entry->xid = be32_to_cpu(rqst->rq_xid);
  495. __entry->flags = rqst->rq_flags;
  496. __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
  497. ),
  498. TP_printk("addr=%s xid=0x%08x flags=%s",
  499. __get_str(addr), __entry->xid,
  500. show_rqstp_flags(__entry->flags))
  501. );
  502. DEFINE_EVENT(svc_rqst_event, svc_defer,
  503. TP_PROTO(struct svc_rqst *rqst),
  504. TP_ARGS(rqst));
  505. DEFINE_EVENT(svc_rqst_event, svc_drop,
  506. TP_PROTO(struct svc_rqst *rqst),
  507. TP_ARGS(rqst));
  508. DECLARE_EVENT_CLASS(svc_rqst_status,
  509. TP_PROTO(struct svc_rqst *rqst, int status),
  510. TP_ARGS(rqst, status),
  511. TP_STRUCT__entry(
  512. __field(u32, xid)
  513. __field(int, status)
  514. __field(unsigned long, flags)
  515. __string(addr, rqst->rq_xprt->xpt_remotebuf)
  516. ),
  517. TP_fast_assign(
  518. __entry->xid = be32_to_cpu(rqst->rq_xid);
  519. __entry->status = status;
  520. __entry->flags = rqst->rq_flags;
  521. __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
  522. ),
  523. TP_printk("addr=%s xid=0x%08x status=%d flags=%s",
  524. __get_str(addr), __entry->xid,
  525. __entry->status, show_rqstp_flags(__entry->flags))
  526. );
  527. DEFINE_EVENT(svc_rqst_status, svc_send,
  528. TP_PROTO(struct svc_rqst *rqst, int status),
  529. TP_ARGS(rqst, status));
  530. #define show_svc_xprt_flags(flags) \
  531. __print_flags(flags, "|", \
  532. { (1UL << XPT_BUSY), "XPT_BUSY"}, \
  533. { (1UL << XPT_CONN), "XPT_CONN"}, \
  534. { (1UL << XPT_CLOSE), "XPT_CLOSE"}, \
  535. { (1UL << XPT_DATA), "XPT_DATA"}, \
  536. { (1UL << XPT_TEMP), "XPT_TEMP"}, \
  537. { (1UL << XPT_DEAD), "XPT_DEAD"}, \
  538. { (1UL << XPT_CHNGBUF), "XPT_CHNGBUF"}, \
  539. { (1UL << XPT_DEFERRED), "XPT_DEFERRED"}, \
  540. { (1UL << XPT_OLD), "XPT_OLD"}, \
  541. { (1UL << XPT_LISTENER), "XPT_LISTENER"}, \
  542. { (1UL << XPT_CACHE_AUTH), "XPT_CACHE_AUTH"}, \
  543. { (1UL << XPT_LOCAL), "XPT_LOCAL"}, \
  544. { (1UL << XPT_KILL_TEMP), "XPT_KILL_TEMP"}, \
  545. { (1UL << XPT_CONG_CTRL), "XPT_CONG_CTRL"})
  546. TRACE_EVENT(svc_xprt_do_enqueue,
  547. TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst),
  548. TP_ARGS(xprt, rqst),
  549. TP_STRUCT__entry(
  550. __field(struct svc_xprt *, xprt)
  551. __field(int, pid)
  552. __field(unsigned long, flags)
  553. __string(addr, xprt->xpt_remotebuf)
  554. ),
  555. TP_fast_assign(
  556. __entry->xprt = xprt;
  557. __entry->pid = rqst? rqst->rq_task->pid : 0;
  558. __entry->flags = xprt->xpt_flags;
  559. __assign_str(addr, xprt->xpt_remotebuf);
  560. ),
  561. TP_printk("xprt=%p addr=%s pid=%d flags=%s",
  562. __entry->xprt, __get_str(addr),
  563. __entry->pid, show_svc_xprt_flags(__entry->flags))
  564. );
  565. DECLARE_EVENT_CLASS(svc_xprt_event,
  566. TP_PROTO(struct svc_xprt *xprt),
  567. TP_ARGS(xprt),
  568. TP_STRUCT__entry(
  569. __field(struct svc_xprt *, xprt)
  570. __field(unsigned long, flags)
  571. __string(addr, xprt->xpt_remotebuf)
  572. ),
  573. TP_fast_assign(
  574. __entry->xprt = xprt;
  575. __entry->flags = xprt->xpt_flags;
  576. __assign_str(addr, xprt->xpt_remotebuf);
  577. ),
  578. TP_printk("xprt=%p addr=%s flags=%s",
  579. __entry->xprt, __get_str(addr),
  580. show_svc_xprt_flags(__entry->flags))
  581. );
  582. DEFINE_EVENT(svc_xprt_event, svc_xprt_no_write_space,
  583. TP_PROTO(struct svc_xprt *xprt),
  584. TP_ARGS(xprt));
  585. TRACE_EVENT(svc_xprt_dequeue,
  586. TP_PROTO(struct svc_rqst *rqst),
  587. TP_ARGS(rqst),
  588. TP_STRUCT__entry(
  589. __field(struct svc_xprt *, xprt)
  590. __field(unsigned long, flags)
  591. __field(unsigned long, wakeup)
  592. __string(addr, rqst->rq_xprt->xpt_remotebuf)
  593. ),
  594. TP_fast_assign(
  595. __entry->xprt = rqst->rq_xprt;
  596. __entry->flags = rqst->rq_xprt->xpt_flags;
  597. __entry->wakeup = ktime_to_us(ktime_sub(ktime_get(),
  598. rqst->rq_qtime));
  599. __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
  600. ),
  601. TP_printk("xprt=%p addr=%s flags=%s wakeup-us=%lu",
  602. __entry->xprt, __get_str(addr),
  603. show_svc_xprt_flags(__entry->flags),
  604. __entry->wakeup)
  605. );
  606. TRACE_EVENT(svc_wake_up,
  607. TP_PROTO(int pid),
  608. TP_ARGS(pid),
  609. TP_STRUCT__entry(
  610. __field(int, pid)
  611. ),
  612. TP_fast_assign(
  613. __entry->pid = pid;
  614. ),
  615. TP_printk("pid=%d", __entry->pid)
  616. );
  617. TRACE_EVENT(svc_handle_xprt,
  618. TP_PROTO(struct svc_xprt *xprt, int len),
  619. TP_ARGS(xprt, len),
  620. TP_STRUCT__entry(
  621. __field(struct svc_xprt *, xprt)
  622. __field(int, len)
  623. __field(unsigned long, flags)
  624. __string(addr, xprt->xpt_remotebuf)
  625. ),
  626. TP_fast_assign(
  627. __entry->xprt = xprt;
  628. __entry->len = len;
  629. __entry->flags = xprt->xpt_flags;
  630. __assign_str(addr, xprt->xpt_remotebuf);
  631. ),
  632. TP_printk("xprt=%p addr=%s len=%d flags=%s",
  633. __entry->xprt, __get_str(addr),
  634. __entry->len, show_svc_xprt_flags(__entry->flags))
  635. );
  636. TRACE_EVENT(svc_stats_latency,
  637. TP_PROTO(const struct svc_rqst *rqst),
  638. TP_ARGS(rqst),
  639. TP_STRUCT__entry(
  640. __field(u32, xid)
  641. __field(unsigned long, execute)
  642. __string(addr, rqst->rq_xprt->xpt_remotebuf)
  643. ),
  644. TP_fast_assign(
  645. __entry->xid = be32_to_cpu(rqst->rq_xid);
  646. __entry->execute = ktime_to_us(ktime_sub(ktime_get(),
  647. rqst->rq_stime));
  648. __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
  649. ),
  650. TP_printk("addr=%s xid=0x%08x execute-us=%lu",
  651. __get_str(addr), __entry->xid, __entry->execute)
  652. );
  653. DECLARE_EVENT_CLASS(svc_deferred_event,
  654. TP_PROTO(struct svc_deferred_req *dr),
  655. TP_ARGS(dr),
  656. TP_STRUCT__entry(
  657. __field(u32, xid)
  658. __string(addr, dr->xprt->xpt_remotebuf)
  659. ),
  660. TP_fast_assign(
  661. __entry->xid = be32_to_cpu(*(__be32 *)(dr->args +
  662. (dr->xprt_hlen>>2)));
  663. __assign_str(addr, dr->xprt->xpt_remotebuf);
  664. ),
  665. TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid)
  666. );
  667. DEFINE_EVENT(svc_deferred_event, svc_drop_deferred,
  668. TP_PROTO(struct svc_deferred_req *dr),
  669. TP_ARGS(dr));
  670. DEFINE_EVENT(svc_deferred_event, svc_revisit_deferred,
  671. TP_PROTO(struct svc_deferred_req *dr),
  672. TP_ARGS(dr));
  673. #endif /* _TRACE_SUNRPC_H */
  674. #include <trace/define_trace.h>