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