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