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 #include <trace/events/sunrpc_base.h> 18 19 TRACE_DEFINE_ENUM(SOCK_STREAM); 20 TRACE_DEFINE_ENUM(SOCK_DGRAM); 21 TRACE_DEFINE_ENUM(SOCK_RAW); 22 TRACE_DEFINE_ENUM(SOCK_RDM); 23 TRACE_DEFINE_ENUM(SOCK_SEQPACKET); 24 TRACE_DEFINE_ENUM(SOCK_DCCP); 25 TRACE_DEFINE_ENUM(SOCK_PACKET); 26 27 #define show_socket_type(type) \ 28 __print_symbolic(type, \ 29 { SOCK_STREAM, "STREAM" }, \ 30 { SOCK_DGRAM, "DGRAM" }, \ 31 { SOCK_RAW, "RAW" }, \ 32 { SOCK_RDM, "RDM" }, \ 33 { SOCK_SEQPACKET, "SEQPACKET" }, \ 34 { SOCK_DCCP, "DCCP" }, \ 35 { SOCK_PACKET, "PACKET" }) 36 37 /* This list is known to be incomplete, add new enums as needed. */ 38 TRACE_DEFINE_ENUM(AF_UNSPEC); 39 TRACE_DEFINE_ENUM(AF_UNIX); 40 TRACE_DEFINE_ENUM(AF_LOCAL); 41 TRACE_DEFINE_ENUM(AF_INET); 42 TRACE_DEFINE_ENUM(AF_INET6); 43 44 #define rpc_show_address_family(family) \ 45 __print_symbolic(family, \ 46 { AF_UNSPEC, "AF_UNSPEC" }, \ 47 { AF_UNIX, "AF_UNIX" }, \ 48 { AF_LOCAL, "AF_LOCAL" }, \ 49 { AF_INET, "AF_INET" }, \ 50 { AF_INET6, "AF_INET6" }) 51 52 DECLARE_EVENT_CLASS(rpc_xdr_buf_class, 53 TP_PROTO( 54 const struct rpc_task *task, 55 const struct xdr_buf *xdr 56 ), 57 58 TP_ARGS(task, xdr), 59 60 TP_STRUCT__entry( 61 __field(unsigned int, task_id) 62 __field(unsigned int, client_id) 63 __field(const void *, head_base) 64 __field(size_t, head_len) 65 __field(const void *, tail_base) 66 __field(size_t, tail_len) 67 __field(unsigned int, page_base) 68 __field(unsigned int, page_len) 69 __field(unsigned int, msg_len) 70 ), 71 72 TP_fast_assign( 73 __entry->task_id = task->tk_pid; 74 __entry->client_id = task->tk_client ? 75 task->tk_client->cl_clid : -1; 76 __entry->head_base = xdr->head[0].iov_base; 77 __entry->head_len = xdr->head[0].iov_len; 78 __entry->tail_base = xdr->tail[0].iov_base; 79 __entry->tail_len = xdr->tail[0].iov_len; 80 __entry->page_base = xdr->page_base; 81 __entry->page_len = xdr->page_len; 82 __entry->msg_len = xdr->len; 83 ), 84 85 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 86 " head=[%p,%zu] page=%u(%u) tail=[%p,%zu] len=%u", 87 __entry->task_id, __entry->client_id, 88 __entry->head_base, __entry->head_len, 89 __entry->page_len, __entry->page_base, 90 __entry->tail_base, __entry->tail_len, 91 __entry->msg_len 92 ) 93 ); 94 95 #define DEFINE_RPCXDRBUF_EVENT(name) \ 96 DEFINE_EVENT(rpc_xdr_buf_class, \ 97 rpc_xdr_##name, \ 98 TP_PROTO( \ 99 const struct rpc_task *task, \ 100 const struct xdr_buf *xdr \ 101 ), \ 102 TP_ARGS(task, xdr)) 103 104 DEFINE_RPCXDRBUF_EVENT(sendto); 105 DEFINE_RPCXDRBUF_EVENT(recvfrom); 106 DEFINE_RPCXDRBUF_EVENT(reply_pages); 107 108 109 DECLARE_EVENT_CLASS(rpc_clnt_class, 110 TP_PROTO( 111 const struct rpc_clnt *clnt 112 ), 113 114 TP_ARGS(clnt), 115 116 TP_STRUCT__entry( 117 __field(unsigned int, client_id) 118 ), 119 120 TP_fast_assign( 121 __entry->client_id = clnt->cl_clid; 122 ), 123 124 TP_printk("client=" SUNRPC_TRACE_CLID_SPECIFIER, __entry->client_id) 125 ); 126 127 #define DEFINE_RPC_CLNT_EVENT(name) \ 128 DEFINE_EVENT(rpc_clnt_class, \ 129 rpc_clnt_##name, \ 130 TP_PROTO( \ 131 const struct rpc_clnt *clnt \ 132 ), \ 133 TP_ARGS(clnt)) 134 135 DEFINE_RPC_CLNT_EVENT(free); 136 DEFINE_RPC_CLNT_EVENT(killall); 137 DEFINE_RPC_CLNT_EVENT(shutdown); 138 DEFINE_RPC_CLNT_EVENT(release); 139 DEFINE_RPC_CLNT_EVENT(replace_xprt); 140 DEFINE_RPC_CLNT_EVENT(replace_xprt_err); 141 142 TRACE_EVENT(rpc_clnt_new, 143 TP_PROTO( 144 const struct rpc_clnt *clnt, 145 const struct rpc_xprt *xprt, 146 const char *program, 147 const char *server 148 ), 149 150 TP_ARGS(clnt, xprt, program, server), 151 152 TP_STRUCT__entry( 153 __field(unsigned int, client_id) 154 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR]) 155 __string(port, xprt->address_strings[RPC_DISPLAY_PORT]) 156 __string(program, program) 157 __string(server, server) 158 ), 159 160 TP_fast_assign( 161 __entry->client_id = clnt->cl_clid; 162 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]); 163 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]); 164 __assign_str(program, program); 165 __assign_str(server, server); 166 ), 167 168 TP_printk("client=" SUNRPC_TRACE_CLID_SPECIFIER 169 " peer=[%s]:%s program=%s server=%s", 170 __entry->client_id, __get_str(addr), __get_str(port), 171 __get_str(program), __get_str(server)) 172 ); 173 174 TRACE_EVENT(rpc_clnt_new_err, 175 TP_PROTO( 176 const char *program, 177 const char *server, 178 int error 179 ), 180 181 TP_ARGS(program, server, error), 182 183 TP_STRUCT__entry( 184 __field(int, error) 185 __string(program, program) 186 __string(server, server) 187 ), 188 189 TP_fast_assign( 190 __entry->error = error; 191 __assign_str(program, program); 192 __assign_str(server, server); 193 ), 194 195 TP_printk("program=%s server=%s error=%d", 196 __get_str(program), __get_str(server), __entry->error) 197 ); 198 199 TRACE_EVENT(rpc_clnt_clone_err, 200 TP_PROTO( 201 const struct rpc_clnt *clnt, 202 int error 203 ), 204 205 TP_ARGS(clnt, error), 206 207 TP_STRUCT__entry( 208 __field(unsigned int, client_id) 209 __field(int, error) 210 ), 211 212 TP_fast_assign( 213 __entry->client_id = clnt->cl_clid; 214 __entry->error = error; 215 ), 216 217 TP_printk("client=" SUNRPC_TRACE_CLID_SPECIFIER " error=%d", 218 __entry->client_id, __entry->error) 219 ); 220 221 222 TRACE_DEFINE_ENUM(RPC_AUTH_OK); 223 TRACE_DEFINE_ENUM(RPC_AUTH_BADCRED); 224 TRACE_DEFINE_ENUM(RPC_AUTH_REJECTEDCRED); 225 TRACE_DEFINE_ENUM(RPC_AUTH_BADVERF); 226 TRACE_DEFINE_ENUM(RPC_AUTH_REJECTEDVERF); 227 TRACE_DEFINE_ENUM(RPC_AUTH_TOOWEAK); 228 TRACE_DEFINE_ENUM(RPCSEC_GSS_CREDPROBLEM); 229 TRACE_DEFINE_ENUM(RPCSEC_GSS_CTXPROBLEM); 230 231 #define rpc_show_auth_stat(status) \ 232 __print_symbolic(status, \ 233 { RPC_AUTH_OK, "AUTH_OK" }, \ 234 { RPC_AUTH_BADCRED, "BADCRED" }, \ 235 { RPC_AUTH_REJECTEDCRED, "REJECTEDCRED" }, \ 236 { RPC_AUTH_BADVERF, "BADVERF" }, \ 237 { RPC_AUTH_REJECTEDVERF, "REJECTEDVERF" }, \ 238 { RPC_AUTH_TOOWEAK, "TOOWEAK" }, \ 239 { RPCSEC_GSS_CREDPROBLEM, "GSS_CREDPROBLEM" }, \ 240 { RPCSEC_GSS_CTXPROBLEM, "GSS_CTXPROBLEM" }) \ 241 242 DECLARE_EVENT_CLASS(rpc_task_status, 243 244 TP_PROTO(const struct rpc_task *task), 245 246 TP_ARGS(task), 247 248 TP_STRUCT__entry( 249 __field(unsigned int, task_id) 250 __field(unsigned int, client_id) 251 __field(int, status) 252 ), 253 254 TP_fast_assign( 255 __entry->task_id = task->tk_pid; 256 __entry->client_id = task->tk_client->cl_clid; 257 __entry->status = task->tk_status; 258 ), 259 260 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " status=%d", 261 __entry->task_id, __entry->client_id, 262 __entry->status) 263 ); 264 #define DEFINE_RPC_STATUS_EVENT(name) \ 265 DEFINE_EVENT(rpc_task_status, rpc_##name##_status, \ 266 TP_PROTO( \ 267 const struct rpc_task *task \ 268 ), \ 269 TP_ARGS(task)) 270 271 DEFINE_RPC_STATUS_EVENT(call); 272 DEFINE_RPC_STATUS_EVENT(connect); 273 DEFINE_RPC_STATUS_EVENT(timeout); 274 DEFINE_RPC_STATUS_EVENT(retry_refresh); 275 DEFINE_RPC_STATUS_EVENT(refresh); 276 277 TRACE_EVENT(rpc_request, 278 TP_PROTO(const struct rpc_task *task), 279 280 TP_ARGS(task), 281 282 TP_STRUCT__entry( 283 __field(unsigned int, task_id) 284 __field(unsigned int, client_id) 285 __field(int, version) 286 __field(bool, async) 287 __string(progname, task->tk_client->cl_program->name) 288 __string(procname, rpc_proc_name(task)) 289 ), 290 291 TP_fast_assign( 292 __entry->task_id = task->tk_pid; 293 __entry->client_id = task->tk_client->cl_clid; 294 __entry->version = task->tk_client->cl_vers; 295 __entry->async = RPC_IS_ASYNC(task); 296 __assign_str(progname, task->tk_client->cl_program->name); 297 __assign_str(procname, rpc_proc_name(task)); 298 ), 299 300 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " %sv%d %s (%ssync)", 301 __entry->task_id, __entry->client_id, 302 __get_str(progname), __entry->version, 303 __get_str(procname), __entry->async ? "a": "" 304 ) 305 ); 306 307 #define rpc_show_task_flags(flags) \ 308 __print_flags(flags, "|", \ 309 { RPC_TASK_ASYNC, "ASYNC" }, \ 310 { RPC_TASK_SWAPPER, "SWAPPER" }, \ 311 { RPC_TASK_MOVEABLE, "MOVEABLE" }, \ 312 { RPC_TASK_NULLCREDS, "NULLCREDS" }, \ 313 { RPC_CALL_MAJORSEEN, "MAJORSEEN" }, \ 314 { RPC_TASK_ROOTCREDS, "ROOTCREDS" }, \ 315 { RPC_TASK_DYNAMIC, "DYNAMIC" }, \ 316 { RPC_TASK_NO_ROUND_ROBIN, "NO_ROUND_ROBIN" }, \ 317 { RPC_TASK_SOFT, "SOFT" }, \ 318 { RPC_TASK_SOFTCONN, "SOFTCONN" }, \ 319 { RPC_TASK_SENT, "SENT" }, \ 320 { RPC_TASK_TIMEOUT, "TIMEOUT" }, \ 321 { RPC_TASK_NOCONNECT, "NOCONNECT" }, \ 322 { RPC_TASK_NO_RETRANS_TIMEOUT, "NORTO" }, \ 323 { RPC_TASK_CRED_NOREF, "CRED_NOREF" }) 324 325 #define rpc_show_runstate(flags) \ 326 __print_flags(flags, "|", \ 327 { (1UL << RPC_TASK_RUNNING), "RUNNING" }, \ 328 { (1UL << RPC_TASK_QUEUED), "QUEUED" }, \ 329 { (1UL << RPC_TASK_ACTIVE), "ACTIVE" }, \ 330 { (1UL << RPC_TASK_NEED_XMIT), "NEED_XMIT" }, \ 331 { (1UL << RPC_TASK_NEED_RECV), "NEED_RECV" }, \ 332 { (1UL << RPC_TASK_MSG_PIN_WAIT), "MSG_PIN_WAIT" }, \ 333 { (1UL << RPC_TASK_SIGNALLED), "SIGNALLED" }) 334 335 DECLARE_EVENT_CLASS(rpc_task_running, 336 337 TP_PROTO(const struct rpc_task *task, const void *action), 338 339 TP_ARGS(task, action), 340 341 TP_STRUCT__entry( 342 __field(unsigned int, task_id) 343 __field(unsigned int, client_id) 344 __field(const void *, action) 345 __field(unsigned long, runstate) 346 __field(int, status) 347 __field(unsigned short, flags) 348 ), 349 350 TP_fast_assign( 351 __entry->client_id = task->tk_client ? 352 task->tk_client->cl_clid : -1; 353 __entry->task_id = task->tk_pid; 354 __entry->action = action; 355 __entry->runstate = task->tk_runstate; 356 __entry->status = task->tk_status; 357 __entry->flags = task->tk_flags; 358 ), 359 360 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 361 " flags=%s runstate=%s status=%d action=%ps", 362 __entry->task_id, __entry->client_id, 363 rpc_show_task_flags(__entry->flags), 364 rpc_show_runstate(__entry->runstate), 365 __entry->status, 366 __entry->action 367 ) 368 ); 369 #define DEFINE_RPC_RUNNING_EVENT(name) \ 370 DEFINE_EVENT(rpc_task_running, rpc_task_##name, \ 371 TP_PROTO( \ 372 const struct rpc_task *task, \ 373 const void *action \ 374 ), \ 375 TP_ARGS(task, action)) 376 377 DEFINE_RPC_RUNNING_EVENT(begin); 378 DEFINE_RPC_RUNNING_EVENT(run_action); 379 DEFINE_RPC_RUNNING_EVENT(sync_sleep); 380 DEFINE_RPC_RUNNING_EVENT(sync_wake); 381 DEFINE_RPC_RUNNING_EVENT(complete); 382 DEFINE_RPC_RUNNING_EVENT(timeout); 383 DEFINE_RPC_RUNNING_EVENT(signalled); 384 DEFINE_RPC_RUNNING_EVENT(end); 385 DEFINE_RPC_RUNNING_EVENT(call_done); 386 387 DECLARE_EVENT_CLASS(rpc_task_queued, 388 389 TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q), 390 391 TP_ARGS(task, q), 392 393 TP_STRUCT__entry( 394 __field(unsigned int, task_id) 395 __field(unsigned int, client_id) 396 __field(unsigned long, timeout) 397 __field(unsigned long, runstate) 398 __field(int, status) 399 __field(unsigned short, flags) 400 __string(q_name, rpc_qname(q)) 401 ), 402 403 TP_fast_assign( 404 __entry->client_id = task->tk_client ? 405 task->tk_client->cl_clid : -1; 406 __entry->task_id = task->tk_pid; 407 __entry->timeout = rpc_task_timeout(task); 408 __entry->runstate = task->tk_runstate; 409 __entry->status = task->tk_status; 410 __entry->flags = task->tk_flags; 411 __assign_str(q_name, rpc_qname(q)); 412 ), 413 414 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 415 " flags=%s runstate=%s status=%d timeout=%lu queue=%s", 416 __entry->task_id, __entry->client_id, 417 rpc_show_task_flags(__entry->flags), 418 rpc_show_runstate(__entry->runstate), 419 __entry->status, 420 __entry->timeout, 421 __get_str(q_name) 422 ) 423 ); 424 #define DEFINE_RPC_QUEUED_EVENT(name) \ 425 DEFINE_EVENT(rpc_task_queued, rpc_task_##name, \ 426 TP_PROTO( \ 427 const struct rpc_task *task, \ 428 const struct rpc_wait_queue *q \ 429 ), \ 430 TP_ARGS(task, q)) 431 432 DEFINE_RPC_QUEUED_EVENT(sleep); 433 DEFINE_RPC_QUEUED_EVENT(wakeup); 434 435 DECLARE_EVENT_CLASS(rpc_failure, 436 437 TP_PROTO(const struct rpc_task *task), 438 439 TP_ARGS(task), 440 441 TP_STRUCT__entry( 442 __field(unsigned int, task_id) 443 __field(unsigned int, client_id) 444 ), 445 446 TP_fast_assign( 447 __entry->task_id = task->tk_pid; 448 __entry->client_id = task->tk_client->cl_clid; 449 ), 450 451 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER, 452 __entry->task_id, __entry->client_id) 453 ); 454 455 #define DEFINE_RPC_FAILURE(name) \ 456 DEFINE_EVENT(rpc_failure, rpc_bad_##name, \ 457 TP_PROTO( \ 458 const struct rpc_task *task \ 459 ), \ 460 TP_ARGS(task)) 461 462 DEFINE_RPC_FAILURE(callhdr); 463 DEFINE_RPC_FAILURE(verifier); 464 465 DECLARE_EVENT_CLASS(rpc_reply_event, 466 467 TP_PROTO( 468 const struct rpc_task *task 469 ), 470 471 TP_ARGS(task), 472 473 TP_STRUCT__entry( 474 __field(unsigned int, task_id) 475 __field(unsigned int, client_id) 476 __field(u32, xid) 477 __string(progname, task->tk_client->cl_program->name) 478 __field(u32, version) 479 __string(procname, rpc_proc_name(task)) 480 __string(servername, task->tk_xprt->servername) 481 ), 482 483 TP_fast_assign( 484 __entry->task_id = task->tk_pid; 485 __entry->client_id = task->tk_client->cl_clid; 486 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); 487 __assign_str(progname, task->tk_client->cl_program->name); 488 __entry->version = task->tk_client->cl_vers; 489 __assign_str(procname, rpc_proc_name(task)); 490 __assign_str(servername, task->tk_xprt->servername); 491 ), 492 493 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 494 " server=%s xid=0x%08x %sv%d %s", 495 __entry->task_id, __entry->client_id, __get_str(servername), 496 __entry->xid, __get_str(progname), __entry->version, 497 __get_str(procname)) 498 ) 499 500 #define DEFINE_RPC_REPLY_EVENT(name) \ 501 DEFINE_EVENT(rpc_reply_event, rpc__##name, \ 502 TP_PROTO( \ 503 const struct rpc_task *task \ 504 ), \ 505 TP_ARGS(task)) 506 507 DEFINE_RPC_REPLY_EVENT(prog_unavail); 508 DEFINE_RPC_REPLY_EVENT(prog_mismatch); 509 DEFINE_RPC_REPLY_EVENT(proc_unavail); 510 DEFINE_RPC_REPLY_EVENT(garbage_args); 511 DEFINE_RPC_REPLY_EVENT(unparsable); 512 DEFINE_RPC_REPLY_EVENT(mismatch); 513 DEFINE_RPC_REPLY_EVENT(stale_creds); 514 DEFINE_RPC_REPLY_EVENT(bad_creds); 515 DEFINE_RPC_REPLY_EVENT(auth_tooweak); 516 517 #define DEFINE_RPCB_ERROR_EVENT(name) \ 518 DEFINE_EVENT(rpc_reply_event, rpcb_##name##_err, \ 519 TP_PROTO( \ 520 const struct rpc_task *task \ 521 ), \ 522 TP_ARGS(task)) 523 524 DEFINE_RPCB_ERROR_EVENT(prog_unavail); 525 DEFINE_RPCB_ERROR_EVENT(timeout); 526 DEFINE_RPCB_ERROR_EVENT(bind_version); 527 DEFINE_RPCB_ERROR_EVENT(unreachable); 528 DEFINE_RPCB_ERROR_EVENT(unrecognized); 529 530 TRACE_EVENT(rpc_buf_alloc, 531 TP_PROTO( 532 const struct rpc_task *task, 533 int status 534 ), 535 536 TP_ARGS(task, status), 537 538 TP_STRUCT__entry( 539 __field(unsigned int, task_id) 540 __field(unsigned int, client_id) 541 __field(size_t, callsize) 542 __field(size_t, recvsize) 543 __field(int, status) 544 ), 545 546 TP_fast_assign( 547 __entry->task_id = task->tk_pid; 548 __entry->client_id = task->tk_client->cl_clid; 549 __entry->callsize = task->tk_rqstp->rq_callsize; 550 __entry->recvsize = task->tk_rqstp->rq_rcvsize; 551 __entry->status = status; 552 ), 553 554 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 555 " callsize=%zu recvsize=%zu status=%d", 556 __entry->task_id, __entry->client_id, 557 __entry->callsize, __entry->recvsize, __entry->status 558 ) 559 ); 560 561 TRACE_EVENT(rpc_call_rpcerror, 562 TP_PROTO( 563 const struct rpc_task *task, 564 int tk_status, 565 int rpc_status 566 ), 567 568 TP_ARGS(task, tk_status, rpc_status), 569 570 TP_STRUCT__entry( 571 __field(unsigned int, task_id) 572 __field(unsigned int, client_id) 573 __field(int, tk_status) 574 __field(int, rpc_status) 575 ), 576 577 TP_fast_assign( 578 __entry->client_id = task->tk_client->cl_clid; 579 __entry->task_id = task->tk_pid; 580 __entry->tk_status = tk_status; 581 __entry->rpc_status = rpc_status; 582 ), 583 584 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 585 " tk_status=%d rpc_status=%d", 586 __entry->task_id, __entry->client_id, 587 __entry->tk_status, __entry->rpc_status) 588 ); 589 590 TRACE_EVENT(rpc_stats_latency, 591 592 TP_PROTO( 593 const struct rpc_task *task, 594 ktime_t backlog, 595 ktime_t rtt, 596 ktime_t execute 597 ), 598 599 TP_ARGS(task, backlog, rtt, execute), 600 601 TP_STRUCT__entry( 602 __field(unsigned int, task_id) 603 __field(unsigned int, client_id) 604 __field(u32, xid) 605 __field(int, version) 606 __string(progname, task->tk_client->cl_program->name) 607 __string(procname, rpc_proc_name(task)) 608 __field(unsigned long, backlog) 609 __field(unsigned long, rtt) 610 __field(unsigned long, execute) 611 ), 612 613 TP_fast_assign( 614 __entry->client_id = task->tk_client->cl_clid; 615 __entry->task_id = task->tk_pid; 616 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); 617 __entry->version = task->tk_client->cl_vers; 618 __assign_str(progname, task->tk_client->cl_program->name); 619 __assign_str(procname, rpc_proc_name(task)); 620 __entry->backlog = ktime_to_us(backlog); 621 __entry->rtt = ktime_to_us(rtt); 622 __entry->execute = ktime_to_us(execute); 623 ), 624 625 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 626 " xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu", 627 __entry->task_id, __entry->client_id, __entry->xid, 628 __get_str(progname), __entry->version, __get_str(procname), 629 __entry->backlog, __entry->rtt, __entry->execute) 630 ); 631 632 TRACE_EVENT(rpc_xdr_overflow, 633 TP_PROTO( 634 const struct xdr_stream *xdr, 635 size_t requested 636 ), 637 638 TP_ARGS(xdr, requested), 639 640 TP_STRUCT__entry( 641 __field(unsigned int, task_id) 642 __field(unsigned int, client_id) 643 __field(int, version) 644 __field(size_t, requested) 645 __field(const void *, end) 646 __field(const void *, p) 647 __field(const void *, head_base) 648 __field(size_t, head_len) 649 __field(const void *, tail_base) 650 __field(size_t, tail_len) 651 __field(unsigned int, page_len) 652 __field(unsigned int, len) 653 __string(progname, xdr->rqst ? 654 xdr->rqst->rq_task->tk_client->cl_program->name : "unknown") 655 __string(procedure, xdr->rqst ? 656 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name : "unknown") 657 ), 658 659 TP_fast_assign( 660 if (xdr->rqst) { 661 const struct rpc_task *task = xdr->rqst->rq_task; 662 663 __entry->task_id = task->tk_pid; 664 __entry->client_id = task->tk_client->cl_clid; 665 __assign_str(progname, 666 task->tk_client->cl_program->name); 667 __entry->version = task->tk_client->cl_vers; 668 __assign_str(procedure, task->tk_msg.rpc_proc->p_name); 669 } else { 670 __entry->task_id = -1; 671 __entry->client_id = -1; 672 __assign_str(progname, "unknown"); 673 __entry->version = 0; 674 __assign_str(procedure, "unknown"); 675 } 676 __entry->requested = requested; 677 __entry->end = xdr->end; 678 __entry->p = xdr->p; 679 __entry->head_base = xdr->buf->head[0].iov_base, 680 __entry->head_len = xdr->buf->head[0].iov_len, 681 __entry->page_len = xdr->buf->page_len, 682 __entry->tail_base = xdr->buf->tail[0].iov_base, 683 __entry->tail_len = xdr->buf->tail[0].iov_len, 684 __entry->len = xdr->buf->len; 685 ), 686 687 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 688 " %sv%d %s requested=%zu p=%p end=%p xdr=[%p,%zu]/%u/[%p,%zu]/%u\n", 689 __entry->task_id, __entry->client_id, 690 __get_str(progname), __entry->version, __get_str(procedure), 691 __entry->requested, __entry->p, __entry->end, 692 __entry->head_base, __entry->head_len, 693 __entry->page_len, 694 __entry->tail_base, __entry->tail_len, 695 __entry->len 696 ) 697 ); 698 699 TRACE_EVENT(rpc_xdr_alignment, 700 TP_PROTO( 701 const struct xdr_stream *xdr, 702 size_t offset, 703 unsigned int copied 704 ), 705 706 TP_ARGS(xdr, offset, copied), 707 708 TP_STRUCT__entry( 709 __field(unsigned int, task_id) 710 __field(unsigned int, client_id) 711 __field(int, version) 712 __field(size_t, offset) 713 __field(unsigned int, copied) 714 __field(const void *, head_base) 715 __field(size_t, head_len) 716 __field(const void *, tail_base) 717 __field(size_t, tail_len) 718 __field(unsigned int, page_len) 719 __field(unsigned int, len) 720 __string(progname, 721 xdr->rqst->rq_task->tk_client->cl_program->name) 722 __string(procedure, 723 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name) 724 ), 725 726 TP_fast_assign( 727 const struct rpc_task *task = xdr->rqst->rq_task; 728 729 __entry->task_id = task->tk_pid; 730 __entry->client_id = task->tk_client->cl_clid; 731 __assign_str(progname, 732 task->tk_client->cl_program->name); 733 __entry->version = task->tk_client->cl_vers; 734 __assign_str(procedure, task->tk_msg.rpc_proc->p_name); 735 736 __entry->offset = offset; 737 __entry->copied = copied; 738 __entry->head_base = xdr->buf->head[0].iov_base, 739 __entry->head_len = xdr->buf->head[0].iov_len, 740 __entry->page_len = xdr->buf->page_len, 741 __entry->tail_base = xdr->buf->tail[0].iov_base, 742 __entry->tail_len = xdr->buf->tail[0].iov_len, 743 __entry->len = xdr->buf->len; 744 ), 745 746 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 747 " %sv%d %s offset=%zu copied=%u xdr=[%p,%zu]/%u/[%p,%zu]/%u\n", 748 __entry->task_id, __entry->client_id, 749 __get_str(progname), __entry->version, __get_str(procedure), 750 __entry->offset, __entry->copied, 751 __entry->head_base, __entry->head_len, 752 __entry->page_len, 753 __entry->tail_base, __entry->tail_len, 754 __entry->len 755 ) 756 ); 757 758 /* 759 * First define the enums in the below macros to be exported to userspace 760 * via TRACE_DEFINE_ENUM(). 761 */ 762 #undef EM 763 #undef EMe 764 #define EM(a, b) TRACE_DEFINE_ENUM(a); 765 #define EMe(a, b) TRACE_DEFINE_ENUM(a); 766 767 #define RPC_SHOW_SOCKET \ 768 EM( SS_FREE, "FREE" ) \ 769 EM( SS_UNCONNECTED, "UNCONNECTED" ) \ 770 EM( SS_CONNECTING, "CONNECTING" ) \ 771 EM( SS_CONNECTED, "CONNECTED" ) \ 772 EMe( SS_DISCONNECTING, "DISCONNECTING" ) 773 774 #define rpc_show_socket_state(state) \ 775 __print_symbolic(state, RPC_SHOW_SOCKET) 776 777 RPC_SHOW_SOCKET 778 779 #define RPC_SHOW_SOCK \ 780 EM( TCP_ESTABLISHED, "ESTABLISHED" ) \ 781 EM( TCP_SYN_SENT, "SYN_SENT" ) \ 782 EM( TCP_SYN_RECV, "SYN_RECV" ) \ 783 EM( TCP_FIN_WAIT1, "FIN_WAIT1" ) \ 784 EM( TCP_FIN_WAIT2, "FIN_WAIT2" ) \ 785 EM( TCP_TIME_WAIT, "TIME_WAIT" ) \ 786 EM( TCP_CLOSE, "CLOSE" ) \ 787 EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" ) \ 788 EM( TCP_LAST_ACK, "LAST_ACK" ) \ 789 EM( TCP_LISTEN, "LISTEN" ) \ 790 EMe( TCP_CLOSING, "CLOSING" ) 791 792 #define rpc_show_sock_state(state) \ 793 __print_symbolic(state, RPC_SHOW_SOCK) 794 795 RPC_SHOW_SOCK 796 797 /* 798 * Now redefine the EM() and EMe() macros to map the enums to the strings 799 * that will be printed in the output. 800 */ 801 #undef EM 802 #undef EMe 803 #define EM(a, b) {a, b}, 804 #define EMe(a, b) {a, b} 805 806 DECLARE_EVENT_CLASS(xs_socket_event, 807 808 TP_PROTO( 809 struct rpc_xprt *xprt, 810 struct socket *socket 811 ), 812 813 TP_ARGS(xprt, socket), 814 815 TP_STRUCT__entry( 816 __field(unsigned int, socket_state) 817 __field(unsigned int, sock_state) 818 __field(unsigned long long, ino) 819 __string(dstaddr, 820 xprt->address_strings[RPC_DISPLAY_ADDR]) 821 __string(dstport, 822 xprt->address_strings[RPC_DISPLAY_PORT]) 823 ), 824 825 TP_fast_assign( 826 struct inode *inode = SOCK_INODE(socket); 827 __entry->socket_state = socket->state; 828 __entry->sock_state = socket->sk->sk_state; 829 __entry->ino = (unsigned long long)inode->i_ino; 830 __assign_str(dstaddr, 831 xprt->address_strings[RPC_DISPLAY_ADDR]); 832 __assign_str(dstport, 833 xprt->address_strings[RPC_DISPLAY_PORT]); 834 ), 835 836 TP_printk( 837 "socket:[%llu] dstaddr=%s/%s " 838 "state=%u (%s) sk_state=%u (%s)", 839 __entry->ino, __get_str(dstaddr), __get_str(dstport), 840 __entry->socket_state, 841 rpc_show_socket_state(__entry->socket_state), 842 __entry->sock_state, 843 rpc_show_sock_state(__entry->sock_state) 844 ) 845 ); 846 #define DEFINE_RPC_SOCKET_EVENT(name) \ 847 DEFINE_EVENT(xs_socket_event, name, \ 848 TP_PROTO( \ 849 struct rpc_xprt *xprt, \ 850 struct socket *socket \ 851 ), \ 852 TP_ARGS(xprt, socket)) 853 854 DECLARE_EVENT_CLASS(xs_socket_event_done, 855 856 TP_PROTO( 857 struct rpc_xprt *xprt, 858 struct socket *socket, 859 int error 860 ), 861 862 TP_ARGS(xprt, socket, error), 863 864 TP_STRUCT__entry( 865 __field(int, error) 866 __field(unsigned int, socket_state) 867 __field(unsigned int, sock_state) 868 __field(unsigned long long, ino) 869 __string(dstaddr, 870 xprt->address_strings[RPC_DISPLAY_ADDR]) 871 __string(dstport, 872 xprt->address_strings[RPC_DISPLAY_PORT]) 873 ), 874 875 TP_fast_assign( 876 struct inode *inode = SOCK_INODE(socket); 877 __entry->socket_state = socket->state; 878 __entry->sock_state = socket->sk->sk_state; 879 __entry->ino = (unsigned long long)inode->i_ino; 880 __entry->error = error; 881 __assign_str(dstaddr, 882 xprt->address_strings[RPC_DISPLAY_ADDR]); 883 __assign_str(dstport, 884 xprt->address_strings[RPC_DISPLAY_PORT]); 885 ), 886 887 TP_printk( 888 "error=%d socket:[%llu] dstaddr=%s/%s " 889 "state=%u (%s) sk_state=%u (%s)", 890 __entry->error, 891 __entry->ino, __get_str(dstaddr), __get_str(dstport), 892 __entry->socket_state, 893 rpc_show_socket_state(__entry->socket_state), 894 __entry->sock_state, 895 rpc_show_sock_state(__entry->sock_state) 896 ) 897 ); 898 #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \ 899 DEFINE_EVENT(xs_socket_event_done, name, \ 900 TP_PROTO( \ 901 struct rpc_xprt *xprt, \ 902 struct socket *socket, \ 903 int error \ 904 ), \ 905 TP_ARGS(xprt, socket, error)) 906 907 DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change); 908 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect); 909 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error); 910 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection); 911 DEFINE_RPC_SOCKET_EVENT(rpc_socket_close); 912 DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown); 913 914 TRACE_EVENT(rpc_socket_nospace, 915 TP_PROTO( 916 const struct rpc_rqst *rqst, 917 const struct sock_xprt *transport 918 ), 919 920 TP_ARGS(rqst, transport), 921 922 TP_STRUCT__entry( 923 __field(unsigned int, task_id) 924 __field(unsigned int, client_id) 925 __field(unsigned int, total) 926 __field(unsigned int, remaining) 927 ), 928 929 TP_fast_assign( 930 __entry->task_id = rqst->rq_task->tk_pid; 931 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 932 __entry->total = rqst->rq_slen; 933 __entry->remaining = rqst->rq_slen - transport->xmit.offset; 934 ), 935 936 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 937 " total=%u remaining=%u", 938 __entry->task_id, __entry->client_id, 939 __entry->total, __entry->remaining 940 ) 941 ); 942 943 #define rpc_show_xprt_state(x) \ 944 __print_flags(x, "|", \ 945 { BIT(XPRT_LOCKED), "LOCKED" }, \ 946 { BIT(XPRT_CONNECTED), "CONNECTED" }, \ 947 { BIT(XPRT_CONNECTING), "CONNECTING" }, \ 948 { BIT(XPRT_CLOSE_WAIT), "CLOSE_WAIT" }, \ 949 { BIT(XPRT_BOUND), "BOUND" }, \ 950 { BIT(XPRT_BINDING), "BINDING" }, \ 951 { BIT(XPRT_CLOSING), "CLOSING" }, \ 952 { BIT(XPRT_OFFLINE), "OFFLINE" }, \ 953 { BIT(XPRT_REMOVE), "REMOVE" }, \ 954 { BIT(XPRT_CONGESTED), "CONGESTED" }, \ 955 { BIT(XPRT_CWND_WAIT), "CWND_WAIT" }, \ 956 { BIT(XPRT_WRITE_SPACE), "WRITE_SPACE" }) 957 958 DECLARE_EVENT_CLASS(rpc_xprt_lifetime_class, 959 TP_PROTO( 960 const struct rpc_xprt *xprt 961 ), 962 963 TP_ARGS(xprt), 964 965 TP_STRUCT__entry( 966 __field(unsigned long, state) 967 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR]) 968 __string(port, xprt->address_strings[RPC_DISPLAY_PORT]) 969 ), 970 971 TP_fast_assign( 972 __entry->state = xprt->state; 973 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]); 974 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]); 975 ), 976 977 TP_printk("peer=[%s]:%s state=%s", 978 __get_str(addr), __get_str(port), 979 rpc_show_xprt_state(__entry->state)) 980 ); 981 982 #define DEFINE_RPC_XPRT_LIFETIME_EVENT(name) \ 983 DEFINE_EVENT(rpc_xprt_lifetime_class, \ 984 xprt_##name, \ 985 TP_PROTO( \ 986 const struct rpc_xprt *xprt \ 987 ), \ 988 TP_ARGS(xprt)) 989 990 DEFINE_RPC_XPRT_LIFETIME_EVENT(create); 991 DEFINE_RPC_XPRT_LIFETIME_EVENT(connect); 992 DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_auto); 993 DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_done); 994 DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_force); 995 DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_cleanup); 996 DEFINE_RPC_XPRT_LIFETIME_EVENT(destroy); 997 998 DECLARE_EVENT_CLASS(rpc_xprt_event, 999 TP_PROTO( 1000 const struct rpc_xprt *xprt, 1001 __be32 xid, 1002 int status 1003 ), 1004 1005 TP_ARGS(xprt, xid, status), 1006 1007 TP_STRUCT__entry( 1008 __field(u32, xid) 1009 __field(int, status) 1010 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR]) 1011 __string(port, xprt->address_strings[RPC_DISPLAY_PORT]) 1012 ), 1013 1014 TP_fast_assign( 1015 __entry->xid = be32_to_cpu(xid); 1016 __entry->status = status; 1017 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]); 1018 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]); 1019 ), 1020 1021 TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr), 1022 __get_str(port), __entry->xid, 1023 __entry->status) 1024 ); 1025 #define DEFINE_RPC_XPRT_EVENT(name) \ 1026 DEFINE_EVENT(rpc_xprt_event, xprt_##name, \ 1027 TP_PROTO( \ 1028 const struct rpc_xprt *xprt, \ 1029 __be32 xid, \ 1030 int status \ 1031 ), \ 1032 TP_ARGS(xprt, xid, status)) 1033 1034 DEFINE_RPC_XPRT_EVENT(timer); 1035 DEFINE_RPC_XPRT_EVENT(lookup_rqst); 1036 1037 TRACE_EVENT(xprt_transmit, 1038 TP_PROTO( 1039 const struct rpc_rqst *rqst, 1040 int status 1041 ), 1042 1043 TP_ARGS(rqst, status), 1044 1045 TP_STRUCT__entry( 1046 __field(unsigned int, task_id) 1047 __field(unsigned int, client_id) 1048 __field(u32, xid) 1049 __field(u32, seqno) 1050 __field(int, status) 1051 ), 1052 1053 TP_fast_assign( 1054 __entry->task_id = rqst->rq_task->tk_pid; 1055 __entry->client_id = rqst->rq_task->tk_client ? 1056 rqst->rq_task->tk_client->cl_clid : -1; 1057 __entry->xid = be32_to_cpu(rqst->rq_xid); 1058 __entry->seqno = rqst->rq_seqno; 1059 __entry->status = status; 1060 ), 1061 1062 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 1063 " xid=0x%08x seqno=%u status=%d", 1064 __entry->task_id, __entry->client_id, __entry->xid, 1065 __entry->seqno, __entry->status) 1066 ); 1067 1068 TRACE_EVENT(xprt_retransmit, 1069 TP_PROTO( 1070 const struct rpc_rqst *rqst 1071 ), 1072 1073 TP_ARGS(rqst), 1074 1075 TP_STRUCT__entry( 1076 __field(unsigned int, task_id) 1077 __field(unsigned int, client_id) 1078 __field(u32, xid) 1079 __field(int, ntrans) 1080 __field(int, version) 1081 __field(unsigned long, timeout) 1082 __string(progname, 1083 rqst->rq_task->tk_client->cl_program->name) 1084 __string(procname, rpc_proc_name(rqst->rq_task)) 1085 ), 1086 1087 TP_fast_assign( 1088 struct rpc_task *task = rqst->rq_task; 1089 1090 __entry->task_id = task->tk_pid; 1091 __entry->client_id = task->tk_client ? 1092 task->tk_client->cl_clid : -1; 1093 __entry->xid = be32_to_cpu(rqst->rq_xid); 1094 __entry->ntrans = rqst->rq_ntrans; 1095 __entry->timeout = task->tk_timeout; 1096 __assign_str(progname, 1097 task->tk_client->cl_program->name); 1098 __entry->version = task->tk_client->cl_vers; 1099 __assign_str(procname, rpc_proc_name(task)); 1100 ), 1101 1102 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 1103 " xid=0x%08x %sv%d %s ntrans=%d timeout=%lu", 1104 __entry->task_id, __entry->client_id, __entry->xid, 1105 __get_str(progname), __entry->version, __get_str(procname), 1106 __entry->ntrans, __entry->timeout 1107 ) 1108 ); 1109 1110 TRACE_EVENT(xprt_ping, 1111 TP_PROTO(const struct rpc_xprt *xprt, int status), 1112 1113 TP_ARGS(xprt, status), 1114 1115 TP_STRUCT__entry( 1116 __field(int, status) 1117 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR]) 1118 __string(port, xprt->address_strings[RPC_DISPLAY_PORT]) 1119 ), 1120 1121 TP_fast_assign( 1122 __entry->status = status; 1123 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]); 1124 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]); 1125 ), 1126 1127 TP_printk("peer=[%s]:%s status=%d", 1128 __get_str(addr), __get_str(port), __entry->status) 1129 ); 1130 1131 DECLARE_EVENT_CLASS(xprt_writelock_event, 1132 TP_PROTO( 1133 const struct rpc_xprt *xprt, const struct rpc_task *task 1134 ), 1135 1136 TP_ARGS(xprt, task), 1137 1138 TP_STRUCT__entry( 1139 __field(unsigned int, task_id) 1140 __field(unsigned int, client_id) 1141 __field(unsigned int, snd_task_id) 1142 ), 1143 1144 TP_fast_assign( 1145 if (task) { 1146 __entry->task_id = task->tk_pid; 1147 __entry->client_id = task->tk_client ? 1148 task->tk_client->cl_clid : -1; 1149 } else { 1150 __entry->task_id = -1; 1151 __entry->client_id = -1; 1152 } 1153 __entry->snd_task_id = xprt->snd_task ? 1154 xprt->snd_task->tk_pid : -1; 1155 ), 1156 1157 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 1158 " snd_task:" SUNRPC_TRACE_PID_SPECIFIER, 1159 __entry->task_id, __entry->client_id, 1160 __entry->snd_task_id) 1161 ); 1162 1163 #define DEFINE_WRITELOCK_EVENT(name) \ 1164 DEFINE_EVENT(xprt_writelock_event, xprt_##name, \ 1165 TP_PROTO( \ 1166 const struct rpc_xprt *xprt, \ 1167 const struct rpc_task *task \ 1168 ), \ 1169 TP_ARGS(xprt, task)) 1170 1171 DEFINE_WRITELOCK_EVENT(reserve_xprt); 1172 DEFINE_WRITELOCK_EVENT(release_xprt); 1173 1174 DECLARE_EVENT_CLASS(xprt_cong_event, 1175 TP_PROTO( 1176 const struct rpc_xprt *xprt, const struct rpc_task *task 1177 ), 1178 1179 TP_ARGS(xprt, task), 1180 1181 TP_STRUCT__entry( 1182 __field(unsigned int, task_id) 1183 __field(unsigned int, client_id) 1184 __field(unsigned int, snd_task_id) 1185 __field(unsigned long, cong) 1186 __field(unsigned long, cwnd) 1187 __field(bool, wait) 1188 ), 1189 1190 TP_fast_assign( 1191 if (task) { 1192 __entry->task_id = task->tk_pid; 1193 __entry->client_id = task->tk_client ? 1194 task->tk_client->cl_clid : -1; 1195 } else { 1196 __entry->task_id = -1; 1197 __entry->client_id = -1; 1198 } 1199 __entry->snd_task_id = xprt->snd_task ? 1200 xprt->snd_task->tk_pid : -1; 1201 __entry->cong = xprt->cong; 1202 __entry->cwnd = xprt->cwnd; 1203 __entry->wait = test_bit(XPRT_CWND_WAIT, &xprt->state); 1204 ), 1205 1206 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 1207 " snd_task:" SUNRPC_TRACE_PID_SPECIFIER 1208 " cong=%lu cwnd=%lu%s", 1209 __entry->task_id, __entry->client_id, 1210 __entry->snd_task_id, __entry->cong, __entry->cwnd, 1211 __entry->wait ? " (wait)" : "") 1212 ); 1213 1214 #define DEFINE_CONG_EVENT(name) \ 1215 DEFINE_EVENT(xprt_cong_event, xprt_##name, \ 1216 TP_PROTO( \ 1217 const struct rpc_xprt *xprt, \ 1218 const struct rpc_task *task \ 1219 ), \ 1220 TP_ARGS(xprt, task)) 1221 1222 DEFINE_CONG_EVENT(reserve_cong); 1223 DEFINE_CONG_EVENT(release_cong); 1224 DEFINE_CONG_EVENT(get_cong); 1225 DEFINE_CONG_EVENT(put_cong); 1226 1227 TRACE_EVENT(xprt_reserve, 1228 TP_PROTO( 1229 const struct rpc_rqst *rqst 1230 ), 1231 1232 TP_ARGS(rqst), 1233 1234 TP_STRUCT__entry( 1235 __field(unsigned int, task_id) 1236 __field(unsigned int, client_id) 1237 __field(u32, xid) 1238 ), 1239 1240 TP_fast_assign( 1241 __entry->task_id = rqst->rq_task->tk_pid; 1242 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 1243 __entry->xid = be32_to_cpu(rqst->rq_xid); 1244 ), 1245 1246 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x", 1247 __entry->task_id, __entry->client_id, __entry->xid 1248 ) 1249 ); 1250 1251 TRACE_EVENT(xs_stream_read_data, 1252 TP_PROTO(struct rpc_xprt *xprt, ssize_t err, size_t total), 1253 1254 TP_ARGS(xprt, err, total), 1255 1256 TP_STRUCT__entry( 1257 __field(ssize_t, err) 1258 __field(size_t, total) 1259 __string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] : 1260 "(null)") 1261 __string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] : 1262 "(null)") 1263 ), 1264 1265 TP_fast_assign( 1266 __entry->err = err; 1267 __entry->total = total; 1268 __assign_str(addr, xprt ? 1269 xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)"); 1270 __assign_str(port, xprt ? 1271 xprt->address_strings[RPC_DISPLAY_PORT] : "(null)"); 1272 ), 1273 1274 TP_printk("peer=[%s]:%s err=%zd total=%zu", __get_str(addr), 1275 __get_str(port), __entry->err, __entry->total) 1276 ); 1277 1278 TRACE_EVENT(xs_stream_read_request, 1279 TP_PROTO(struct sock_xprt *xs), 1280 1281 TP_ARGS(xs), 1282 1283 TP_STRUCT__entry( 1284 __string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]) 1285 __string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]) 1286 __field(u32, xid) 1287 __field(unsigned long, copied) 1288 __field(unsigned int, reclen) 1289 __field(unsigned int, offset) 1290 ), 1291 1292 TP_fast_assign( 1293 __assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]); 1294 __assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]); 1295 __entry->xid = be32_to_cpu(xs->recv.xid); 1296 __entry->copied = xs->recv.copied; 1297 __entry->reclen = xs->recv.len; 1298 __entry->offset = xs->recv.offset; 1299 ), 1300 1301 TP_printk("peer=[%s]:%s xid=0x%08x copied=%lu reclen=%u offset=%u", 1302 __get_str(addr), __get_str(port), __entry->xid, 1303 __entry->copied, __entry->reclen, __entry->offset) 1304 ); 1305 1306 TRACE_EVENT(rpcb_getport, 1307 TP_PROTO( 1308 const struct rpc_clnt *clnt, 1309 const struct rpc_task *task, 1310 unsigned int bind_version 1311 ), 1312 1313 TP_ARGS(clnt, task, bind_version), 1314 1315 TP_STRUCT__entry( 1316 __field(unsigned int, task_id) 1317 __field(unsigned int, client_id) 1318 __field(unsigned int, program) 1319 __field(unsigned int, version) 1320 __field(int, protocol) 1321 __field(unsigned int, bind_version) 1322 __string(servername, task->tk_xprt->servername) 1323 ), 1324 1325 TP_fast_assign( 1326 __entry->task_id = task->tk_pid; 1327 __entry->client_id = clnt->cl_clid; 1328 __entry->program = clnt->cl_prog; 1329 __entry->version = clnt->cl_vers; 1330 __entry->protocol = task->tk_xprt->prot; 1331 __entry->bind_version = bind_version; 1332 __assign_str(servername, task->tk_xprt->servername); 1333 ), 1334 1335 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER 1336 " server=%s program=%u version=%u protocol=%d bind_version=%u", 1337 __entry->task_id, __entry->client_id, __get_str(servername), 1338 __entry->program, __entry->version, __entry->protocol, 1339 __entry->bind_version 1340 ) 1341 ); 1342 1343 TRACE_EVENT(rpcb_setport, 1344 TP_PROTO( 1345 const struct rpc_task *task, 1346 int status, 1347 unsigned short port 1348 ), 1349 1350 TP_ARGS(task, status, port), 1351 1352 TP_STRUCT__entry( 1353 __field(unsigned int, task_id) 1354 __field(unsigned int, client_id) 1355 __field(int, status) 1356 __field(unsigned short, port) 1357 ), 1358 1359 TP_fast_assign( 1360 __entry->task_id = task->tk_pid; 1361 __entry->client_id = task->tk_client->cl_clid; 1362 __entry->status = status; 1363 __entry->port = port; 1364 ), 1365 1366 TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " status=%d port=%u", 1367 __entry->task_id, __entry->client_id, 1368 __entry->status, __entry->port 1369 ) 1370 ); 1371 1372 TRACE_EVENT(pmap_register, 1373 TP_PROTO( 1374 u32 program, 1375 u32 version, 1376 int protocol, 1377 unsigned short port 1378 ), 1379 1380 TP_ARGS(program, version, protocol, port), 1381 1382 TP_STRUCT__entry( 1383 __field(unsigned int, program) 1384 __field(unsigned int, version) 1385 __field(int, protocol) 1386 __field(unsigned int, port) 1387 ), 1388 1389 TP_fast_assign( 1390 __entry->program = program; 1391 __entry->version = version; 1392 __entry->protocol = protocol; 1393 __entry->port = port; 1394 ), 1395 1396 TP_printk("program=%u version=%u protocol=%d port=%u", 1397 __entry->program, __entry->version, 1398 __entry->protocol, __entry->port 1399 ) 1400 ); 1401 1402 TRACE_EVENT(rpcb_register, 1403 TP_PROTO( 1404 u32 program, 1405 u32 version, 1406 const char *addr, 1407 const char *netid 1408 ), 1409 1410 TP_ARGS(program, version, addr, netid), 1411 1412 TP_STRUCT__entry( 1413 __field(unsigned int, program) 1414 __field(unsigned int, version) 1415 __string(addr, addr) 1416 __string(netid, netid) 1417 ), 1418 1419 TP_fast_assign( 1420 __entry->program = program; 1421 __entry->version = version; 1422 __assign_str(addr, addr); 1423 __assign_str(netid, netid); 1424 ), 1425 1426 TP_printk("program=%u version=%u addr=%s netid=%s", 1427 __entry->program, __entry->version, 1428 __get_str(addr), __get_str(netid) 1429 ) 1430 ); 1431 1432 TRACE_EVENT(rpcb_unregister, 1433 TP_PROTO( 1434 u32 program, 1435 u32 version, 1436 const char *netid 1437 ), 1438 1439 TP_ARGS(program, version, netid), 1440 1441 TP_STRUCT__entry( 1442 __field(unsigned int, program) 1443 __field(unsigned int, version) 1444 __string(netid, netid) 1445 ), 1446 1447 TP_fast_assign( 1448 __entry->program = program; 1449 __entry->version = version; 1450 __assign_str(netid, netid); 1451 ), 1452 1453 TP_printk("program=%u version=%u netid=%s", 1454 __entry->program, __entry->version, __get_str(netid) 1455 ) 1456 ); 1457 1458 /* Record an xdr_buf containing a fully-formed RPC message */ 1459 DECLARE_EVENT_CLASS(svc_xdr_msg_class, 1460 TP_PROTO( 1461 const struct xdr_buf *xdr 1462 ), 1463 1464 TP_ARGS(xdr), 1465 1466 TP_STRUCT__entry( 1467 __field(u32, xid) 1468 __field(const void *, head_base) 1469 __field(size_t, head_len) 1470 __field(const void *, tail_base) 1471 __field(size_t, tail_len) 1472 __field(unsigned int, page_len) 1473 __field(unsigned int, msg_len) 1474 ), 1475 1476 TP_fast_assign( 1477 __be32 *p = (__be32 *)xdr->head[0].iov_base; 1478 1479 __entry->xid = be32_to_cpu(*p); 1480 __entry->head_base = p; 1481 __entry->head_len = xdr->head[0].iov_len; 1482 __entry->tail_base = xdr->tail[0].iov_base; 1483 __entry->tail_len = xdr->tail[0].iov_len; 1484 __entry->page_len = xdr->page_len; 1485 __entry->msg_len = xdr->len; 1486 ), 1487 1488 TP_printk("xid=0x%08x head=[%p,%zu] page=%u tail=[%p,%zu] len=%u", 1489 __entry->xid, 1490 __entry->head_base, __entry->head_len, __entry->page_len, 1491 __entry->tail_base, __entry->tail_len, __entry->msg_len 1492 ) 1493 ); 1494 1495 #define DEFINE_SVCXDRMSG_EVENT(name) \ 1496 DEFINE_EVENT(svc_xdr_msg_class, \ 1497 svc_xdr_##name, \ 1498 TP_PROTO( \ 1499 const struct xdr_buf *xdr \ 1500 ), \ 1501 TP_ARGS(xdr)) 1502 1503 DEFINE_SVCXDRMSG_EVENT(recvfrom); 1504 1505 /* Record an xdr_buf containing arbitrary data, tagged with an XID */ 1506 DECLARE_EVENT_CLASS(svc_xdr_buf_class, 1507 TP_PROTO( 1508 __be32 xid, 1509 const struct xdr_buf *xdr 1510 ), 1511 1512 TP_ARGS(xid, xdr), 1513 1514 TP_STRUCT__entry( 1515 __field(u32, xid) 1516 __field(const void *, head_base) 1517 __field(size_t, head_len) 1518 __field(const void *, tail_base) 1519 __field(size_t, tail_len) 1520 __field(unsigned int, page_base) 1521 __field(unsigned int, page_len) 1522 __field(unsigned int, msg_len) 1523 ), 1524 1525 TP_fast_assign( 1526 __entry->xid = be32_to_cpu(xid); 1527 __entry->head_base = xdr->head[0].iov_base; 1528 __entry->head_len = xdr->head[0].iov_len; 1529 __entry->tail_base = xdr->tail[0].iov_base; 1530 __entry->tail_len = xdr->tail[0].iov_len; 1531 __entry->page_base = xdr->page_base; 1532 __entry->page_len = xdr->page_len; 1533 __entry->msg_len = xdr->len; 1534 ), 1535 1536 TP_printk("xid=0x%08x head=[%p,%zu] page=%u(%u) tail=[%p,%zu] len=%u", 1537 __entry->xid, 1538 __entry->head_base, __entry->head_len, 1539 __entry->page_len, __entry->page_base, 1540 __entry->tail_base, __entry->tail_len, 1541 __entry->msg_len 1542 ) 1543 ); 1544 1545 #define DEFINE_SVCXDRBUF_EVENT(name) \ 1546 DEFINE_EVENT(svc_xdr_buf_class, \ 1547 svc_xdr_##name, \ 1548 TP_PROTO( \ 1549 __be32 xid, \ 1550 const struct xdr_buf *xdr \ 1551 ), \ 1552 TP_ARGS(xid, xdr)) 1553 1554 DEFINE_SVCXDRBUF_EVENT(sendto); 1555 1556 /* 1557 * from include/linux/sunrpc/svc.h 1558 */ 1559 #define SVC_RQST_FLAG_LIST \ 1560 svc_rqst_flag(SECURE) \ 1561 svc_rqst_flag(LOCAL) \ 1562 svc_rqst_flag(USEDEFERRAL) \ 1563 svc_rqst_flag(DROPME) \ 1564 svc_rqst_flag(SPLICE_OK) \ 1565 svc_rqst_flag(VICTIM) \ 1566 svc_rqst_flag(BUSY) \ 1567 svc_rqst_flag_end(DATA) 1568 1569 #undef svc_rqst_flag 1570 #undef svc_rqst_flag_end 1571 #define svc_rqst_flag(x) TRACE_DEFINE_ENUM(RQ_##x); 1572 #define svc_rqst_flag_end(x) TRACE_DEFINE_ENUM(RQ_##x); 1573 1574 SVC_RQST_FLAG_LIST 1575 1576 #undef svc_rqst_flag 1577 #undef svc_rqst_flag_end 1578 #define svc_rqst_flag(x) { BIT(RQ_##x), #x }, 1579 #define svc_rqst_flag_end(x) { BIT(RQ_##x), #x } 1580 1581 #define show_rqstp_flags(flags) \ 1582 __print_flags(flags, "|", SVC_RQST_FLAG_LIST) 1583 1584 TRACE_DEFINE_ENUM(SVC_GARBAGE); 1585 TRACE_DEFINE_ENUM(SVC_SYSERR); 1586 TRACE_DEFINE_ENUM(SVC_VALID); 1587 TRACE_DEFINE_ENUM(SVC_NEGATIVE); 1588 TRACE_DEFINE_ENUM(SVC_OK); 1589 TRACE_DEFINE_ENUM(SVC_DROP); 1590 TRACE_DEFINE_ENUM(SVC_CLOSE); 1591 TRACE_DEFINE_ENUM(SVC_DENIED); 1592 TRACE_DEFINE_ENUM(SVC_PENDING); 1593 TRACE_DEFINE_ENUM(SVC_COMPLETE); 1594 1595 #define svc_show_status(status) \ 1596 __print_symbolic(status, \ 1597 { SVC_GARBAGE, "SVC_GARBAGE" }, \ 1598 { SVC_SYSERR, "SVC_SYSERR" }, \ 1599 { SVC_VALID, "SVC_VALID" }, \ 1600 { SVC_NEGATIVE, "SVC_NEGATIVE" }, \ 1601 { SVC_OK, "SVC_OK" }, \ 1602 { SVC_DROP, "SVC_DROP" }, \ 1603 { SVC_CLOSE, "SVC_CLOSE" }, \ 1604 { SVC_DENIED, "SVC_DENIED" }, \ 1605 { SVC_PENDING, "SVC_PENDING" }, \ 1606 { SVC_COMPLETE, "SVC_COMPLETE" }) 1607 1608 TRACE_EVENT(svc_authenticate, 1609 TP_PROTO(const struct svc_rqst *rqst, int auth_res), 1610 1611 TP_ARGS(rqst, auth_res), 1612 1613 TP_STRUCT__entry( 1614 __field(u32, xid) 1615 __field(unsigned long, svc_status) 1616 __field(unsigned long, auth_stat) 1617 ), 1618 1619 TP_fast_assign( 1620 __entry->xid = be32_to_cpu(rqst->rq_xid); 1621 __entry->svc_status = auth_res; 1622 __entry->auth_stat = be32_to_cpu(rqst->rq_auth_stat); 1623 ), 1624 1625 TP_printk("xid=0x%08x auth_res=%s auth_stat=%s", 1626 __entry->xid, svc_show_status(__entry->svc_status), 1627 rpc_show_auth_stat(__entry->auth_stat)) 1628 ); 1629 1630 TRACE_EVENT(svc_process, 1631 TP_PROTO(const struct svc_rqst *rqst, const char *name), 1632 1633 TP_ARGS(rqst, name), 1634 1635 TP_STRUCT__entry( 1636 __field(u32, xid) 1637 __field(u32, vers) 1638 __field(u32, proc) 1639 __string(service, name) 1640 __string(procedure, svc_proc_name(rqst)) 1641 __string(addr, rqst->rq_xprt ? 1642 rqst->rq_xprt->xpt_remotebuf : "(null)") 1643 ), 1644 1645 TP_fast_assign( 1646 __entry->xid = be32_to_cpu(rqst->rq_xid); 1647 __entry->vers = rqst->rq_vers; 1648 __entry->proc = rqst->rq_proc; 1649 __assign_str(service, name); 1650 __assign_str(procedure, svc_proc_name(rqst)); 1651 __assign_str(addr, rqst->rq_xprt ? 1652 rqst->rq_xprt->xpt_remotebuf : "(null)"); 1653 ), 1654 1655 TP_printk("addr=%s xid=0x%08x service=%s vers=%u proc=%s", 1656 __get_str(addr), __entry->xid, 1657 __get_str(service), __entry->vers, 1658 __get_str(procedure) 1659 ) 1660 ); 1661 1662 DECLARE_EVENT_CLASS(svc_rqst_event, 1663 1664 TP_PROTO( 1665 const struct svc_rqst *rqst 1666 ), 1667 1668 TP_ARGS(rqst), 1669 1670 TP_STRUCT__entry( 1671 __field(u32, xid) 1672 __field(unsigned long, flags) 1673 __string(addr, rqst->rq_xprt->xpt_remotebuf) 1674 ), 1675 1676 TP_fast_assign( 1677 __entry->xid = be32_to_cpu(rqst->rq_xid); 1678 __entry->flags = rqst->rq_flags; 1679 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 1680 ), 1681 1682 TP_printk("addr=%s xid=0x%08x flags=%s", 1683 __get_str(addr), __entry->xid, 1684 show_rqstp_flags(__entry->flags)) 1685 ); 1686 #define DEFINE_SVC_RQST_EVENT(name) \ 1687 DEFINE_EVENT(svc_rqst_event, svc_##name, \ 1688 TP_PROTO( \ 1689 const struct svc_rqst *rqst \ 1690 ), \ 1691 TP_ARGS(rqst)) 1692 1693 DEFINE_SVC_RQST_EVENT(defer); 1694 DEFINE_SVC_RQST_EVENT(drop); 1695 1696 DECLARE_EVENT_CLASS(svc_rqst_status, 1697 1698 TP_PROTO(struct svc_rqst *rqst, int status), 1699 1700 TP_ARGS(rqst, status), 1701 1702 TP_STRUCT__entry( 1703 __field(u32, xid) 1704 __field(int, status) 1705 __field(unsigned long, flags) 1706 __string(addr, rqst->rq_xprt->xpt_remotebuf) 1707 ), 1708 1709 TP_fast_assign( 1710 __entry->xid = be32_to_cpu(rqst->rq_xid); 1711 __entry->status = status; 1712 __entry->flags = rqst->rq_flags; 1713 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 1714 ), 1715 1716 TP_printk("addr=%s xid=0x%08x status=%d flags=%s", 1717 __get_str(addr), __entry->xid, 1718 __entry->status, show_rqstp_flags(__entry->flags)) 1719 ); 1720 1721 DEFINE_EVENT(svc_rqst_status, svc_send, 1722 TP_PROTO(struct svc_rqst *rqst, int status), 1723 TP_ARGS(rqst, status)); 1724 1725 #define show_svc_xprt_flags(flags) \ 1726 __print_flags(flags, "|", \ 1727 { (1UL << XPT_BUSY), "XPT_BUSY"}, \ 1728 { (1UL << XPT_CONN), "XPT_CONN"}, \ 1729 { (1UL << XPT_CLOSE), "XPT_CLOSE"}, \ 1730 { (1UL << XPT_DATA), "XPT_DATA"}, \ 1731 { (1UL << XPT_TEMP), "XPT_TEMP"}, \ 1732 { (1UL << XPT_DEAD), "XPT_DEAD"}, \ 1733 { (1UL << XPT_CHNGBUF), "XPT_CHNGBUF"}, \ 1734 { (1UL << XPT_DEFERRED), "XPT_DEFERRED"}, \ 1735 { (1UL << XPT_OLD), "XPT_OLD"}, \ 1736 { (1UL << XPT_LISTENER), "XPT_LISTENER"}, \ 1737 { (1UL << XPT_CACHE_AUTH), "XPT_CACHE_AUTH"}, \ 1738 { (1UL << XPT_LOCAL), "XPT_LOCAL"}, \ 1739 { (1UL << XPT_KILL_TEMP), "XPT_KILL_TEMP"}, \ 1740 { (1UL << XPT_CONG_CTRL), "XPT_CONG_CTRL"}) 1741 1742 TRACE_EVENT(svc_xprt_create_err, 1743 TP_PROTO( 1744 const char *program, 1745 const char *protocol, 1746 struct sockaddr *sap, 1747 const struct svc_xprt *xprt 1748 ), 1749 1750 TP_ARGS(program, protocol, sap, xprt), 1751 1752 TP_STRUCT__entry( 1753 __field(long, error) 1754 __string(program, program) 1755 __string(protocol, protocol) 1756 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 1757 ), 1758 1759 TP_fast_assign( 1760 __entry->error = PTR_ERR(xprt); 1761 __assign_str(program, program); 1762 __assign_str(protocol, protocol); 1763 memcpy(__entry->addr, sap, sizeof(__entry->addr)); 1764 ), 1765 1766 TP_printk("addr=%pISpc program=%s protocol=%s error=%ld", 1767 __entry->addr, __get_str(program), __get_str(protocol), 1768 __entry->error) 1769 ); 1770 1771 TRACE_EVENT(svc_xprt_do_enqueue, 1772 TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst), 1773 1774 TP_ARGS(xprt, rqst), 1775 1776 TP_STRUCT__entry( 1777 __field(int, pid) 1778 __field(unsigned long, flags) 1779 __string(addr, xprt->xpt_remotebuf) 1780 ), 1781 1782 TP_fast_assign( 1783 __entry->pid = rqst? rqst->rq_task->pid : 0; 1784 __entry->flags = xprt->xpt_flags; 1785 __assign_str(addr, xprt->xpt_remotebuf); 1786 ), 1787 1788 TP_printk("addr=%s pid=%d flags=%s", __get_str(addr), 1789 __entry->pid, show_svc_xprt_flags(__entry->flags)) 1790 ); 1791 1792 DECLARE_EVENT_CLASS(svc_xprt_event, 1793 TP_PROTO(struct svc_xprt *xprt), 1794 1795 TP_ARGS(xprt), 1796 1797 TP_STRUCT__entry( 1798 __field(unsigned long, flags) 1799 __string(addr, xprt->xpt_remotebuf) 1800 ), 1801 1802 TP_fast_assign( 1803 __entry->flags = xprt->xpt_flags; 1804 __assign_str(addr, xprt->xpt_remotebuf); 1805 ), 1806 1807 TP_printk("addr=%s flags=%s", __get_str(addr), 1808 show_svc_xprt_flags(__entry->flags)) 1809 ); 1810 1811 #define DEFINE_SVC_XPRT_EVENT(name) \ 1812 DEFINE_EVENT(svc_xprt_event, svc_xprt_##name, \ 1813 TP_PROTO( \ 1814 struct svc_xprt *xprt \ 1815 ), \ 1816 TP_ARGS(xprt)) 1817 1818 DEFINE_SVC_XPRT_EVENT(received); 1819 DEFINE_SVC_XPRT_EVENT(no_write_space); 1820 DEFINE_SVC_XPRT_EVENT(close); 1821 DEFINE_SVC_XPRT_EVENT(detach); 1822 DEFINE_SVC_XPRT_EVENT(free); 1823 1824 TRACE_EVENT(svc_xprt_accept, 1825 TP_PROTO( 1826 const struct svc_xprt *xprt, 1827 const char *service 1828 ), 1829 1830 TP_ARGS(xprt, service), 1831 1832 TP_STRUCT__entry( 1833 __string(addr, xprt->xpt_remotebuf) 1834 __string(protocol, xprt->xpt_class->xcl_name) 1835 __string(service, service) 1836 ), 1837 1838 TP_fast_assign( 1839 __assign_str(addr, xprt->xpt_remotebuf); 1840 __assign_str(protocol, xprt->xpt_class->xcl_name); 1841 __assign_str(service, service); 1842 ), 1843 1844 TP_printk("addr=%s protocol=%s service=%s", 1845 __get_str(addr), __get_str(protocol), __get_str(service) 1846 ) 1847 ); 1848 1849 TRACE_EVENT(svc_xprt_dequeue, 1850 TP_PROTO(struct svc_rqst *rqst), 1851 1852 TP_ARGS(rqst), 1853 1854 TP_STRUCT__entry( 1855 __field(unsigned long, flags) 1856 __field(unsigned long, wakeup) 1857 __string(addr, rqst->rq_xprt->xpt_remotebuf) 1858 ), 1859 1860 TP_fast_assign( 1861 __entry->flags = rqst->rq_xprt->xpt_flags; 1862 __entry->wakeup = ktime_to_us(ktime_sub(ktime_get(), 1863 rqst->rq_qtime)); 1864 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 1865 ), 1866 1867 TP_printk("addr=%s flags=%s wakeup-us=%lu", __get_str(addr), 1868 show_svc_xprt_flags(__entry->flags), __entry->wakeup) 1869 ); 1870 1871 TRACE_EVENT(svc_wake_up, 1872 TP_PROTO(int pid), 1873 1874 TP_ARGS(pid), 1875 1876 TP_STRUCT__entry( 1877 __field(int, pid) 1878 ), 1879 1880 TP_fast_assign( 1881 __entry->pid = pid; 1882 ), 1883 1884 TP_printk("pid=%d", __entry->pid) 1885 ); 1886 1887 TRACE_EVENT(svc_alloc_arg_err, 1888 TP_PROTO( 1889 unsigned int pages 1890 ), 1891 1892 TP_ARGS(pages), 1893 1894 TP_STRUCT__entry( 1895 __field(unsigned int, pages) 1896 ), 1897 1898 TP_fast_assign( 1899 __entry->pages = pages; 1900 ), 1901 1902 TP_printk("pages=%u", __entry->pages) 1903 ); 1904 1905 TRACE_EVENT(svc_handle_xprt, 1906 TP_PROTO(struct svc_xprt *xprt, int len), 1907 1908 TP_ARGS(xprt, len), 1909 1910 TP_STRUCT__entry( 1911 __field(int, len) 1912 __field(unsigned long, flags) 1913 __string(addr, xprt->xpt_remotebuf) 1914 ), 1915 1916 TP_fast_assign( 1917 __entry->len = len; 1918 __entry->flags = xprt->xpt_flags; 1919 __assign_str(addr, xprt->xpt_remotebuf); 1920 ), 1921 1922 TP_printk("addr=%s len=%d flags=%s", __get_str(addr), 1923 __entry->len, show_svc_xprt_flags(__entry->flags)) 1924 ); 1925 1926 TRACE_EVENT(svc_stats_latency, 1927 TP_PROTO(const struct svc_rqst *rqst), 1928 1929 TP_ARGS(rqst), 1930 1931 TP_STRUCT__entry( 1932 __field(u32, xid) 1933 __field(unsigned long, execute) 1934 __string(procedure, svc_proc_name(rqst)) 1935 __string(addr, rqst->rq_xprt->xpt_remotebuf) 1936 ), 1937 1938 TP_fast_assign( 1939 __entry->xid = be32_to_cpu(rqst->rq_xid); 1940 __entry->execute = ktime_to_us(ktime_sub(ktime_get(), 1941 rqst->rq_stime)); 1942 __assign_str(procedure, svc_proc_name(rqst)); 1943 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 1944 ), 1945 1946 TP_printk("addr=%s xid=0x%08x proc=%s execute-us=%lu", 1947 __get_str(addr), __entry->xid, __get_str(procedure), 1948 __entry->execute) 1949 ); 1950 1951 DECLARE_EVENT_CLASS(svc_deferred_event, 1952 TP_PROTO( 1953 const struct svc_deferred_req *dr 1954 ), 1955 1956 TP_ARGS(dr), 1957 1958 TP_STRUCT__entry( 1959 __field(const void *, dr) 1960 __field(u32, xid) 1961 __string(addr, dr->xprt->xpt_remotebuf) 1962 ), 1963 1964 TP_fast_assign( 1965 __entry->dr = dr; 1966 __entry->xid = be32_to_cpu(*(__be32 *)(dr->args + 1967 (dr->xprt_hlen>>2))); 1968 __assign_str(addr, dr->xprt->xpt_remotebuf); 1969 ), 1970 1971 TP_printk("addr=%s dr=%p xid=0x%08x", __get_str(addr), __entry->dr, 1972 __entry->xid) 1973 ); 1974 1975 #define DEFINE_SVC_DEFERRED_EVENT(name) \ 1976 DEFINE_EVENT(svc_deferred_event, svc_defer_##name, \ 1977 TP_PROTO( \ 1978 const struct svc_deferred_req *dr \ 1979 ), \ 1980 TP_ARGS(dr)) 1981 1982 DEFINE_SVC_DEFERRED_EVENT(drop); 1983 DEFINE_SVC_DEFERRED_EVENT(queue); 1984 DEFINE_SVC_DEFERRED_EVENT(recv); 1985 1986 TRACE_EVENT(svcsock_new_socket, 1987 TP_PROTO( 1988 const struct socket *socket 1989 ), 1990 1991 TP_ARGS(socket), 1992 1993 TP_STRUCT__entry( 1994 __field(unsigned long, type) 1995 __field(unsigned long, family) 1996 __field(bool, listener) 1997 ), 1998 1999 TP_fast_assign( 2000 __entry->type = socket->type; 2001 __entry->family = socket->sk->sk_family; 2002 __entry->listener = (socket->sk->sk_state == TCP_LISTEN); 2003 ), 2004 2005 TP_printk("type=%s family=%s%s", 2006 show_socket_type(__entry->type), 2007 rpc_show_address_family(__entry->family), 2008 __entry->listener ? " (listener)" : "" 2009 ) 2010 ); 2011 2012 TRACE_EVENT(svcsock_marker, 2013 TP_PROTO( 2014 const struct svc_xprt *xprt, 2015 __be32 marker 2016 ), 2017 2018 TP_ARGS(xprt, marker), 2019 2020 TP_STRUCT__entry( 2021 __field(unsigned int, length) 2022 __field(bool, last) 2023 __string(addr, xprt->xpt_remotebuf) 2024 ), 2025 2026 TP_fast_assign( 2027 __entry->length = be32_to_cpu(marker) & RPC_FRAGMENT_SIZE_MASK; 2028 __entry->last = be32_to_cpu(marker) & RPC_LAST_STREAM_FRAGMENT; 2029 __assign_str(addr, xprt->xpt_remotebuf); 2030 ), 2031 2032 TP_printk("addr=%s length=%u%s", __get_str(addr), 2033 __entry->length, __entry->last ? " (last)" : "") 2034 ); 2035 2036 DECLARE_EVENT_CLASS(svcsock_class, 2037 TP_PROTO( 2038 const struct svc_xprt *xprt, 2039 ssize_t result 2040 ), 2041 2042 TP_ARGS(xprt, result), 2043 2044 TP_STRUCT__entry( 2045 __field(ssize_t, result) 2046 __field(unsigned long, flags) 2047 __string(addr, xprt->xpt_remotebuf) 2048 ), 2049 2050 TP_fast_assign( 2051 __entry->result = result; 2052 __entry->flags = xprt->xpt_flags; 2053 __assign_str(addr, xprt->xpt_remotebuf); 2054 ), 2055 2056 TP_printk("addr=%s result=%zd flags=%s", __get_str(addr), 2057 __entry->result, show_svc_xprt_flags(__entry->flags) 2058 ) 2059 ); 2060 2061 #define DEFINE_SVCSOCK_EVENT(name) \ 2062 DEFINE_EVENT(svcsock_class, svcsock_##name, \ 2063 TP_PROTO( \ 2064 const struct svc_xprt *xprt, \ 2065 ssize_t result \ 2066 ), \ 2067 TP_ARGS(xprt, result)) 2068 2069 DEFINE_SVCSOCK_EVENT(udp_send); 2070 DEFINE_SVCSOCK_EVENT(udp_recv); 2071 DEFINE_SVCSOCK_EVENT(udp_recv_err); 2072 DEFINE_SVCSOCK_EVENT(tcp_send); 2073 DEFINE_SVCSOCK_EVENT(tcp_recv); 2074 DEFINE_SVCSOCK_EVENT(tcp_recv_eagain); 2075 DEFINE_SVCSOCK_EVENT(tcp_recv_err); 2076 DEFINE_SVCSOCK_EVENT(data_ready); 2077 DEFINE_SVCSOCK_EVENT(write_space); 2078 2079 TRACE_EVENT(svcsock_tcp_recv_short, 2080 TP_PROTO( 2081 const struct svc_xprt *xprt, 2082 u32 expected, 2083 u32 received 2084 ), 2085 2086 TP_ARGS(xprt, expected, received), 2087 2088 TP_STRUCT__entry( 2089 __field(u32, expected) 2090 __field(u32, received) 2091 __field(unsigned long, flags) 2092 __string(addr, xprt->xpt_remotebuf) 2093 ), 2094 2095 TP_fast_assign( 2096 __entry->expected = expected; 2097 __entry->received = received; 2098 __entry->flags = xprt->xpt_flags; 2099 __assign_str(addr, xprt->xpt_remotebuf); 2100 ), 2101 2102 TP_printk("addr=%s flags=%s expected=%u received=%u", 2103 __get_str(addr), show_svc_xprt_flags(__entry->flags), 2104 __entry->expected, __entry->received 2105 ) 2106 ); 2107 2108 TRACE_EVENT(svcsock_tcp_state, 2109 TP_PROTO( 2110 const struct svc_xprt *xprt, 2111 const struct socket *socket 2112 ), 2113 2114 TP_ARGS(xprt, socket), 2115 2116 TP_STRUCT__entry( 2117 __field(unsigned long, socket_state) 2118 __field(unsigned long, sock_state) 2119 __field(unsigned long, flags) 2120 __string(addr, xprt->xpt_remotebuf) 2121 ), 2122 2123 TP_fast_assign( 2124 __entry->socket_state = socket->state; 2125 __entry->sock_state = socket->sk->sk_state; 2126 __entry->flags = xprt->xpt_flags; 2127 __assign_str(addr, xprt->xpt_remotebuf); 2128 ), 2129 2130 TP_printk("addr=%s state=%s sk_state=%s flags=%s", __get_str(addr), 2131 rpc_show_socket_state(__entry->socket_state), 2132 rpc_show_sock_state(__entry->sock_state), 2133 show_svc_xprt_flags(__entry->flags) 2134 ) 2135 ); 2136 2137 DECLARE_EVENT_CLASS(svcsock_accept_class, 2138 TP_PROTO( 2139 const struct svc_xprt *xprt, 2140 const char *service, 2141 long status 2142 ), 2143 2144 TP_ARGS(xprt, service, status), 2145 2146 TP_STRUCT__entry( 2147 __field(long, status) 2148 __string(service, service) 2149 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 2150 ), 2151 2152 TP_fast_assign( 2153 __entry->status = status; 2154 __assign_str(service, service); 2155 memcpy(__entry->addr, &xprt->xpt_local, sizeof(__entry->addr)); 2156 ), 2157 2158 TP_printk("listener=%pISpc service=%s status=%ld", 2159 __entry->addr, __get_str(service), __entry->status 2160 ) 2161 ); 2162 2163 #define DEFINE_ACCEPT_EVENT(name) \ 2164 DEFINE_EVENT(svcsock_accept_class, svcsock_##name##_err, \ 2165 TP_PROTO( \ 2166 const struct svc_xprt *xprt, \ 2167 const char *service, \ 2168 long status \ 2169 ), \ 2170 TP_ARGS(xprt, service, status)) 2171 2172 DEFINE_ACCEPT_EVENT(accept); 2173 DEFINE_ACCEPT_EVENT(getpeername); 2174 2175 DECLARE_EVENT_CLASS(cache_event, 2176 TP_PROTO( 2177 const struct cache_detail *cd, 2178 const struct cache_head *h 2179 ), 2180 2181 TP_ARGS(cd, h), 2182 2183 TP_STRUCT__entry( 2184 __field(const struct cache_head *, h) 2185 __string(name, cd->name) 2186 ), 2187 2188 TP_fast_assign( 2189 __entry->h = h; 2190 __assign_str(name, cd->name); 2191 ), 2192 2193 TP_printk("cache=%s entry=%p", __get_str(name), __entry->h) 2194 ); 2195 #define DEFINE_CACHE_EVENT(name) \ 2196 DEFINE_EVENT(cache_event, name, \ 2197 TP_PROTO( \ 2198 const struct cache_detail *cd, \ 2199 const struct cache_head *h \ 2200 ), \ 2201 TP_ARGS(cd, h)) 2202 DEFINE_CACHE_EVENT(cache_entry_expired); 2203 DEFINE_CACHE_EVENT(cache_entry_upcall); 2204 DEFINE_CACHE_EVENT(cache_entry_update); 2205 DEFINE_CACHE_EVENT(cache_entry_make_negative); 2206 DEFINE_CACHE_EVENT(cache_entry_no_listener); 2207 2208 DECLARE_EVENT_CLASS(register_class, 2209 TP_PROTO( 2210 const char *program, 2211 const u32 version, 2212 const int family, 2213 const unsigned short protocol, 2214 const unsigned short port, 2215 int error 2216 ), 2217 2218 TP_ARGS(program, version, family, protocol, port, error), 2219 2220 TP_STRUCT__entry( 2221 __field(u32, version) 2222 __field(unsigned long, family) 2223 __field(unsigned short, protocol) 2224 __field(unsigned short, port) 2225 __field(int, error) 2226 __string(program, program) 2227 ), 2228 2229 TP_fast_assign( 2230 __entry->version = version; 2231 __entry->family = family; 2232 __entry->protocol = protocol; 2233 __entry->port = port; 2234 __entry->error = error; 2235 __assign_str(program, program); 2236 ), 2237 2238 TP_printk("program=%sv%u proto=%s port=%u family=%s error=%d", 2239 __get_str(program), __entry->version, 2240 __entry->protocol == IPPROTO_UDP ? "udp" : "tcp", 2241 __entry->port, rpc_show_address_family(__entry->family), 2242 __entry->error 2243 ) 2244 ); 2245 2246 #define DEFINE_REGISTER_EVENT(name) \ 2247 DEFINE_EVENT(register_class, svc_##name, \ 2248 TP_PROTO( \ 2249 const char *program, \ 2250 const u32 version, \ 2251 const int family, \ 2252 const unsigned short protocol, \ 2253 const unsigned short port, \ 2254 int error \ 2255 ), \ 2256 TP_ARGS(program, version, family, protocol, \ 2257 port, error)) 2258 2259 DEFINE_REGISTER_EVENT(register); 2260 DEFINE_REGISTER_EVENT(noregister); 2261 2262 TRACE_EVENT(svc_unregister, 2263 TP_PROTO( 2264 const char *program, 2265 const u32 version, 2266 int error 2267 ), 2268 2269 TP_ARGS(program, version, error), 2270 2271 TP_STRUCT__entry( 2272 __field(u32, version) 2273 __field(int, error) 2274 __string(program, program) 2275 ), 2276 2277 TP_fast_assign( 2278 __entry->version = version; 2279 __entry->error = error; 2280 __assign_str(program, program); 2281 ), 2282 2283 TP_printk("program=%sv%u error=%d", 2284 __get_str(program), __entry->version, __entry->error 2285 ) 2286 ); 2287 2288 #endif /* _TRACE_SUNRPC_H */ 2289 2290 #include <trace/define_trace.h> 2291