Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 1 | #undef TRACE_SYSTEM |
| 2 | #define TRACE_SYSTEM sunrpc |
| 3 | |
| 4 | #if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ) |
| 5 | #define _TRACE_SUNRPC_H |
| 6 | |
| 7 | #include <linux/sunrpc/sched.h> |
| 8 | #include <linux/sunrpc/clnt.h> |
Jeff Layton | 860a0d9 | 2014-10-28 14:24:12 -0400 | [diff] [blame^] | 9 | #include <linux/sunrpc/svc.h> |
Trond Myklebust | 40b5ea0 | 2013-09-04 12:16:23 -0400 | [diff] [blame] | 10 | #include <net/tcp_states.h> |
| 11 | #include <linux/net.h> |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 12 | #include <linux/tracepoint.h> |
| 13 | |
Steve Dickson | 5753cba | 2012-02-06 10:08:08 -0500 | [diff] [blame] | 14 | DECLARE_EVENT_CLASS(rpc_task_status, |
| 15 | |
| 16 | TP_PROTO(struct rpc_task *task), |
| 17 | |
| 18 | TP_ARGS(task), |
| 19 | |
| 20 | TP_STRUCT__entry( |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 21 | __field(unsigned int, task_id) |
| 22 | __field(unsigned int, client_id) |
Steve Dickson | 5753cba | 2012-02-06 10:08:08 -0500 | [diff] [blame] | 23 | __field(int, status) |
| 24 | ), |
| 25 | |
| 26 | TP_fast_assign( |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 27 | __entry->task_id = task->tk_pid; |
| 28 | __entry->client_id = task->tk_client->cl_clid; |
Steve Dickson | 5753cba | 2012-02-06 10:08:08 -0500 | [diff] [blame] | 29 | __entry->status = task->tk_status; |
| 30 | ), |
| 31 | |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 32 | TP_printk("task:%u@%u, status %d", |
| 33 | __entry->task_id, __entry->client_id, |
| 34 | __entry->status) |
Steve Dickson | 5753cba | 2012-02-06 10:08:08 -0500 | [diff] [blame] | 35 | ); |
| 36 | |
| 37 | DEFINE_EVENT(rpc_task_status, rpc_call_status, |
| 38 | TP_PROTO(struct rpc_task *task), |
| 39 | |
| 40 | TP_ARGS(task) |
| 41 | ); |
| 42 | |
| 43 | DEFINE_EVENT(rpc_task_status, rpc_bind_status, |
| 44 | TP_PROTO(struct rpc_task *task), |
| 45 | |
| 46 | TP_ARGS(task) |
| 47 | ); |
| 48 | |
| 49 | TRACE_EVENT(rpc_connect_status, |
| 50 | TP_PROTO(struct rpc_task *task, int status), |
| 51 | |
| 52 | TP_ARGS(task, status), |
| 53 | |
| 54 | TP_STRUCT__entry( |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 55 | __field(unsigned int, task_id) |
| 56 | __field(unsigned int, client_id) |
Steve Dickson | 5753cba | 2012-02-06 10:08:08 -0500 | [diff] [blame] | 57 | __field(int, status) |
| 58 | ), |
| 59 | |
| 60 | TP_fast_assign( |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 61 | __entry->task_id = task->tk_pid; |
| 62 | __entry->client_id = task->tk_client->cl_clid; |
Steve Dickson | 5753cba | 2012-02-06 10:08:08 -0500 | [diff] [blame] | 63 | __entry->status = status; |
| 64 | ), |
| 65 | |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 66 | TP_printk("task:%u@%u, status %d", |
| 67 | __entry->task_id, __entry->client_id, |
| 68 | __entry->status) |
Steve Dickson | 5753cba | 2012-02-06 10:08:08 -0500 | [diff] [blame] | 69 | ); |
| 70 | |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 71 | DECLARE_EVENT_CLASS(rpc_task_running, |
| 72 | |
| 73 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), |
| 74 | |
| 75 | TP_ARGS(clnt, task, action), |
| 76 | |
| 77 | TP_STRUCT__entry( |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 78 | __field(unsigned int, task_id) |
| 79 | __field(unsigned int, client_id) |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 80 | __field(const void *, action) |
| 81 | __field(unsigned long, runstate) |
| 82 | __field(int, status) |
| 83 | __field(unsigned short, flags) |
| 84 | ), |
| 85 | |
| 86 | TP_fast_assign( |
Ditang Chen | 2ca310f | 2014-03-07 13:27:57 +0800 | [diff] [blame] | 87 | __entry->client_id = clnt ? clnt->cl_clid : -1; |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 88 | __entry->task_id = task->tk_pid; |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 89 | __entry->action = action; |
| 90 | __entry->runstate = task->tk_runstate; |
| 91 | __entry->status = task->tk_status; |
| 92 | __entry->flags = task->tk_flags; |
| 93 | ), |
| 94 | |
Ditang Chen | 2ca310f | 2014-03-07 13:27:57 +0800 | [diff] [blame] | 95 | TP_printk("task:%u@%d flags=%4.4x state=%4.4lx status=%d action=%pf", |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 96 | __entry->task_id, __entry->client_id, |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 97 | __entry->flags, |
| 98 | __entry->runstate, |
| 99 | __entry->status, |
| 100 | __entry->action |
| 101 | ) |
| 102 | ); |
| 103 | |
| 104 | DEFINE_EVENT(rpc_task_running, rpc_task_begin, |
| 105 | |
| 106 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), |
| 107 | |
| 108 | TP_ARGS(clnt, task, action) |
| 109 | |
| 110 | ); |
| 111 | |
| 112 | DEFINE_EVENT(rpc_task_running, rpc_task_run_action, |
| 113 | |
| 114 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), |
| 115 | |
| 116 | TP_ARGS(clnt, task, action) |
| 117 | |
| 118 | ); |
| 119 | |
| 120 | DEFINE_EVENT(rpc_task_running, rpc_task_complete, |
| 121 | |
| 122 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action), |
| 123 | |
| 124 | TP_ARGS(clnt, task, action) |
| 125 | |
| 126 | ); |
| 127 | |
| 128 | DECLARE_EVENT_CLASS(rpc_task_queued, |
| 129 | |
| 130 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q), |
| 131 | |
| 132 | TP_ARGS(clnt, task, q), |
| 133 | |
| 134 | TP_STRUCT__entry( |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 135 | __field(unsigned int, task_id) |
| 136 | __field(unsigned int, client_id) |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 137 | __field(unsigned long, timeout) |
| 138 | __field(unsigned long, runstate) |
| 139 | __field(int, status) |
| 140 | __field(unsigned short, flags) |
Trond Myklebust | 85c0d24 | 2012-02-06 10:31:35 -0500 | [diff] [blame] | 141 | __string(q_name, rpc_qname(q)) |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 142 | ), |
| 143 | |
| 144 | TP_fast_assign( |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 145 | __entry->client_id = clnt->cl_clid; |
| 146 | __entry->task_id = task->tk_pid; |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 147 | __entry->timeout = task->tk_timeout; |
| 148 | __entry->runstate = task->tk_runstate; |
| 149 | __entry->status = task->tk_status; |
| 150 | __entry->flags = task->tk_flags; |
Trond Myklebust | 85c0d24 | 2012-02-06 10:31:35 -0500 | [diff] [blame] | 151 | __assign_str(q_name, rpc_qname(q)); |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 152 | ), |
| 153 | |
Trond Myklebust | 92cb6c5 | 2013-09-04 22:09:50 -0400 | [diff] [blame] | 154 | TP_printk("task:%u@%u flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s", |
| 155 | __entry->task_id, __entry->client_id, |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 156 | __entry->flags, |
| 157 | __entry->runstate, |
| 158 | __entry->status, |
| 159 | __entry->timeout, |
Trond Myklebust | 85c0d24 | 2012-02-06 10:31:35 -0500 | [diff] [blame] | 160 | __get_str(q_name) |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 161 | ) |
| 162 | ); |
| 163 | |
| 164 | DEFINE_EVENT(rpc_task_queued, rpc_task_sleep, |
| 165 | |
| 166 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q), |
| 167 | |
| 168 | TP_ARGS(clnt, task, q) |
| 169 | |
| 170 | ); |
| 171 | |
| 172 | DEFINE_EVENT(rpc_task_queued, rpc_task_wakeup, |
| 173 | |
| 174 | TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q), |
| 175 | |
| 176 | TP_ARGS(clnt, task, q) |
| 177 | |
| 178 | ); |
| 179 | |
Trond Myklebust | 40b5ea0 | 2013-09-04 12:16:23 -0400 | [diff] [blame] | 180 | #define rpc_show_socket_state(state) \ |
| 181 | __print_symbolic(state, \ |
| 182 | { SS_FREE, "FREE" }, \ |
| 183 | { SS_UNCONNECTED, "UNCONNECTED" }, \ |
| 184 | { SS_CONNECTING, "CONNECTING," }, \ |
| 185 | { SS_CONNECTED, "CONNECTED," }, \ |
| 186 | { SS_DISCONNECTING, "DISCONNECTING" }) |
| 187 | |
| 188 | #define rpc_show_sock_state(state) \ |
| 189 | __print_symbolic(state, \ |
| 190 | { TCP_ESTABLISHED, "ESTABLISHED" }, \ |
| 191 | { TCP_SYN_SENT, "SYN_SENT" }, \ |
| 192 | { TCP_SYN_RECV, "SYN_RECV" }, \ |
| 193 | { TCP_FIN_WAIT1, "FIN_WAIT1" }, \ |
| 194 | { TCP_FIN_WAIT2, "FIN_WAIT2" }, \ |
| 195 | { TCP_TIME_WAIT, "TIME_WAIT" }, \ |
| 196 | { TCP_CLOSE, "CLOSE" }, \ |
| 197 | { TCP_CLOSE_WAIT, "CLOSE_WAIT" }, \ |
| 198 | { TCP_LAST_ACK, "LAST_ACK" }, \ |
| 199 | { TCP_LISTEN, "LISTEN" }, \ |
| 200 | { TCP_CLOSING, "CLOSING" }) |
| 201 | |
| 202 | DECLARE_EVENT_CLASS(xs_socket_event, |
| 203 | |
| 204 | TP_PROTO( |
| 205 | struct rpc_xprt *xprt, |
| 206 | struct socket *socket |
| 207 | ), |
| 208 | |
| 209 | TP_ARGS(xprt, socket), |
| 210 | |
| 211 | TP_STRUCT__entry( |
| 212 | __field(unsigned int, socket_state) |
| 213 | __field(unsigned int, sock_state) |
| 214 | __field(unsigned long long, ino) |
| 215 | __string(dstaddr, |
| 216 | xprt->address_strings[RPC_DISPLAY_ADDR]) |
| 217 | __string(dstport, |
| 218 | xprt->address_strings[RPC_DISPLAY_PORT]) |
| 219 | ), |
| 220 | |
| 221 | TP_fast_assign( |
| 222 | struct inode *inode = SOCK_INODE(socket); |
| 223 | __entry->socket_state = socket->state; |
| 224 | __entry->sock_state = socket->sk->sk_state; |
| 225 | __entry->ino = (unsigned long long)inode->i_ino; |
| 226 | __assign_str(dstaddr, |
| 227 | xprt->address_strings[RPC_DISPLAY_ADDR]); |
| 228 | __assign_str(dstport, |
| 229 | xprt->address_strings[RPC_DISPLAY_PORT]); |
| 230 | ), |
| 231 | |
| 232 | TP_printk( |
| 233 | "socket:[%llu] dstaddr=%s/%s " |
| 234 | "state=%u (%s) sk_state=%u (%s)", |
| 235 | __entry->ino, __get_str(dstaddr), __get_str(dstport), |
| 236 | __entry->socket_state, |
| 237 | rpc_show_socket_state(__entry->socket_state), |
| 238 | __entry->sock_state, |
| 239 | rpc_show_sock_state(__entry->sock_state) |
| 240 | ) |
| 241 | ); |
| 242 | #define DEFINE_RPC_SOCKET_EVENT(name) \ |
| 243 | DEFINE_EVENT(xs_socket_event, name, \ |
| 244 | TP_PROTO( \ |
| 245 | struct rpc_xprt *xprt, \ |
| 246 | struct socket *socket \ |
| 247 | ), \ |
| 248 | TP_ARGS(xprt, socket)) |
| 249 | |
| 250 | DECLARE_EVENT_CLASS(xs_socket_event_done, |
| 251 | |
| 252 | TP_PROTO( |
| 253 | struct rpc_xprt *xprt, |
| 254 | struct socket *socket, |
| 255 | int error |
| 256 | ), |
| 257 | |
| 258 | TP_ARGS(xprt, socket, error), |
| 259 | |
| 260 | TP_STRUCT__entry( |
| 261 | __field(int, error) |
| 262 | __field(unsigned int, socket_state) |
| 263 | __field(unsigned int, sock_state) |
| 264 | __field(unsigned long long, ino) |
| 265 | __string(dstaddr, |
| 266 | xprt->address_strings[RPC_DISPLAY_ADDR]) |
| 267 | __string(dstport, |
| 268 | xprt->address_strings[RPC_DISPLAY_PORT]) |
| 269 | ), |
| 270 | |
| 271 | TP_fast_assign( |
| 272 | struct inode *inode = SOCK_INODE(socket); |
| 273 | __entry->socket_state = socket->state; |
| 274 | __entry->sock_state = socket->sk->sk_state; |
| 275 | __entry->ino = (unsigned long long)inode->i_ino; |
| 276 | __entry->error = error; |
| 277 | __assign_str(dstaddr, |
| 278 | xprt->address_strings[RPC_DISPLAY_ADDR]); |
| 279 | __assign_str(dstport, |
| 280 | xprt->address_strings[RPC_DISPLAY_PORT]); |
| 281 | ), |
| 282 | |
| 283 | TP_printk( |
| 284 | "error=%d socket:[%llu] dstaddr=%s/%s " |
| 285 | "state=%u (%s) sk_state=%u (%s)", |
| 286 | __entry->error, |
| 287 | __entry->ino, __get_str(dstaddr), __get_str(dstport), |
| 288 | __entry->socket_state, |
| 289 | rpc_show_socket_state(__entry->socket_state), |
| 290 | __entry->sock_state, |
| 291 | rpc_show_sock_state(__entry->sock_state) |
| 292 | ) |
| 293 | ); |
| 294 | #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \ |
| 295 | DEFINE_EVENT(xs_socket_event_done, name, \ |
| 296 | TP_PROTO( \ |
| 297 | struct rpc_xprt *xprt, \ |
| 298 | struct socket *socket, \ |
| 299 | int error \ |
| 300 | ), \ |
| 301 | TP_ARGS(xprt, socket, error)) |
| 302 | |
| 303 | DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change); |
| 304 | DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect); |
Trond Myklebust | e8353c76 | 2013-12-31 13:39:22 -0500 | [diff] [blame] | 305 | DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error); |
Trond Myklebust | 40b5ea0 | 2013-09-04 12:16:23 -0400 | [diff] [blame] | 306 | DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection); |
| 307 | DEFINE_RPC_SOCKET_EVENT(rpc_socket_close); |
| 308 | DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown); |
| 309 | |
Jeff Layton | 860a0d9 | 2014-10-28 14:24:12 -0400 | [diff] [blame^] | 310 | TRACE_EVENT(svc_recv, |
| 311 | TP_PROTO(struct svc_rqst *rqst, int status), |
| 312 | |
| 313 | TP_ARGS(rqst, status), |
| 314 | |
| 315 | TP_STRUCT__entry( |
| 316 | __field(struct sockaddr *, addr) |
| 317 | __field(__be32, xid) |
| 318 | __field(int, status) |
| 319 | ), |
| 320 | |
| 321 | TP_fast_assign( |
| 322 | __entry->addr = (struct sockaddr *)&rqst->rq_addr; |
| 323 | __entry->xid = status > 0 ? rqst->rq_xid : 0; |
| 324 | __entry->status = status; |
| 325 | ), |
| 326 | |
| 327 | TP_printk("addr=%pIScp xid=0x%x status=%d", __entry->addr, |
| 328 | be32_to_cpu(__entry->xid), __entry->status) |
| 329 | ); |
| 330 | |
| 331 | DECLARE_EVENT_CLASS(svc_rqst_status, |
| 332 | |
| 333 | TP_PROTO(struct svc_rqst *rqst, int status), |
| 334 | |
| 335 | TP_ARGS(rqst, status), |
| 336 | |
| 337 | TP_STRUCT__entry( |
| 338 | __field(struct sockaddr *, addr) |
| 339 | __field(__be32, xid) |
| 340 | __field(int, dropme) |
| 341 | __field(int, status) |
| 342 | ), |
| 343 | |
| 344 | TP_fast_assign( |
| 345 | __entry->addr = (struct sockaddr *)&rqst->rq_addr; |
| 346 | __entry->xid = rqst->rq_xid; |
| 347 | __entry->dropme = (int)rqst->rq_dropme; |
| 348 | __entry->status = status; |
| 349 | ), |
| 350 | |
| 351 | TP_printk("addr=%pIScp rq_xid=0x%x dropme=%d status=%d", |
| 352 | __entry->addr, be32_to_cpu(__entry->xid), __entry->dropme, |
| 353 | __entry->status) |
| 354 | ); |
| 355 | |
| 356 | DEFINE_EVENT(svc_rqst_status, svc_process, |
| 357 | TP_PROTO(struct svc_rqst *rqst, int status), |
| 358 | TP_ARGS(rqst, status)); |
| 359 | |
| 360 | DEFINE_EVENT(svc_rqst_status, svc_send, |
| 361 | TP_PROTO(struct svc_rqst *rqst, int status), |
| 362 | TP_ARGS(rqst, status)); |
| 363 | |
Trond Myklebust | 82b0a4c | 2012-01-20 14:52:23 -0500 | [diff] [blame] | 364 | #endif /* _TRACE_SUNRPC_H */ |
| 365 | |
| 366 | #include <trace/define_trace.h> |