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(xdr_buf_class, 18 TP_PROTO( 19 const struct xdr_buf *xdr 20 ), 21 22 TP_ARGS(xdr), 23 24 TP_STRUCT__entry( 25 __field(const void *, head_base) 26 __field(size_t, head_len) 27 __field(const void *, tail_base) 28 __field(size_t, tail_len) 29 __field(unsigned int, page_len) 30 __field(unsigned int, msg_len) 31 ), 32 33 TP_fast_assign( 34 __entry->head_base = xdr->head[0].iov_base; 35 __entry->head_len = xdr->head[0].iov_len; 36 __entry->tail_base = xdr->tail[0].iov_base; 37 __entry->tail_len = xdr->tail[0].iov_len; 38 __entry->page_len = xdr->page_len; 39 __entry->msg_len = xdr->len; 40 ), 41 42 TP_printk("head=[%p,%zu] page=%u tail=[%p,%zu] len=%u", 43 __entry->head_base, __entry->head_len, __entry->page_len, 44 __entry->tail_base, __entry->tail_len, __entry->msg_len 45 ) 46 ); 47 48 #define DEFINE_XDRBUF_EVENT(name) \ 49 DEFINE_EVENT(xdr_buf_class, name, \ 50 TP_PROTO( \ 51 const struct xdr_buf *xdr \ 52 ), \ 53 TP_ARGS(xdr)) 54 55 DEFINE_XDRBUF_EVENT(xprt_sendto); 56 DEFINE_XDRBUF_EVENT(xprt_recvfrom); 57 DEFINE_XDRBUF_EVENT(svc_recvfrom); 58 DEFINE_XDRBUF_EVENT(svc_sendto); 59 60 TRACE_DEFINE_ENUM(RPC_AUTH_OK); 61 TRACE_DEFINE_ENUM(RPC_AUTH_BADCRED); 62 TRACE_DEFINE_ENUM(RPC_AUTH_REJECTEDCRED); 63 TRACE_DEFINE_ENUM(RPC_AUTH_BADVERF); 64 TRACE_DEFINE_ENUM(RPC_AUTH_REJECTEDVERF); 65 TRACE_DEFINE_ENUM(RPC_AUTH_TOOWEAK); 66 TRACE_DEFINE_ENUM(RPCSEC_GSS_CREDPROBLEM); 67 TRACE_DEFINE_ENUM(RPCSEC_GSS_CTXPROBLEM); 68 69 #define rpc_show_auth_stat(status) \ 70 __print_symbolic(status, \ 71 { RPC_AUTH_OK, "AUTH_OK" }, \ 72 { RPC_AUTH_BADCRED, "BADCRED" }, \ 73 { RPC_AUTH_REJECTEDCRED, "REJECTEDCRED" }, \ 74 { RPC_AUTH_BADVERF, "BADVERF" }, \ 75 { RPC_AUTH_REJECTEDVERF, "REJECTEDVERF" }, \ 76 { RPC_AUTH_TOOWEAK, "TOOWEAK" }, \ 77 { RPCSEC_GSS_CREDPROBLEM, "GSS_CREDPROBLEM" }, \ 78 { RPCSEC_GSS_CTXPROBLEM, "GSS_CTXPROBLEM" }) \ 79 80 DECLARE_EVENT_CLASS(rpc_task_status, 81 82 TP_PROTO(const struct rpc_task *task), 83 84 TP_ARGS(task), 85 86 TP_STRUCT__entry( 87 __field(unsigned int, task_id) 88 __field(unsigned int, client_id) 89 __field(int, status) 90 ), 91 92 TP_fast_assign( 93 __entry->task_id = task->tk_pid; 94 __entry->client_id = task->tk_client->cl_clid; 95 __entry->status = task->tk_status; 96 ), 97 98 TP_printk("task:%u@%u status=%d", 99 __entry->task_id, __entry->client_id, 100 __entry->status) 101 ); 102 #define DEFINE_RPC_STATUS_EVENT(name) \ 103 DEFINE_EVENT(rpc_task_status, rpc_##name##_status, \ 104 TP_PROTO( \ 105 const struct rpc_task *task \ 106 ), \ 107 TP_ARGS(task)) 108 109 DEFINE_RPC_STATUS_EVENT(call); 110 DEFINE_RPC_STATUS_EVENT(bind); 111 DEFINE_RPC_STATUS_EVENT(connect); 112 113 TRACE_EVENT(rpc_request, 114 TP_PROTO(const struct rpc_task *task), 115 116 TP_ARGS(task), 117 118 TP_STRUCT__entry( 119 __field(unsigned int, task_id) 120 __field(unsigned int, client_id) 121 __field(int, version) 122 __field(bool, async) 123 __string(progname, task->tk_client->cl_program->name) 124 __string(procname, rpc_proc_name(task)) 125 ), 126 127 TP_fast_assign( 128 __entry->task_id = task->tk_pid; 129 __entry->client_id = task->tk_client->cl_clid; 130 __entry->version = task->tk_client->cl_vers; 131 __entry->async = RPC_IS_ASYNC(task); 132 __assign_str(progname, task->tk_client->cl_program->name) 133 __assign_str(procname, rpc_proc_name(task)) 134 ), 135 136 TP_printk("task:%u@%u %sv%d %s (%ssync)", 137 __entry->task_id, __entry->client_id, 138 __get_str(progname), __entry->version, 139 __get_str(procname), __entry->async ? "a": "" 140 ) 141 ); 142 143 TRACE_DEFINE_ENUM(RPC_TASK_ASYNC); 144 TRACE_DEFINE_ENUM(RPC_TASK_SWAPPER); 145 TRACE_DEFINE_ENUM(RPC_CALL_MAJORSEEN); 146 TRACE_DEFINE_ENUM(RPC_TASK_ROOTCREDS); 147 TRACE_DEFINE_ENUM(RPC_TASK_DYNAMIC); 148 TRACE_DEFINE_ENUM(RPC_TASK_SOFT); 149 TRACE_DEFINE_ENUM(RPC_TASK_SOFTCONN); 150 TRACE_DEFINE_ENUM(RPC_TASK_SENT); 151 TRACE_DEFINE_ENUM(RPC_TASK_TIMEOUT); 152 TRACE_DEFINE_ENUM(RPC_TASK_NOCONNECT); 153 TRACE_DEFINE_ENUM(RPC_TASK_NO_RETRANS_TIMEOUT); 154 155 #define rpc_show_task_flags(flags) \ 156 __print_flags(flags, "|", \ 157 { RPC_TASK_ASYNC, "ASYNC" }, \ 158 { RPC_TASK_SWAPPER, "SWAPPER" }, \ 159 { RPC_CALL_MAJORSEEN, "MAJORSEEN" }, \ 160 { RPC_TASK_ROOTCREDS, "ROOTCREDS" }, \ 161 { RPC_TASK_DYNAMIC, "DYNAMIC" }, \ 162 { RPC_TASK_SOFT, "SOFT" }, \ 163 { RPC_TASK_SOFTCONN, "SOFTCONN" }, \ 164 { RPC_TASK_SENT, "SENT" }, \ 165 { RPC_TASK_TIMEOUT, "TIMEOUT" }, \ 166 { RPC_TASK_NOCONNECT, "NOCONNECT" }, \ 167 { RPC_TASK_NO_RETRANS_TIMEOUT, "NORTO" }) 168 169 TRACE_DEFINE_ENUM(RPC_TASK_RUNNING); 170 TRACE_DEFINE_ENUM(RPC_TASK_QUEUED); 171 TRACE_DEFINE_ENUM(RPC_TASK_ACTIVE); 172 TRACE_DEFINE_ENUM(RPC_TASK_NEED_XMIT); 173 TRACE_DEFINE_ENUM(RPC_TASK_NEED_RECV); 174 TRACE_DEFINE_ENUM(RPC_TASK_MSG_PIN_WAIT); 175 TRACE_DEFINE_ENUM(RPC_TASK_SIGNALLED); 176 177 #define rpc_show_runstate(flags) \ 178 __print_flags(flags, "|", \ 179 { (1UL << RPC_TASK_RUNNING), "RUNNING" }, \ 180 { (1UL << RPC_TASK_QUEUED), "QUEUED" }, \ 181 { (1UL << RPC_TASK_ACTIVE), "ACTIVE" }, \ 182 { (1UL << RPC_TASK_NEED_XMIT), "NEED_XMIT" }, \ 183 { (1UL << RPC_TASK_NEED_RECV), "NEED_RECV" }, \ 184 { (1UL << RPC_TASK_MSG_PIN_WAIT), "MSG_PIN_WAIT" }, \ 185 { (1UL << RPC_TASK_SIGNALLED), "SIGNALLED" }) 186 187 DECLARE_EVENT_CLASS(rpc_task_running, 188 189 TP_PROTO(const struct rpc_task *task, const void *action), 190 191 TP_ARGS(task, action), 192 193 TP_STRUCT__entry( 194 __field(unsigned int, task_id) 195 __field(unsigned int, client_id) 196 __field(const void *, action) 197 __field(unsigned long, runstate) 198 __field(int, status) 199 __field(unsigned short, flags) 200 ), 201 202 TP_fast_assign( 203 __entry->client_id = task->tk_client ? 204 task->tk_client->cl_clid : -1; 205 __entry->task_id = task->tk_pid; 206 __entry->action = action; 207 __entry->runstate = task->tk_runstate; 208 __entry->status = task->tk_status; 209 __entry->flags = task->tk_flags; 210 ), 211 212 TP_printk("task:%u@%d flags=%s runstate=%s status=%d action=%ps", 213 __entry->task_id, __entry->client_id, 214 rpc_show_task_flags(__entry->flags), 215 rpc_show_runstate(__entry->runstate), 216 __entry->status, 217 __entry->action 218 ) 219 ); 220 #define DEFINE_RPC_RUNNING_EVENT(name) \ 221 DEFINE_EVENT(rpc_task_running, rpc_task_##name, \ 222 TP_PROTO( \ 223 const struct rpc_task *task, \ 224 const void *action \ 225 ), \ 226 TP_ARGS(task, action)) 227 228 DEFINE_RPC_RUNNING_EVENT(begin); 229 DEFINE_RPC_RUNNING_EVENT(run_action); 230 DEFINE_RPC_RUNNING_EVENT(complete); 231 DEFINE_RPC_RUNNING_EVENT(signalled); 232 DEFINE_RPC_RUNNING_EVENT(end); 233 234 DECLARE_EVENT_CLASS(rpc_task_queued, 235 236 TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q), 237 238 TP_ARGS(task, q), 239 240 TP_STRUCT__entry( 241 __field(unsigned int, task_id) 242 __field(unsigned int, client_id) 243 __field(unsigned long, timeout) 244 __field(unsigned long, runstate) 245 __field(int, status) 246 __field(unsigned short, flags) 247 __string(q_name, rpc_qname(q)) 248 ), 249 250 TP_fast_assign( 251 __entry->client_id = task->tk_client ? 252 task->tk_client->cl_clid : -1; 253 __entry->task_id = task->tk_pid; 254 __entry->timeout = rpc_task_timeout(task); 255 __entry->runstate = task->tk_runstate; 256 __entry->status = task->tk_status; 257 __entry->flags = task->tk_flags; 258 __assign_str(q_name, rpc_qname(q)); 259 ), 260 261 TP_printk("task:%u@%d flags=%s runstate=%s status=%d timeout=%lu queue=%s", 262 __entry->task_id, __entry->client_id, 263 rpc_show_task_flags(__entry->flags), 264 rpc_show_runstate(__entry->runstate), 265 __entry->status, 266 __entry->timeout, 267 __get_str(q_name) 268 ) 269 ); 270 #define DEFINE_RPC_QUEUED_EVENT(name) \ 271 DEFINE_EVENT(rpc_task_queued, rpc_task_##name, \ 272 TP_PROTO( \ 273 const struct rpc_task *task, \ 274 const struct rpc_wait_queue *q \ 275 ), \ 276 TP_ARGS(task, q)) 277 278 DEFINE_RPC_QUEUED_EVENT(sleep); 279 DEFINE_RPC_QUEUED_EVENT(wakeup); 280 281 DECLARE_EVENT_CLASS(rpc_failure, 282 283 TP_PROTO(const struct rpc_task *task), 284 285 TP_ARGS(task), 286 287 TP_STRUCT__entry( 288 __field(unsigned int, task_id) 289 __field(unsigned int, client_id) 290 ), 291 292 TP_fast_assign( 293 __entry->task_id = task->tk_pid; 294 __entry->client_id = task->tk_client->cl_clid; 295 ), 296 297 TP_printk("task:%u@%u", 298 __entry->task_id, __entry->client_id) 299 ); 300 301 #define DEFINE_RPC_FAILURE(name) \ 302 DEFINE_EVENT(rpc_failure, rpc_bad_##name, \ 303 TP_PROTO( \ 304 const struct rpc_task *task \ 305 ), \ 306 TP_ARGS(task)) 307 308 DEFINE_RPC_FAILURE(callhdr); 309 DEFINE_RPC_FAILURE(verifier); 310 311 DECLARE_EVENT_CLASS(rpc_reply_event, 312 313 TP_PROTO( 314 const struct rpc_task *task 315 ), 316 317 TP_ARGS(task), 318 319 TP_STRUCT__entry( 320 __field(unsigned int, task_id) 321 __field(unsigned int, client_id) 322 __field(u32, xid) 323 __string(progname, task->tk_client->cl_program->name) 324 __field(u32, version) 325 __string(procname, rpc_proc_name(task)) 326 __string(servername, task->tk_xprt->servername) 327 ), 328 329 TP_fast_assign( 330 __entry->task_id = task->tk_pid; 331 __entry->client_id = task->tk_client->cl_clid; 332 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); 333 __assign_str(progname, task->tk_client->cl_program->name) 334 __entry->version = task->tk_client->cl_vers; 335 __assign_str(procname, rpc_proc_name(task)) 336 __assign_str(servername, task->tk_xprt->servername) 337 ), 338 339 TP_printk("task:%u@%d server=%s xid=0x%08x %sv%d %s", 340 __entry->task_id, __entry->client_id, __get_str(servername), 341 __entry->xid, __get_str(progname), __entry->version, 342 __get_str(procname)) 343 ) 344 345 #define DEFINE_RPC_REPLY_EVENT(name) \ 346 DEFINE_EVENT(rpc_reply_event, rpc__##name, \ 347 TP_PROTO( \ 348 const struct rpc_task *task \ 349 ), \ 350 TP_ARGS(task)) 351 352 DEFINE_RPC_REPLY_EVENT(prog_unavail); 353 DEFINE_RPC_REPLY_EVENT(prog_mismatch); 354 DEFINE_RPC_REPLY_EVENT(proc_unavail); 355 DEFINE_RPC_REPLY_EVENT(garbage_args); 356 DEFINE_RPC_REPLY_EVENT(unparsable); 357 DEFINE_RPC_REPLY_EVENT(mismatch); 358 DEFINE_RPC_REPLY_EVENT(stale_creds); 359 DEFINE_RPC_REPLY_EVENT(bad_creds); 360 DEFINE_RPC_REPLY_EVENT(auth_tooweak); 361 362 TRACE_EVENT(rpc_stats_latency, 363 364 TP_PROTO( 365 const struct rpc_task *task, 366 ktime_t backlog, 367 ktime_t rtt, 368 ktime_t execute 369 ), 370 371 TP_ARGS(task, backlog, rtt, execute), 372 373 TP_STRUCT__entry( 374 __field(unsigned int, task_id) 375 __field(unsigned int, client_id) 376 __field(u32, xid) 377 __field(int, version) 378 __string(progname, task->tk_client->cl_program->name) 379 __string(procname, rpc_proc_name(task)) 380 __field(unsigned long, backlog) 381 __field(unsigned long, rtt) 382 __field(unsigned long, execute) 383 ), 384 385 TP_fast_assign( 386 __entry->client_id = task->tk_client->cl_clid; 387 __entry->task_id = task->tk_pid; 388 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); 389 __entry->version = task->tk_client->cl_vers; 390 __assign_str(progname, task->tk_client->cl_program->name) 391 __assign_str(procname, rpc_proc_name(task)) 392 __entry->backlog = ktime_to_us(backlog); 393 __entry->rtt = ktime_to_us(rtt); 394 __entry->execute = ktime_to_us(execute); 395 ), 396 397 TP_printk("task:%u@%d xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu", 398 __entry->task_id, __entry->client_id, __entry->xid, 399 __get_str(progname), __entry->version, __get_str(procname), 400 __entry->backlog, __entry->rtt, __entry->execute) 401 ); 402 403 TRACE_EVENT(rpc_xdr_overflow, 404 TP_PROTO( 405 const struct xdr_stream *xdr, 406 size_t requested 407 ), 408 409 TP_ARGS(xdr, requested), 410 411 TP_STRUCT__entry( 412 __field(unsigned int, task_id) 413 __field(unsigned int, client_id) 414 __field(int, version) 415 __field(size_t, requested) 416 __field(const void *, end) 417 __field(const void *, p) 418 __field(const void *, head_base) 419 __field(size_t, head_len) 420 __field(const void *, tail_base) 421 __field(size_t, tail_len) 422 __field(unsigned int, page_len) 423 __field(unsigned int, len) 424 __string(progname, 425 xdr->rqst->rq_task->tk_client->cl_program->name) 426 __string(procedure, 427 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name) 428 ), 429 430 TP_fast_assign( 431 if (xdr->rqst) { 432 const struct rpc_task *task = xdr->rqst->rq_task; 433 434 __entry->task_id = task->tk_pid; 435 __entry->client_id = task->tk_client->cl_clid; 436 __assign_str(progname, 437 task->tk_client->cl_program->name) 438 __entry->version = task->tk_client->cl_vers; 439 __assign_str(procedure, task->tk_msg.rpc_proc->p_name) 440 } else { 441 __entry->task_id = 0; 442 __entry->client_id = 0; 443 __assign_str(progname, "unknown") 444 __entry->version = 0; 445 __assign_str(procedure, "unknown") 446 } 447 __entry->requested = requested; 448 __entry->end = xdr->end; 449 __entry->p = xdr->p; 450 __entry->head_base = xdr->buf->head[0].iov_base, 451 __entry->head_len = xdr->buf->head[0].iov_len, 452 __entry->page_len = xdr->buf->page_len, 453 __entry->tail_base = xdr->buf->tail[0].iov_base, 454 __entry->tail_len = xdr->buf->tail[0].iov_len, 455 __entry->len = xdr->buf->len; 456 ), 457 458 TP_printk( 459 "task:%u@%u %sv%d %s requested=%zu p=%p end=%p xdr=[%p,%zu]/%u/[%p,%zu]/%u\n", 460 __entry->task_id, __entry->client_id, 461 __get_str(progname), __entry->version, __get_str(procedure), 462 __entry->requested, __entry->p, __entry->end, 463 __entry->head_base, __entry->head_len, 464 __entry->page_len, 465 __entry->tail_base, __entry->tail_len, 466 __entry->len 467 ) 468 ); 469 470 TRACE_EVENT(rpc_xdr_alignment, 471 TP_PROTO( 472 const struct xdr_stream *xdr, 473 size_t offset, 474 unsigned int copied 475 ), 476 477 TP_ARGS(xdr, offset, copied), 478 479 TP_STRUCT__entry( 480 __field(unsigned int, task_id) 481 __field(unsigned int, client_id) 482 __field(int, version) 483 __field(size_t, offset) 484 __field(unsigned int, copied) 485 __field(const void *, head_base) 486 __field(size_t, head_len) 487 __field(const void *, tail_base) 488 __field(size_t, tail_len) 489 __field(unsigned int, page_len) 490 __field(unsigned int, len) 491 __string(progname, 492 xdr->rqst->rq_task->tk_client->cl_program->name) 493 __string(procedure, 494 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name) 495 ), 496 497 TP_fast_assign( 498 const struct rpc_task *task = xdr->rqst->rq_task; 499 500 __entry->task_id = task->tk_pid; 501 __entry->client_id = task->tk_client->cl_clid; 502 __assign_str(progname, 503 task->tk_client->cl_program->name) 504 __entry->version = task->tk_client->cl_vers; 505 __assign_str(procedure, task->tk_msg.rpc_proc->p_name) 506 507 __entry->offset = offset; 508 __entry->copied = copied; 509 __entry->head_base = xdr->buf->head[0].iov_base, 510 __entry->head_len = xdr->buf->head[0].iov_len, 511 __entry->page_len = xdr->buf->page_len, 512 __entry->tail_base = xdr->buf->tail[0].iov_base, 513 __entry->tail_len = xdr->buf->tail[0].iov_len, 514 __entry->len = xdr->buf->len; 515 ), 516 517 TP_printk( 518 "task:%u@%u %sv%d %s offset=%zu copied=%u xdr=[%p,%zu]/%u/[%p,%zu]/%u\n", 519 __entry->task_id, __entry->client_id, 520 __get_str(progname), __entry->version, __get_str(procedure), 521 __entry->offset, __entry->copied, 522 __entry->head_base, __entry->head_len, 523 __entry->page_len, 524 __entry->tail_base, __entry->tail_len, 525 __entry->len 526 ) 527 ); 528 529 TRACE_EVENT(rpc_reply_pages, 530 TP_PROTO( 531 const struct rpc_rqst *req 532 ), 533 534 TP_ARGS(req), 535 536 TP_STRUCT__entry( 537 __field(unsigned int, task_id) 538 __field(unsigned int, client_id) 539 __field(const void *, head_base) 540 __field(size_t, head_len) 541 __field(const void *, tail_base) 542 __field(size_t, tail_len) 543 __field(unsigned int, page_len) 544 ), 545 546 TP_fast_assign( 547 __entry->task_id = req->rq_task->tk_pid; 548 __entry->client_id = req->rq_task->tk_client->cl_clid; 549 550 __entry->head_base = req->rq_rcv_buf.head[0].iov_base; 551 __entry->head_len = req->rq_rcv_buf.head[0].iov_len; 552 __entry->page_len = req->rq_rcv_buf.page_len; 553 __entry->tail_base = req->rq_rcv_buf.tail[0].iov_base; 554 __entry->tail_len = req->rq_rcv_buf.tail[0].iov_len; 555 ), 556 557 TP_printk( 558 "task:%u@%u xdr=[%p,%zu]/%u/[%p,%zu]\n", 559 __entry->task_id, __entry->client_id, 560 __entry->head_base, __entry->head_len, 561 __entry->page_len, 562 __entry->tail_base, __entry->tail_len 563 ) 564 ); 565 566 /* 567 * First define the enums in the below macros to be exported to userspace 568 * via TRACE_DEFINE_ENUM(). 569 */ 570 #undef EM 571 #undef EMe 572 #define EM(a, b) TRACE_DEFINE_ENUM(a); 573 #define EMe(a, b) TRACE_DEFINE_ENUM(a); 574 575 #define RPC_SHOW_SOCKET \ 576 EM( SS_FREE, "FREE" ) \ 577 EM( SS_UNCONNECTED, "UNCONNECTED" ) \ 578 EM( SS_CONNECTING, "CONNECTING," ) \ 579 EM( SS_CONNECTED, "CONNECTED," ) \ 580 EMe(SS_DISCONNECTING, "DISCONNECTING" ) 581 582 #define rpc_show_socket_state(state) \ 583 __print_symbolic(state, RPC_SHOW_SOCKET) 584 585 RPC_SHOW_SOCKET 586 587 #define RPC_SHOW_SOCK \ 588 EM( TCP_ESTABLISHED, "ESTABLISHED" ) \ 589 EM( TCP_SYN_SENT, "SYN_SENT" ) \ 590 EM( TCP_SYN_RECV, "SYN_RECV" ) \ 591 EM( TCP_FIN_WAIT1, "FIN_WAIT1" ) \ 592 EM( TCP_FIN_WAIT2, "FIN_WAIT2" ) \ 593 EM( TCP_TIME_WAIT, "TIME_WAIT" ) \ 594 EM( TCP_CLOSE, "CLOSE" ) \ 595 EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" ) \ 596 EM( TCP_LAST_ACK, "LAST_ACK" ) \ 597 EM( TCP_LISTEN, "LISTEN" ) \ 598 EMe( TCP_CLOSING, "CLOSING" ) 599 600 #define rpc_show_sock_state(state) \ 601 __print_symbolic(state, RPC_SHOW_SOCK) 602 603 RPC_SHOW_SOCK 604 605 /* 606 * Now redefine the EM() and EMe() macros to map the enums to the strings 607 * that will be printed in the output. 608 */ 609 #undef EM 610 #undef EMe 611 #define EM(a, b) {a, b}, 612 #define EMe(a, b) {a, b} 613 614 DECLARE_EVENT_CLASS(xs_socket_event, 615 616 TP_PROTO( 617 struct rpc_xprt *xprt, 618 struct socket *socket 619 ), 620 621 TP_ARGS(xprt, socket), 622 623 TP_STRUCT__entry( 624 __field(unsigned int, socket_state) 625 __field(unsigned int, sock_state) 626 __field(unsigned long long, ino) 627 __string(dstaddr, 628 xprt->address_strings[RPC_DISPLAY_ADDR]) 629 __string(dstport, 630 xprt->address_strings[RPC_DISPLAY_PORT]) 631 ), 632 633 TP_fast_assign( 634 struct inode *inode = SOCK_INODE(socket); 635 __entry->socket_state = socket->state; 636 __entry->sock_state = socket->sk->sk_state; 637 __entry->ino = (unsigned long long)inode->i_ino; 638 __assign_str(dstaddr, 639 xprt->address_strings[RPC_DISPLAY_ADDR]); 640 __assign_str(dstport, 641 xprt->address_strings[RPC_DISPLAY_PORT]); 642 ), 643 644 TP_printk( 645 "socket:[%llu] dstaddr=%s/%s " 646 "state=%u (%s) sk_state=%u (%s)", 647 __entry->ino, __get_str(dstaddr), __get_str(dstport), 648 __entry->socket_state, 649 rpc_show_socket_state(__entry->socket_state), 650 __entry->sock_state, 651 rpc_show_sock_state(__entry->sock_state) 652 ) 653 ); 654 #define DEFINE_RPC_SOCKET_EVENT(name) \ 655 DEFINE_EVENT(xs_socket_event, name, \ 656 TP_PROTO( \ 657 struct rpc_xprt *xprt, \ 658 struct socket *socket \ 659 ), \ 660 TP_ARGS(xprt, socket)) 661 662 DECLARE_EVENT_CLASS(xs_socket_event_done, 663 664 TP_PROTO( 665 struct rpc_xprt *xprt, 666 struct socket *socket, 667 int error 668 ), 669 670 TP_ARGS(xprt, socket, error), 671 672 TP_STRUCT__entry( 673 __field(int, error) 674 __field(unsigned int, socket_state) 675 __field(unsigned int, sock_state) 676 __field(unsigned long long, ino) 677 __string(dstaddr, 678 xprt->address_strings[RPC_DISPLAY_ADDR]) 679 __string(dstport, 680 xprt->address_strings[RPC_DISPLAY_PORT]) 681 ), 682 683 TP_fast_assign( 684 struct inode *inode = SOCK_INODE(socket); 685 __entry->socket_state = socket->state; 686 __entry->sock_state = socket->sk->sk_state; 687 __entry->ino = (unsigned long long)inode->i_ino; 688 __entry->error = error; 689 __assign_str(dstaddr, 690 xprt->address_strings[RPC_DISPLAY_ADDR]); 691 __assign_str(dstport, 692 xprt->address_strings[RPC_DISPLAY_PORT]); 693 ), 694 695 TP_printk( 696 "error=%d socket:[%llu] dstaddr=%s/%s " 697 "state=%u (%s) sk_state=%u (%s)", 698 __entry->error, 699 __entry->ino, __get_str(dstaddr), __get_str(dstport), 700 __entry->socket_state, 701 rpc_show_socket_state(__entry->socket_state), 702 __entry->sock_state, 703 rpc_show_sock_state(__entry->sock_state) 704 ) 705 ); 706 #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \ 707 DEFINE_EVENT(xs_socket_event_done, name, \ 708 TP_PROTO( \ 709 struct rpc_xprt *xprt, \ 710 struct socket *socket, \ 711 int error \ 712 ), \ 713 TP_ARGS(xprt, socket, error)) 714 715 DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change); 716 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect); 717 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error); 718 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection); 719 DEFINE_RPC_SOCKET_EVENT(rpc_socket_close); 720 DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown); 721 722 DECLARE_EVENT_CLASS(rpc_xprt_event, 723 TP_PROTO( 724 const struct rpc_xprt *xprt, 725 __be32 xid, 726 int status 727 ), 728 729 TP_ARGS(xprt, xid, status), 730 731 TP_STRUCT__entry( 732 __field(u32, xid) 733 __field(int, status) 734 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR]) 735 __string(port, xprt->address_strings[RPC_DISPLAY_PORT]) 736 ), 737 738 TP_fast_assign( 739 __entry->xid = be32_to_cpu(xid); 740 __entry->status = status; 741 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]); 742 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]); 743 ), 744 745 TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr), 746 __get_str(port), __entry->xid, 747 __entry->status) 748 ); 749 #define DEFINE_RPC_XPRT_EVENT(name) \ 750 DEFINE_EVENT(rpc_xprt_event, xprt_##name, \ 751 TP_PROTO( \ 752 const struct rpc_xprt *xprt, \ 753 __be32 xid, \ 754 int status \ 755 ), \ 756 TP_ARGS(xprt, xid, status)) 757 758 DEFINE_RPC_XPRT_EVENT(timer); 759 DEFINE_RPC_XPRT_EVENT(lookup_rqst); 760 DEFINE_RPC_XPRT_EVENT(complete_rqst); 761 762 TRACE_EVENT(xprt_transmit, 763 TP_PROTO( 764 const struct rpc_rqst *rqst, 765 int status 766 ), 767 768 TP_ARGS(rqst, status), 769 770 TP_STRUCT__entry( 771 __field(unsigned int, task_id) 772 __field(unsigned int, client_id) 773 __field(u32, xid) 774 __field(u32, seqno) 775 __field(int, status) 776 ), 777 778 TP_fast_assign( 779 __entry->task_id = rqst->rq_task->tk_pid; 780 __entry->client_id = rqst->rq_task->tk_client ? 781 rqst->rq_task->tk_client->cl_clid : -1; 782 __entry->xid = be32_to_cpu(rqst->rq_xid); 783 __entry->seqno = rqst->rq_seqno; 784 __entry->status = status; 785 ), 786 787 TP_printk( 788 "task:%u@%u xid=0x%08x seqno=%u status=%d", 789 __entry->task_id, __entry->client_id, __entry->xid, 790 __entry->seqno, __entry->status) 791 ); 792 793 TRACE_EVENT(xprt_enq_xmit, 794 TP_PROTO( 795 const struct rpc_task *task, 796 int stage 797 ), 798 799 TP_ARGS(task, stage), 800 801 TP_STRUCT__entry( 802 __field(unsigned int, task_id) 803 __field(unsigned int, client_id) 804 __field(u32, xid) 805 __field(u32, seqno) 806 __field(int, stage) 807 ), 808 809 TP_fast_assign( 810 __entry->task_id = task->tk_pid; 811 __entry->client_id = task->tk_client ? 812 task->tk_client->cl_clid : -1; 813 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); 814 __entry->seqno = task->tk_rqstp->rq_seqno; 815 __entry->stage = stage; 816 ), 817 818 TP_printk( 819 "task:%u@%u xid=0x%08x seqno=%u stage=%d", 820 __entry->task_id, __entry->client_id, __entry->xid, 821 __entry->seqno, __entry->stage) 822 ); 823 824 TRACE_EVENT(xprt_ping, 825 TP_PROTO(const struct rpc_xprt *xprt, int status), 826 827 TP_ARGS(xprt, status), 828 829 TP_STRUCT__entry( 830 __field(int, status) 831 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR]) 832 __string(port, xprt->address_strings[RPC_DISPLAY_PORT]) 833 ), 834 835 TP_fast_assign( 836 __entry->status = status; 837 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]); 838 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]); 839 ), 840 841 TP_printk("peer=[%s]:%s status=%d", 842 __get_str(addr), __get_str(port), __entry->status) 843 ); 844 845 DECLARE_EVENT_CLASS(xprt_writelock_event, 846 TP_PROTO( 847 const struct rpc_xprt *xprt, const struct rpc_task *task 848 ), 849 850 TP_ARGS(xprt, task), 851 852 TP_STRUCT__entry( 853 __field(unsigned int, task_id) 854 __field(unsigned int, client_id) 855 __field(unsigned int, snd_task_id) 856 ), 857 858 TP_fast_assign( 859 if (task) { 860 __entry->task_id = task->tk_pid; 861 __entry->client_id = task->tk_client ? 862 task->tk_client->cl_clid : -1; 863 } else { 864 __entry->task_id = -1; 865 __entry->client_id = -1; 866 } 867 __entry->snd_task_id = xprt->snd_task ? 868 xprt->snd_task->tk_pid : -1; 869 ), 870 871 TP_printk("task:%u@%u snd_task:%u", 872 __entry->task_id, __entry->client_id, 873 __entry->snd_task_id) 874 ); 875 876 #define DEFINE_WRITELOCK_EVENT(name) \ 877 DEFINE_EVENT(xprt_writelock_event, xprt_##name, \ 878 TP_PROTO( \ 879 const struct rpc_xprt *xprt, \ 880 const struct rpc_task *task \ 881 ), \ 882 TP_ARGS(xprt, task)) 883 884 DEFINE_WRITELOCK_EVENT(reserve_xprt); 885 DEFINE_WRITELOCK_EVENT(release_xprt); 886 887 DECLARE_EVENT_CLASS(xprt_cong_event, 888 TP_PROTO( 889 const struct rpc_xprt *xprt, const struct rpc_task *task 890 ), 891 892 TP_ARGS(xprt, task), 893 894 TP_STRUCT__entry( 895 __field(unsigned int, task_id) 896 __field(unsigned int, client_id) 897 __field(unsigned int, snd_task_id) 898 __field(unsigned long, cong) 899 __field(unsigned long, cwnd) 900 __field(bool, wait) 901 ), 902 903 TP_fast_assign( 904 if (task) { 905 __entry->task_id = task->tk_pid; 906 __entry->client_id = task->tk_client ? 907 task->tk_client->cl_clid : -1; 908 } else { 909 __entry->task_id = -1; 910 __entry->client_id = -1; 911 } 912 __entry->snd_task_id = xprt->snd_task ? 913 xprt->snd_task->tk_pid : -1; 914 __entry->cong = xprt->cong; 915 __entry->cwnd = xprt->cwnd; 916 __entry->wait = test_bit(XPRT_CWND_WAIT, &xprt->state); 917 ), 918 919 TP_printk("task:%u@%u snd_task:%u cong=%lu cwnd=%lu%s", 920 __entry->task_id, __entry->client_id, 921 __entry->snd_task_id, __entry->cong, __entry->cwnd, 922 __entry->wait ? " (wait)" : "") 923 ); 924 925 #define DEFINE_CONG_EVENT(name) \ 926 DEFINE_EVENT(xprt_cong_event, xprt_##name, \ 927 TP_PROTO( \ 928 const struct rpc_xprt *xprt, \ 929 const struct rpc_task *task \ 930 ), \ 931 TP_ARGS(xprt, task)) 932 933 DEFINE_CONG_EVENT(reserve_cong); 934 DEFINE_CONG_EVENT(release_cong); 935 DEFINE_CONG_EVENT(get_cong); 936 DEFINE_CONG_EVENT(put_cong); 937 938 TRACE_EVENT(xs_stream_read_data, 939 TP_PROTO(struct rpc_xprt *xprt, ssize_t err, size_t total), 940 941 TP_ARGS(xprt, err, total), 942 943 TP_STRUCT__entry( 944 __field(ssize_t, err) 945 __field(size_t, total) 946 __string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] : 947 "(null)") 948 __string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] : 949 "(null)") 950 ), 951 952 TP_fast_assign( 953 __entry->err = err; 954 __entry->total = total; 955 __assign_str(addr, xprt ? 956 xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)"); 957 __assign_str(port, xprt ? 958 xprt->address_strings[RPC_DISPLAY_PORT] : "(null)"); 959 ), 960 961 TP_printk("peer=[%s]:%s err=%zd total=%zu", __get_str(addr), 962 __get_str(port), __entry->err, __entry->total) 963 ); 964 965 TRACE_EVENT(xs_stream_read_request, 966 TP_PROTO(struct sock_xprt *xs), 967 968 TP_ARGS(xs), 969 970 TP_STRUCT__entry( 971 __string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]) 972 __string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]) 973 __field(u32, xid) 974 __field(unsigned long, copied) 975 __field(unsigned int, reclen) 976 __field(unsigned int, offset) 977 ), 978 979 TP_fast_assign( 980 __assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]); 981 __assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]); 982 __entry->xid = be32_to_cpu(xs->recv.xid); 983 __entry->copied = xs->recv.copied; 984 __entry->reclen = xs->recv.len; 985 __entry->offset = xs->recv.offset; 986 ), 987 988 TP_printk("peer=[%s]:%s xid=0x%08x copied=%lu reclen=%u offset=%u", 989 __get_str(addr), __get_str(port), __entry->xid, 990 __entry->copied, __entry->reclen, __entry->offset) 991 ); 992 993 #define show_rqstp_flags(flags) \ 994 __print_flags(flags, "|", \ 995 { (1UL << RQ_SECURE), "RQ_SECURE"}, \ 996 { (1UL << RQ_LOCAL), "RQ_LOCAL"}, \ 997 { (1UL << RQ_USEDEFERRAL), "RQ_USEDEFERRAL"}, \ 998 { (1UL << RQ_DROPME), "RQ_DROPME"}, \ 999 { (1UL << RQ_SPLICE_OK), "RQ_SPLICE_OK"}, \ 1000 { (1UL << RQ_VICTIM), "RQ_VICTIM"}, \ 1001 { (1UL << RQ_BUSY), "RQ_BUSY"}) 1002 1003 TRACE_EVENT(svc_recv, 1004 TP_PROTO(struct svc_rqst *rqst, int len), 1005 1006 TP_ARGS(rqst, len), 1007 1008 TP_STRUCT__entry( 1009 __field(u32, xid) 1010 __field(int, len) 1011 __field(unsigned long, flags) 1012 __string(addr, rqst->rq_xprt->xpt_remotebuf) 1013 ), 1014 1015 TP_fast_assign( 1016 __entry->xid = be32_to_cpu(rqst->rq_xid); 1017 __entry->len = len; 1018 __entry->flags = rqst->rq_flags; 1019 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 1020 ), 1021 1022 TP_printk("addr=%s xid=0x%08x len=%d flags=%s", 1023 __get_str(addr), __entry->xid, __entry->len, 1024 show_rqstp_flags(__entry->flags)) 1025 ); 1026 1027 #define svc_show_status(status) \ 1028 __print_symbolic(status, \ 1029 { SVC_GARBAGE, "SVC_GARBAGE" }, \ 1030 { SVC_SYSERR, "SVC_SYSERR" }, \ 1031 { SVC_VALID, "SVC_VALID" }, \ 1032 { SVC_NEGATIVE, "SVC_NEGATIVE" }, \ 1033 { SVC_OK, "SVC_OK" }, \ 1034 { SVC_DROP, "SVC_DROP" }, \ 1035 { SVC_CLOSE, "SVC_CLOSE" }, \ 1036 { SVC_DENIED, "SVC_DENIED" }, \ 1037 { SVC_PENDING, "SVC_PENDING" }, \ 1038 { SVC_COMPLETE, "SVC_COMPLETE" }) 1039 1040 TRACE_EVENT(svc_authenticate, 1041 TP_PROTO(const struct svc_rqst *rqst, int auth_res, __be32 auth_stat), 1042 1043 TP_ARGS(rqst, auth_res, auth_stat), 1044 1045 TP_STRUCT__entry( 1046 __field(u32, xid) 1047 __field(unsigned long, svc_status) 1048 __field(unsigned long, auth_stat) 1049 ), 1050 1051 TP_fast_assign( 1052 __entry->xid = be32_to_cpu(rqst->rq_xid); 1053 __entry->svc_status = auth_res; 1054 __entry->auth_stat = be32_to_cpu(auth_stat); 1055 ), 1056 1057 TP_printk("xid=0x%08x auth_res=%s auth_stat=%s", 1058 __entry->xid, svc_show_status(__entry->svc_status), 1059 rpc_show_auth_stat(__entry->auth_stat)) 1060 ); 1061 1062 TRACE_EVENT(svc_process, 1063 TP_PROTO(const struct svc_rqst *rqst, const char *name), 1064 1065 TP_ARGS(rqst, name), 1066 1067 TP_STRUCT__entry( 1068 __field(u32, xid) 1069 __field(u32, vers) 1070 __field(u32, proc) 1071 __string(service, name) 1072 __string(addr, rqst->rq_xprt ? 1073 rqst->rq_xprt->xpt_remotebuf : "(null)") 1074 ), 1075 1076 TP_fast_assign( 1077 __entry->xid = be32_to_cpu(rqst->rq_xid); 1078 __entry->vers = rqst->rq_vers; 1079 __entry->proc = rqst->rq_proc; 1080 __assign_str(service, name); 1081 __assign_str(addr, rqst->rq_xprt ? 1082 rqst->rq_xprt->xpt_remotebuf : "(null)"); 1083 ), 1084 1085 TP_printk("addr=%s xid=0x%08x service=%s vers=%u proc=%u", 1086 __get_str(addr), __entry->xid, 1087 __get_str(service), __entry->vers, __entry->proc) 1088 ); 1089 1090 DECLARE_EVENT_CLASS(svc_rqst_event, 1091 1092 TP_PROTO( 1093 const struct svc_rqst *rqst 1094 ), 1095 1096 TP_ARGS(rqst), 1097 1098 TP_STRUCT__entry( 1099 __field(u32, xid) 1100 __field(unsigned long, flags) 1101 __string(addr, rqst->rq_xprt->xpt_remotebuf) 1102 ), 1103 1104 TP_fast_assign( 1105 __entry->xid = be32_to_cpu(rqst->rq_xid); 1106 __entry->flags = rqst->rq_flags; 1107 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 1108 ), 1109 1110 TP_printk("addr=%s xid=0x%08x flags=%s", 1111 __get_str(addr), __entry->xid, 1112 show_rqstp_flags(__entry->flags)) 1113 ); 1114 #define DEFINE_SVC_RQST_EVENT(name) \ 1115 DEFINE_EVENT(svc_rqst_event, svc_##name, \ 1116 TP_PROTO( \ 1117 const struct svc_rqst *rqst \ 1118 ), \ 1119 TP_ARGS(rqst)) 1120 1121 DEFINE_SVC_RQST_EVENT(defer); 1122 DEFINE_SVC_RQST_EVENT(drop); 1123 1124 DECLARE_EVENT_CLASS(svc_rqst_status, 1125 1126 TP_PROTO(struct svc_rqst *rqst, int status), 1127 1128 TP_ARGS(rqst, status), 1129 1130 TP_STRUCT__entry( 1131 __field(u32, xid) 1132 __field(int, status) 1133 __field(unsigned long, flags) 1134 __string(addr, rqst->rq_xprt->xpt_remotebuf) 1135 ), 1136 1137 TP_fast_assign( 1138 __entry->xid = be32_to_cpu(rqst->rq_xid); 1139 __entry->status = status; 1140 __entry->flags = rqst->rq_flags; 1141 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 1142 ), 1143 1144 TP_printk("addr=%s xid=0x%08x status=%d flags=%s", 1145 __get_str(addr), __entry->xid, 1146 __entry->status, show_rqstp_flags(__entry->flags)) 1147 ); 1148 1149 DEFINE_EVENT(svc_rqst_status, svc_send, 1150 TP_PROTO(struct svc_rqst *rqst, int status), 1151 TP_ARGS(rqst, status)); 1152 1153 #define show_svc_xprt_flags(flags) \ 1154 __print_flags(flags, "|", \ 1155 { (1UL << XPT_BUSY), "XPT_BUSY"}, \ 1156 { (1UL << XPT_CONN), "XPT_CONN"}, \ 1157 { (1UL << XPT_CLOSE), "XPT_CLOSE"}, \ 1158 { (1UL << XPT_DATA), "XPT_DATA"}, \ 1159 { (1UL << XPT_TEMP), "XPT_TEMP"}, \ 1160 { (1UL << XPT_DEAD), "XPT_DEAD"}, \ 1161 { (1UL << XPT_CHNGBUF), "XPT_CHNGBUF"}, \ 1162 { (1UL << XPT_DEFERRED), "XPT_DEFERRED"}, \ 1163 { (1UL << XPT_OLD), "XPT_OLD"}, \ 1164 { (1UL << XPT_LISTENER), "XPT_LISTENER"}, \ 1165 { (1UL << XPT_CACHE_AUTH), "XPT_CACHE_AUTH"}, \ 1166 { (1UL << XPT_LOCAL), "XPT_LOCAL"}, \ 1167 { (1UL << XPT_KILL_TEMP), "XPT_KILL_TEMP"}, \ 1168 { (1UL << XPT_CONG_CTRL), "XPT_CONG_CTRL"}) 1169 1170 TRACE_EVENT(svc_xprt_do_enqueue, 1171 TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst), 1172 1173 TP_ARGS(xprt, rqst), 1174 1175 TP_STRUCT__entry( 1176 __field(struct svc_xprt *, xprt) 1177 __field(int, pid) 1178 __field(unsigned long, flags) 1179 __string(addr, xprt->xpt_remotebuf) 1180 ), 1181 1182 TP_fast_assign( 1183 __entry->xprt = xprt; 1184 __entry->pid = rqst? rqst->rq_task->pid : 0; 1185 __entry->flags = xprt->xpt_flags; 1186 __assign_str(addr, xprt->xpt_remotebuf); 1187 ), 1188 1189 TP_printk("xprt=%p addr=%s pid=%d flags=%s", 1190 __entry->xprt, __get_str(addr), 1191 __entry->pid, show_svc_xprt_flags(__entry->flags)) 1192 ); 1193 1194 DECLARE_EVENT_CLASS(svc_xprt_event, 1195 TP_PROTO(struct svc_xprt *xprt), 1196 1197 TP_ARGS(xprt), 1198 1199 TP_STRUCT__entry( 1200 __field(struct svc_xprt *, xprt) 1201 __field(unsigned long, flags) 1202 __string(addr, xprt->xpt_remotebuf) 1203 ), 1204 1205 TP_fast_assign( 1206 __entry->xprt = xprt; 1207 __entry->flags = xprt->xpt_flags; 1208 __assign_str(addr, xprt->xpt_remotebuf); 1209 ), 1210 1211 TP_printk("xprt=%p addr=%s flags=%s", 1212 __entry->xprt, __get_str(addr), 1213 show_svc_xprt_flags(__entry->flags)) 1214 ); 1215 1216 DEFINE_EVENT(svc_xprt_event, svc_xprt_no_write_space, 1217 TP_PROTO(struct svc_xprt *xprt), 1218 TP_ARGS(xprt)); 1219 1220 TRACE_EVENT(svc_xprt_dequeue, 1221 TP_PROTO(struct svc_rqst *rqst), 1222 1223 TP_ARGS(rqst), 1224 1225 TP_STRUCT__entry( 1226 __field(struct svc_xprt *, xprt) 1227 __field(unsigned long, flags) 1228 __field(unsigned long, wakeup) 1229 __string(addr, rqst->rq_xprt->xpt_remotebuf) 1230 ), 1231 1232 TP_fast_assign( 1233 __entry->xprt = rqst->rq_xprt; 1234 __entry->flags = rqst->rq_xprt->xpt_flags; 1235 __entry->wakeup = ktime_to_us(ktime_sub(ktime_get(), 1236 rqst->rq_qtime)); 1237 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 1238 ), 1239 1240 TP_printk("xprt=%p addr=%s flags=%s wakeup-us=%lu", 1241 __entry->xprt, __get_str(addr), 1242 show_svc_xprt_flags(__entry->flags), 1243 __entry->wakeup) 1244 ); 1245 1246 TRACE_EVENT(svc_wake_up, 1247 TP_PROTO(int pid), 1248 1249 TP_ARGS(pid), 1250 1251 TP_STRUCT__entry( 1252 __field(int, pid) 1253 ), 1254 1255 TP_fast_assign( 1256 __entry->pid = pid; 1257 ), 1258 1259 TP_printk("pid=%d", __entry->pid) 1260 ); 1261 1262 TRACE_EVENT(svc_handle_xprt, 1263 TP_PROTO(struct svc_xprt *xprt, int len), 1264 1265 TP_ARGS(xprt, len), 1266 1267 TP_STRUCT__entry( 1268 __field(struct svc_xprt *, xprt) 1269 __field(int, len) 1270 __field(unsigned long, flags) 1271 __string(addr, xprt->xpt_remotebuf) 1272 ), 1273 1274 TP_fast_assign( 1275 __entry->xprt = xprt; 1276 __entry->len = len; 1277 __entry->flags = xprt->xpt_flags; 1278 __assign_str(addr, xprt->xpt_remotebuf); 1279 ), 1280 1281 TP_printk("xprt=%p addr=%s len=%d flags=%s", 1282 __entry->xprt, __get_str(addr), 1283 __entry->len, show_svc_xprt_flags(__entry->flags)) 1284 ); 1285 1286 TRACE_EVENT(svc_stats_latency, 1287 TP_PROTO(const struct svc_rqst *rqst), 1288 1289 TP_ARGS(rqst), 1290 1291 TP_STRUCT__entry( 1292 __field(u32, xid) 1293 __field(unsigned long, execute) 1294 __string(addr, rqst->rq_xprt->xpt_remotebuf) 1295 ), 1296 1297 TP_fast_assign( 1298 __entry->xid = be32_to_cpu(rqst->rq_xid); 1299 __entry->execute = ktime_to_us(ktime_sub(ktime_get(), 1300 rqst->rq_stime)); 1301 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 1302 ), 1303 1304 TP_printk("addr=%s xid=0x%08x execute-us=%lu", 1305 __get_str(addr), __entry->xid, __entry->execute) 1306 ); 1307 1308 DECLARE_EVENT_CLASS(svc_deferred_event, 1309 TP_PROTO( 1310 const struct svc_deferred_req *dr 1311 ), 1312 1313 TP_ARGS(dr), 1314 1315 TP_STRUCT__entry( 1316 __field(u32, xid) 1317 __string(addr, dr->xprt->xpt_remotebuf) 1318 ), 1319 1320 TP_fast_assign( 1321 __entry->xid = be32_to_cpu(*(__be32 *)(dr->args + 1322 (dr->xprt_hlen>>2))); 1323 __assign_str(addr, dr->xprt->xpt_remotebuf); 1324 ), 1325 1326 TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid) 1327 ); 1328 #define DEFINE_SVC_DEFERRED_EVENT(name) \ 1329 DEFINE_EVENT(svc_deferred_event, svc_##name##_deferred, \ 1330 TP_PROTO( \ 1331 const struct svc_deferred_req *dr \ 1332 ), \ 1333 TP_ARGS(dr)) 1334 1335 DEFINE_SVC_DEFERRED_EVENT(drop); 1336 DEFINE_SVC_DEFERRED_EVENT(revisit); 1337 1338 DECLARE_EVENT_CLASS(cache_event, 1339 TP_PROTO( 1340 const struct cache_detail *cd, 1341 const struct cache_head *h 1342 ), 1343 1344 TP_ARGS(cd, h), 1345 1346 TP_STRUCT__entry( 1347 __field(const struct cache_head *, h) 1348 __string(name, cd->name) 1349 ), 1350 1351 TP_fast_assign( 1352 __entry->h = h; 1353 __assign_str(name, cd->name); 1354 ), 1355 1356 TP_printk("cache=%s entry=%p", __get_str(name), __entry->h) 1357 ); 1358 #define DEFINE_CACHE_EVENT(name) \ 1359 DEFINE_EVENT(cache_event, name, \ 1360 TP_PROTO( \ 1361 const struct cache_detail *cd, \ 1362 const struct cache_head *h \ 1363 ), \ 1364 TP_ARGS(cd, h)) 1365 DEFINE_CACHE_EVENT(cache_entry_expired); 1366 DEFINE_CACHE_EVENT(cache_entry_upcall); 1367 DEFINE_CACHE_EVENT(cache_entry_update); 1368 DEFINE_CACHE_EVENT(cache_entry_make_negative); 1369 DEFINE_CACHE_EVENT(cache_entry_no_listener); 1370 1371 #endif /* _TRACE_SUNRPC_H */ 1372 1373 #include <trace/define_trace.h> 1374