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(bind); 263 DEFINE_RPC_STATUS_EVENT(connect); 264 265 TRACE_EVENT(rpc_request, 266 TP_PROTO(const struct rpc_task *task), 267 268 TP_ARGS(task), 269 270 TP_STRUCT__entry( 271 __field(unsigned int, task_id) 272 __field(unsigned int, client_id) 273 __field(int, version) 274 __field(bool, async) 275 __string(progname, task->tk_client->cl_program->name) 276 __string(procname, rpc_proc_name(task)) 277 ), 278 279 TP_fast_assign( 280 __entry->task_id = task->tk_pid; 281 __entry->client_id = task->tk_client->cl_clid; 282 __entry->version = task->tk_client->cl_vers; 283 __entry->async = RPC_IS_ASYNC(task); 284 __assign_str(progname, task->tk_client->cl_program->name) 285 __assign_str(procname, rpc_proc_name(task)) 286 ), 287 288 TP_printk("task:%u@%u %sv%d %s (%ssync)", 289 __entry->task_id, __entry->client_id, 290 __get_str(progname), __entry->version, 291 __get_str(procname), __entry->async ? "a": "" 292 ) 293 ); 294 295 TRACE_DEFINE_ENUM(RPC_TASK_ASYNC); 296 TRACE_DEFINE_ENUM(RPC_TASK_SWAPPER); 297 TRACE_DEFINE_ENUM(RPC_TASK_NULLCREDS); 298 TRACE_DEFINE_ENUM(RPC_CALL_MAJORSEEN); 299 TRACE_DEFINE_ENUM(RPC_TASK_ROOTCREDS); 300 TRACE_DEFINE_ENUM(RPC_TASK_DYNAMIC); 301 TRACE_DEFINE_ENUM(RPC_TASK_NO_ROUND_ROBIN); 302 TRACE_DEFINE_ENUM(RPC_TASK_SOFT); 303 TRACE_DEFINE_ENUM(RPC_TASK_SOFTCONN); 304 TRACE_DEFINE_ENUM(RPC_TASK_SENT); 305 TRACE_DEFINE_ENUM(RPC_TASK_TIMEOUT); 306 TRACE_DEFINE_ENUM(RPC_TASK_NOCONNECT); 307 TRACE_DEFINE_ENUM(RPC_TASK_NO_RETRANS_TIMEOUT); 308 TRACE_DEFINE_ENUM(RPC_TASK_CRED_NOREF); 309 310 #define rpc_show_task_flags(flags) \ 311 __print_flags(flags, "|", \ 312 { RPC_TASK_ASYNC, "ASYNC" }, \ 313 { RPC_TASK_SWAPPER, "SWAPPER" }, \ 314 { RPC_TASK_NULLCREDS, "NULLCREDS" }, \ 315 { RPC_CALL_MAJORSEEN, "MAJORSEEN" }, \ 316 { RPC_TASK_ROOTCREDS, "ROOTCREDS" }, \ 317 { RPC_TASK_DYNAMIC, "DYNAMIC" }, \ 318 { RPC_TASK_NO_ROUND_ROBIN, "NO_ROUND_ROBIN" }, \ 319 { RPC_TASK_SOFT, "SOFT" }, \ 320 { RPC_TASK_SOFTCONN, "SOFTCONN" }, \ 321 { RPC_TASK_SENT, "SENT" }, \ 322 { RPC_TASK_TIMEOUT, "TIMEOUT" }, \ 323 { RPC_TASK_NOCONNECT, "NOCONNECT" }, \ 324 { RPC_TASK_NO_RETRANS_TIMEOUT, "NORTO" }, \ 325 { RPC_TASK_CRED_NOREF, "CRED_NOREF" }) 326 327 TRACE_DEFINE_ENUM(RPC_TASK_RUNNING); 328 TRACE_DEFINE_ENUM(RPC_TASK_QUEUED); 329 TRACE_DEFINE_ENUM(RPC_TASK_ACTIVE); 330 TRACE_DEFINE_ENUM(RPC_TASK_NEED_XMIT); 331 TRACE_DEFINE_ENUM(RPC_TASK_NEED_RECV); 332 TRACE_DEFINE_ENUM(RPC_TASK_MSG_PIN_WAIT); 333 TRACE_DEFINE_ENUM(RPC_TASK_SIGNALLED); 334 335 #define rpc_show_runstate(flags) \ 336 __print_flags(flags, "|", \ 337 { (1UL << RPC_TASK_RUNNING), "RUNNING" }, \ 338 { (1UL << RPC_TASK_QUEUED), "QUEUED" }, \ 339 { (1UL << RPC_TASK_ACTIVE), "ACTIVE" }, \ 340 { (1UL << RPC_TASK_NEED_XMIT), "NEED_XMIT" }, \ 341 { (1UL << RPC_TASK_NEED_RECV), "NEED_RECV" }, \ 342 { (1UL << RPC_TASK_MSG_PIN_WAIT), "MSG_PIN_WAIT" }, \ 343 { (1UL << RPC_TASK_SIGNALLED), "SIGNALLED" }) 344 345 DECLARE_EVENT_CLASS(rpc_task_running, 346 347 TP_PROTO(const struct rpc_task *task, const void *action), 348 349 TP_ARGS(task, action), 350 351 TP_STRUCT__entry( 352 __field(unsigned int, task_id) 353 __field(unsigned int, client_id) 354 __field(const void *, action) 355 __field(unsigned long, runstate) 356 __field(int, status) 357 __field(unsigned short, flags) 358 ), 359 360 TP_fast_assign( 361 __entry->client_id = task->tk_client ? 362 task->tk_client->cl_clid : -1; 363 __entry->task_id = task->tk_pid; 364 __entry->action = action; 365 __entry->runstate = task->tk_runstate; 366 __entry->status = task->tk_status; 367 __entry->flags = task->tk_flags; 368 ), 369 370 TP_printk("task:%u@%d flags=%s runstate=%s status=%d action=%ps", 371 __entry->task_id, __entry->client_id, 372 rpc_show_task_flags(__entry->flags), 373 rpc_show_runstate(__entry->runstate), 374 __entry->status, 375 __entry->action 376 ) 377 ); 378 #define DEFINE_RPC_RUNNING_EVENT(name) \ 379 DEFINE_EVENT(rpc_task_running, rpc_task_##name, \ 380 TP_PROTO( \ 381 const struct rpc_task *task, \ 382 const void *action \ 383 ), \ 384 TP_ARGS(task, action)) 385 386 DEFINE_RPC_RUNNING_EVENT(begin); 387 DEFINE_RPC_RUNNING_EVENT(run_action); 388 DEFINE_RPC_RUNNING_EVENT(complete); 389 DEFINE_RPC_RUNNING_EVENT(signalled); 390 DEFINE_RPC_RUNNING_EVENT(end); 391 392 DECLARE_EVENT_CLASS(rpc_task_queued, 393 394 TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q), 395 396 TP_ARGS(task, q), 397 398 TP_STRUCT__entry( 399 __field(unsigned int, task_id) 400 __field(unsigned int, client_id) 401 __field(unsigned long, timeout) 402 __field(unsigned long, runstate) 403 __field(int, status) 404 __field(unsigned short, flags) 405 __string(q_name, rpc_qname(q)) 406 ), 407 408 TP_fast_assign( 409 __entry->client_id = task->tk_client ? 410 task->tk_client->cl_clid : -1; 411 __entry->task_id = task->tk_pid; 412 __entry->timeout = rpc_task_timeout(task); 413 __entry->runstate = task->tk_runstate; 414 __entry->status = task->tk_status; 415 __entry->flags = task->tk_flags; 416 __assign_str(q_name, rpc_qname(q)); 417 ), 418 419 TP_printk("task:%u@%d flags=%s runstate=%s status=%d timeout=%lu queue=%s", 420 __entry->task_id, __entry->client_id, 421 rpc_show_task_flags(__entry->flags), 422 rpc_show_runstate(__entry->runstate), 423 __entry->status, 424 __entry->timeout, 425 __get_str(q_name) 426 ) 427 ); 428 #define DEFINE_RPC_QUEUED_EVENT(name) \ 429 DEFINE_EVENT(rpc_task_queued, rpc_task_##name, \ 430 TP_PROTO( \ 431 const struct rpc_task *task, \ 432 const struct rpc_wait_queue *q \ 433 ), \ 434 TP_ARGS(task, q)) 435 436 DEFINE_RPC_QUEUED_EVENT(sleep); 437 DEFINE_RPC_QUEUED_EVENT(wakeup); 438 439 DECLARE_EVENT_CLASS(rpc_failure, 440 441 TP_PROTO(const struct rpc_task *task), 442 443 TP_ARGS(task), 444 445 TP_STRUCT__entry( 446 __field(unsigned int, task_id) 447 __field(unsigned int, client_id) 448 ), 449 450 TP_fast_assign( 451 __entry->task_id = task->tk_pid; 452 __entry->client_id = task->tk_client->cl_clid; 453 ), 454 455 TP_printk("task:%u@%u", 456 __entry->task_id, __entry->client_id) 457 ); 458 459 #define DEFINE_RPC_FAILURE(name) \ 460 DEFINE_EVENT(rpc_failure, rpc_bad_##name, \ 461 TP_PROTO( \ 462 const struct rpc_task *task \ 463 ), \ 464 TP_ARGS(task)) 465 466 DEFINE_RPC_FAILURE(callhdr); 467 DEFINE_RPC_FAILURE(verifier); 468 469 DECLARE_EVENT_CLASS(rpc_reply_event, 470 471 TP_PROTO( 472 const struct rpc_task *task 473 ), 474 475 TP_ARGS(task), 476 477 TP_STRUCT__entry( 478 __field(unsigned int, task_id) 479 __field(unsigned int, client_id) 480 __field(u32, xid) 481 __string(progname, task->tk_client->cl_program->name) 482 __field(u32, version) 483 __string(procname, rpc_proc_name(task)) 484 __string(servername, task->tk_xprt->servername) 485 ), 486 487 TP_fast_assign( 488 __entry->task_id = task->tk_pid; 489 __entry->client_id = task->tk_client->cl_clid; 490 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); 491 __assign_str(progname, task->tk_client->cl_program->name) 492 __entry->version = task->tk_client->cl_vers; 493 __assign_str(procname, rpc_proc_name(task)) 494 __assign_str(servername, task->tk_xprt->servername) 495 ), 496 497 TP_printk("task:%u@%d server=%s xid=0x%08x %sv%d %s", 498 __entry->task_id, __entry->client_id, __get_str(servername), 499 __entry->xid, __get_str(progname), __entry->version, 500 __get_str(procname)) 501 ) 502 503 #define DEFINE_RPC_REPLY_EVENT(name) \ 504 DEFINE_EVENT(rpc_reply_event, rpc__##name, \ 505 TP_PROTO( \ 506 const struct rpc_task *task \ 507 ), \ 508 TP_ARGS(task)) 509 510 DEFINE_RPC_REPLY_EVENT(prog_unavail); 511 DEFINE_RPC_REPLY_EVENT(prog_mismatch); 512 DEFINE_RPC_REPLY_EVENT(proc_unavail); 513 DEFINE_RPC_REPLY_EVENT(garbage_args); 514 DEFINE_RPC_REPLY_EVENT(unparsable); 515 DEFINE_RPC_REPLY_EVENT(mismatch); 516 DEFINE_RPC_REPLY_EVENT(stale_creds); 517 DEFINE_RPC_REPLY_EVENT(bad_creds); 518 DEFINE_RPC_REPLY_EVENT(auth_tooweak); 519 520 TRACE_EVENT(rpc_call_rpcerror, 521 TP_PROTO( 522 const struct rpc_task *task, 523 int tk_status, 524 int rpc_status 525 ), 526 527 TP_ARGS(task, tk_status, rpc_status), 528 529 TP_STRUCT__entry( 530 __field(unsigned int, task_id) 531 __field(unsigned int, client_id) 532 __field(int, tk_status) 533 __field(int, rpc_status) 534 ), 535 536 TP_fast_assign( 537 __entry->client_id = task->tk_client->cl_clid; 538 __entry->task_id = task->tk_pid; 539 __entry->tk_status = tk_status; 540 __entry->rpc_status = rpc_status; 541 ), 542 543 TP_printk("task:%u@%u tk_status=%d rpc_status=%d", 544 __entry->task_id, __entry->client_id, 545 __entry->tk_status, __entry->rpc_status) 546 ); 547 548 TRACE_EVENT(rpc_stats_latency, 549 550 TP_PROTO( 551 const struct rpc_task *task, 552 ktime_t backlog, 553 ktime_t rtt, 554 ktime_t execute 555 ), 556 557 TP_ARGS(task, backlog, rtt, execute), 558 559 TP_STRUCT__entry( 560 __field(unsigned int, task_id) 561 __field(unsigned int, client_id) 562 __field(u32, xid) 563 __field(int, version) 564 __string(progname, task->tk_client->cl_program->name) 565 __string(procname, rpc_proc_name(task)) 566 __field(unsigned long, backlog) 567 __field(unsigned long, rtt) 568 __field(unsigned long, execute) 569 ), 570 571 TP_fast_assign( 572 __entry->client_id = task->tk_client->cl_clid; 573 __entry->task_id = task->tk_pid; 574 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); 575 __entry->version = task->tk_client->cl_vers; 576 __assign_str(progname, task->tk_client->cl_program->name) 577 __assign_str(procname, rpc_proc_name(task)) 578 __entry->backlog = ktime_to_us(backlog); 579 __entry->rtt = ktime_to_us(rtt); 580 __entry->execute = ktime_to_us(execute); 581 ), 582 583 TP_printk("task:%u@%d xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu", 584 __entry->task_id, __entry->client_id, __entry->xid, 585 __get_str(progname), __entry->version, __get_str(procname), 586 __entry->backlog, __entry->rtt, __entry->execute) 587 ); 588 589 TRACE_EVENT(rpc_xdr_overflow, 590 TP_PROTO( 591 const struct xdr_stream *xdr, 592 size_t requested 593 ), 594 595 TP_ARGS(xdr, requested), 596 597 TP_STRUCT__entry( 598 __field(unsigned int, task_id) 599 __field(unsigned int, client_id) 600 __field(int, version) 601 __field(size_t, requested) 602 __field(const void *, end) 603 __field(const void *, p) 604 __field(const void *, head_base) 605 __field(size_t, head_len) 606 __field(const void *, tail_base) 607 __field(size_t, tail_len) 608 __field(unsigned int, page_len) 609 __field(unsigned int, len) 610 __string(progname, 611 xdr->rqst->rq_task->tk_client->cl_program->name) 612 __string(procedure, 613 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name) 614 ), 615 616 TP_fast_assign( 617 if (xdr->rqst) { 618 const struct rpc_task *task = xdr->rqst->rq_task; 619 620 __entry->task_id = task->tk_pid; 621 __entry->client_id = task->tk_client->cl_clid; 622 __assign_str(progname, 623 task->tk_client->cl_program->name) 624 __entry->version = task->tk_client->cl_vers; 625 __assign_str(procedure, task->tk_msg.rpc_proc->p_name) 626 } else { 627 __entry->task_id = 0; 628 __entry->client_id = 0; 629 __assign_str(progname, "unknown") 630 __entry->version = 0; 631 __assign_str(procedure, "unknown") 632 } 633 __entry->requested = requested; 634 __entry->end = xdr->end; 635 __entry->p = xdr->p; 636 __entry->head_base = xdr->buf->head[0].iov_base, 637 __entry->head_len = xdr->buf->head[0].iov_len, 638 __entry->page_len = xdr->buf->page_len, 639 __entry->tail_base = xdr->buf->tail[0].iov_base, 640 __entry->tail_len = xdr->buf->tail[0].iov_len, 641 __entry->len = xdr->buf->len; 642 ), 643 644 TP_printk( 645 "task:%u@%u %sv%d %s requested=%zu p=%p end=%p xdr=[%p,%zu]/%u/[%p,%zu]/%u\n", 646 __entry->task_id, __entry->client_id, 647 __get_str(progname), __entry->version, __get_str(procedure), 648 __entry->requested, __entry->p, __entry->end, 649 __entry->head_base, __entry->head_len, 650 __entry->page_len, 651 __entry->tail_base, __entry->tail_len, 652 __entry->len 653 ) 654 ); 655 656 TRACE_EVENT(rpc_xdr_alignment, 657 TP_PROTO( 658 const struct xdr_stream *xdr, 659 size_t offset, 660 unsigned int copied 661 ), 662 663 TP_ARGS(xdr, offset, copied), 664 665 TP_STRUCT__entry( 666 __field(unsigned int, task_id) 667 __field(unsigned int, client_id) 668 __field(int, version) 669 __field(size_t, offset) 670 __field(unsigned int, copied) 671 __field(const void *, head_base) 672 __field(size_t, head_len) 673 __field(const void *, tail_base) 674 __field(size_t, tail_len) 675 __field(unsigned int, page_len) 676 __field(unsigned int, len) 677 __string(progname, 678 xdr->rqst->rq_task->tk_client->cl_program->name) 679 __string(procedure, 680 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name) 681 ), 682 683 TP_fast_assign( 684 const struct rpc_task *task = xdr->rqst->rq_task; 685 686 __entry->task_id = task->tk_pid; 687 __entry->client_id = task->tk_client->cl_clid; 688 __assign_str(progname, 689 task->tk_client->cl_program->name) 690 __entry->version = task->tk_client->cl_vers; 691 __assign_str(procedure, task->tk_msg.rpc_proc->p_name) 692 693 __entry->offset = offset; 694 __entry->copied = copied; 695 __entry->head_base = xdr->buf->head[0].iov_base, 696 __entry->head_len = xdr->buf->head[0].iov_len, 697 __entry->page_len = xdr->buf->page_len, 698 __entry->tail_base = xdr->buf->tail[0].iov_base, 699 __entry->tail_len = xdr->buf->tail[0].iov_len, 700 __entry->len = xdr->buf->len; 701 ), 702 703 TP_printk( 704 "task:%u@%u %sv%d %s offset=%zu copied=%u xdr=[%p,%zu]/%u/[%p,%zu]/%u\n", 705 __entry->task_id, __entry->client_id, 706 __get_str(progname), __entry->version, __get_str(procedure), 707 __entry->offset, __entry->copied, 708 __entry->head_base, __entry->head_len, 709 __entry->page_len, 710 __entry->tail_base, __entry->tail_len, 711 __entry->len 712 ) 713 ); 714 715 /* 716 * First define the enums in the below macros to be exported to userspace 717 * via TRACE_DEFINE_ENUM(). 718 */ 719 #undef EM 720 #undef EMe 721 #define EM(a, b) TRACE_DEFINE_ENUM(a); 722 #define EMe(a, b) TRACE_DEFINE_ENUM(a); 723 724 #define RPC_SHOW_SOCKET \ 725 EM( SS_FREE, "FREE" ) \ 726 EM( SS_UNCONNECTED, "UNCONNECTED" ) \ 727 EM( SS_CONNECTING, "CONNECTING" ) \ 728 EM( SS_CONNECTED, "CONNECTED" ) \ 729 EMe( SS_DISCONNECTING, "DISCONNECTING" ) 730 731 #define rpc_show_socket_state(state) \ 732 __print_symbolic(state, RPC_SHOW_SOCKET) 733 734 RPC_SHOW_SOCKET 735 736 #define RPC_SHOW_SOCK \ 737 EM( TCP_ESTABLISHED, "ESTABLISHED" ) \ 738 EM( TCP_SYN_SENT, "SYN_SENT" ) \ 739 EM( TCP_SYN_RECV, "SYN_RECV" ) \ 740 EM( TCP_FIN_WAIT1, "FIN_WAIT1" ) \ 741 EM( TCP_FIN_WAIT2, "FIN_WAIT2" ) \ 742 EM( TCP_TIME_WAIT, "TIME_WAIT" ) \ 743 EM( TCP_CLOSE, "CLOSE" ) \ 744 EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" ) \ 745 EM( TCP_LAST_ACK, "LAST_ACK" ) \ 746 EM( TCP_LISTEN, "LISTEN" ) \ 747 EMe( TCP_CLOSING, "CLOSING" ) 748 749 #define rpc_show_sock_state(state) \ 750 __print_symbolic(state, RPC_SHOW_SOCK) 751 752 RPC_SHOW_SOCK 753 754 /* 755 * Now redefine the EM() and EMe() macros to map the enums to the strings 756 * that will be printed in the output. 757 */ 758 #undef EM 759 #undef EMe 760 #define EM(a, b) {a, b}, 761 #define EMe(a, b) {a, b} 762 763 DECLARE_EVENT_CLASS(xs_socket_event, 764 765 TP_PROTO( 766 struct rpc_xprt *xprt, 767 struct socket *socket 768 ), 769 770 TP_ARGS(xprt, socket), 771 772 TP_STRUCT__entry( 773 __field(unsigned int, socket_state) 774 __field(unsigned int, sock_state) 775 __field(unsigned long long, ino) 776 __string(dstaddr, 777 xprt->address_strings[RPC_DISPLAY_ADDR]) 778 __string(dstport, 779 xprt->address_strings[RPC_DISPLAY_PORT]) 780 ), 781 782 TP_fast_assign( 783 struct inode *inode = SOCK_INODE(socket); 784 __entry->socket_state = socket->state; 785 __entry->sock_state = socket->sk->sk_state; 786 __entry->ino = (unsigned long long)inode->i_ino; 787 __assign_str(dstaddr, 788 xprt->address_strings[RPC_DISPLAY_ADDR]); 789 __assign_str(dstport, 790 xprt->address_strings[RPC_DISPLAY_PORT]); 791 ), 792 793 TP_printk( 794 "socket:[%llu] dstaddr=%s/%s " 795 "state=%u (%s) sk_state=%u (%s)", 796 __entry->ino, __get_str(dstaddr), __get_str(dstport), 797 __entry->socket_state, 798 rpc_show_socket_state(__entry->socket_state), 799 __entry->sock_state, 800 rpc_show_sock_state(__entry->sock_state) 801 ) 802 ); 803 #define DEFINE_RPC_SOCKET_EVENT(name) \ 804 DEFINE_EVENT(xs_socket_event, name, \ 805 TP_PROTO( \ 806 struct rpc_xprt *xprt, \ 807 struct socket *socket \ 808 ), \ 809 TP_ARGS(xprt, socket)) 810 811 DECLARE_EVENT_CLASS(xs_socket_event_done, 812 813 TP_PROTO( 814 struct rpc_xprt *xprt, 815 struct socket *socket, 816 int error 817 ), 818 819 TP_ARGS(xprt, socket, error), 820 821 TP_STRUCT__entry( 822 __field(int, error) 823 __field(unsigned int, socket_state) 824 __field(unsigned int, sock_state) 825 __field(unsigned long long, ino) 826 __string(dstaddr, 827 xprt->address_strings[RPC_DISPLAY_ADDR]) 828 __string(dstport, 829 xprt->address_strings[RPC_DISPLAY_PORT]) 830 ), 831 832 TP_fast_assign( 833 struct inode *inode = SOCK_INODE(socket); 834 __entry->socket_state = socket->state; 835 __entry->sock_state = socket->sk->sk_state; 836 __entry->ino = (unsigned long long)inode->i_ino; 837 __entry->error = error; 838 __assign_str(dstaddr, 839 xprt->address_strings[RPC_DISPLAY_ADDR]); 840 __assign_str(dstport, 841 xprt->address_strings[RPC_DISPLAY_PORT]); 842 ), 843 844 TP_printk( 845 "error=%d socket:[%llu] dstaddr=%s/%s " 846 "state=%u (%s) sk_state=%u (%s)", 847 __entry->error, 848 __entry->ino, __get_str(dstaddr), __get_str(dstport), 849 __entry->socket_state, 850 rpc_show_socket_state(__entry->socket_state), 851 __entry->sock_state, 852 rpc_show_sock_state(__entry->sock_state) 853 ) 854 ); 855 #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \ 856 DEFINE_EVENT(xs_socket_event_done, name, \ 857 TP_PROTO( \ 858 struct rpc_xprt *xprt, \ 859 struct socket *socket, \ 860 int error \ 861 ), \ 862 TP_ARGS(xprt, socket, error)) 863 864 DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change); 865 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect); 866 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error); 867 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection); 868 DEFINE_RPC_SOCKET_EVENT(rpc_socket_close); 869 DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown); 870 871 TRACE_DEFINE_ENUM(XPRT_LOCKED); 872 TRACE_DEFINE_ENUM(XPRT_CONNECTED); 873 TRACE_DEFINE_ENUM(XPRT_CONNECTING); 874 TRACE_DEFINE_ENUM(XPRT_CLOSE_WAIT); 875 TRACE_DEFINE_ENUM(XPRT_BOUND); 876 TRACE_DEFINE_ENUM(XPRT_BINDING); 877 TRACE_DEFINE_ENUM(XPRT_CLOSING); 878 TRACE_DEFINE_ENUM(XPRT_CONGESTED); 879 TRACE_DEFINE_ENUM(XPRT_CWND_WAIT); 880 TRACE_DEFINE_ENUM(XPRT_WRITE_SPACE); 881 882 #define rpc_show_xprt_state(x) \ 883 __print_flags(x, "|", \ 884 { (1UL << XPRT_LOCKED), "LOCKED"}, \ 885 { (1UL << XPRT_CONNECTED), "CONNECTED"}, \ 886 { (1UL << XPRT_CONNECTING), "CONNECTING"}, \ 887 { (1UL << XPRT_CLOSE_WAIT), "CLOSE_WAIT"}, \ 888 { (1UL << XPRT_BOUND), "BOUND"}, \ 889 { (1UL << XPRT_BINDING), "BINDING"}, \ 890 { (1UL << XPRT_CLOSING), "CLOSING"}, \ 891 { (1UL << XPRT_CONGESTED), "CONGESTED"}, \ 892 { (1UL << XPRT_CWND_WAIT), "CWND_WAIT"}, \ 893 { (1UL << XPRT_WRITE_SPACE), "WRITE_SPACE"}) 894 895 DECLARE_EVENT_CLASS(rpc_xprt_lifetime_class, 896 TP_PROTO( 897 const struct rpc_xprt *xprt 898 ), 899 900 TP_ARGS(xprt), 901 902 TP_STRUCT__entry( 903 __field(unsigned long, state) 904 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR]) 905 __string(port, xprt->address_strings[RPC_DISPLAY_PORT]) 906 ), 907 908 TP_fast_assign( 909 __entry->state = xprt->state; 910 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]); 911 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]); 912 ), 913 914 TP_printk("peer=[%s]:%s state=%s", 915 __get_str(addr), __get_str(port), 916 rpc_show_xprt_state(__entry->state)) 917 ); 918 919 #define DEFINE_RPC_XPRT_LIFETIME_EVENT(name) \ 920 DEFINE_EVENT(rpc_xprt_lifetime_class, \ 921 xprt_##name, \ 922 TP_PROTO( \ 923 const struct rpc_xprt *xprt \ 924 ), \ 925 TP_ARGS(xprt)) 926 927 DEFINE_RPC_XPRT_LIFETIME_EVENT(create); 928 DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_auto); 929 DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_done); 930 DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_force); 931 DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_cleanup); 932 DEFINE_RPC_XPRT_LIFETIME_EVENT(destroy); 933 934 DECLARE_EVENT_CLASS(rpc_xprt_event, 935 TP_PROTO( 936 const struct rpc_xprt *xprt, 937 __be32 xid, 938 int status 939 ), 940 941 TP_ARGS(xprt, xid, status), 942 943 TP_STRUCT__entry( 944 __field(u32, xid) 945 __field(int, status) 946 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR]) 947 __string(port, xprt->address_strings[RPC_DISPLAY_PORT]) 948 ), 949 950 TP_fast_assign( 951 __entry->xid = be32_to_cpu(xid); 952 __entry->status = status; 953 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]); 954 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]); 955 ), 956 957 TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr), 958 __get_str(port), __entry->xid, 959 __entry->status) 960 ); 961 #define DEFINE_RPC_XPRT_EVENT(name) \ 962 DEFINE_EVENT(rpc_xprt_event, xprt_##name, \ 963 TP_PROTO( \ 964 const struct rpc_xprt *xprt, \ 965 __be32 xid, \ 966 int status \ 967 ), \ 968 TP_ARGS(xprt, xid, status)) 969 970 DEFINE_RPC_XPRT_EVENT(timer); 971 DEFINE_RPC_XPRT_EVENT(lookup_rqst); 972 DEFINE_RPC_XPRT_EVENT(complete_rqst); 973 974 TRACE_EVENT(xprt_transmit, 975 TP_PROTO( 976 const struct rpc_rqst *rqst, 977 int status 978 ), 979 980 TP_ARGS(rqst, status), 981 982 TP_STRUCT__entry( 983 __field(unsigned int, task_id) 984 __field(unsigned int, client_id) 985 __field(u32, xid) 986 __field(u32, seqno) 987 __field(int, status) 988 ), 989 990 TP_fast_assign( 991 __entry->task_id = rqst->rq_task->tk_pid; 992 __entry->client_id = rqst->rq_task->tk_client ? 993 rqst->rq_task->tk_client->cl_clid : -1; 994 __entry->xid = be32_to_cpu(rqst->rq_xid); 995 __entry->seqno = rqst->rq_seqno; 996 __entry->status = status; 997 ), 998 999 TP_printk( 1000 "task:%u@%u xid=0x%08x seqno=%u status=%d", 1001 __entry->task_id, __entry->client_id, __entry->xid, 1002 __entry->seqno, __entry->status) 1003 ); 1004 1005 TRACE_EVENT(xprt_enq_xmit, 1006 TP_PROTO( 1007 const struct rpc_task *task, 1008 int stage 1009 ), 1010 1011 TP_ARGS(task, stage), 1012 1013 TP_STRUCT__entry( 1014 __field(unsigned int, task_id) 1015 __field(unsigned int, client_id) 1016 __field(u32, xid) 1017 __field(u32, seqno) 1018 __field(int, stage) 1019 ), 1020 1021 TP_fast_assign( 1022 __entry->task_id = task->tk_pid; 1023 __entry->client_id = task->tk_client ? 1024 task->tk_client->cl_clid : -1; 1025 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); 1026 __entry->seqno = task->tk_rqstp->rq_seqno; 1027 __entry->stage = stage; 1028 ), 1029 1030 TP_printk( 1031 "task:%u@%u xid=0x%08x seqno=%u stage=%d", 1032 __entry->task_id, __entry->client_id, __entry->xid, 1033 __entry->seqno, __entry->stage) 1034 ); 1035 1036 TRACE_EVENT(xprt_ping, 1037 TP_PROTO(const struct rpc_xprt *xprt, int status), 1038 1039 TP_ARGS(xprt, status), 1040 1041 TP_STRUCT__entry( 1042 __field(int, status) 1043 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR]) 1044 __string(port, xprt->address_strings[RPC_DISPLAY_PORT]) 1045 ), 1046 1047 TP_fast_assign( 1048 __entry->status = status; 1049 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]); 1050 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]); 1051 ), 1052 1053 TP_printk("peer=[%s]:%s status=%d", 1054 __get_str(addr), __get_str(port), __entry->status) 1055 ); 1056 1057 DECLARE_EVENT_CLASS(xprt_writelock_event, 1058 TP_PROTO( 1059 const struct rpc_xprt *xprt, const struct rpc_task *task 1060 ), 1061 1062 TP_ARGS(xprt, task), 1063 1064 TP_STRUCT__entry( 1065 __field(unsigned int, task_id) 1066 __field(unsigned int, client_id) 1067 __field(unsigned int, snd_task_id) 1068 ), 1069 1070 TP_fast_assign( 1071 if (task) { 1072 __entry->task_id = task->tk_pid; 1073 __entry->client_id = task->tk_client ? 1074 task->tk_client->cl_clid : -1; 1075 } else { 1076 __entry->task_id = -1; 1077 __entry->client_id = -1; 1078 } 1079 __entry->snd_task_id = xprt->snd_task ? 1080 xprt->snd_task->tk_pid : -1; 1081 ), 1082 1083 TP_printk("task:%u@%u snd_task:%u", 1084 __entry->task_id, __entry->client_id, 1085 __entry->snd_task_id) 1086 ); 1087 1088 #define DEFINE_WRITELOCK_EVENT(name) \ 1089 DEFINE_EVENT(xprt_writelock_event, xprt_##name, \ 1090 TP_PROTO( \ 1091 const struct rpc_xprt *xprt, \ 1092 const struct rpc_task *task \ 1093 ), \ 1094 TP_ARGS(xprt, task)) 1095 1096 DEFINE_WRITELOCK_EVENT(reserve_xprt); 1097 DEFINE_WRITELOCK_EVENT(release_xprt); 1098 1099 DECLARE_EVENT_CLASS(xprt_cong_event, 1100 TP_PROTO( 1101 const struct rpc_xprt *xprt, const struct rpc_task *task 1102 ), 1103 1104 TP_ARGS(xprt, task), 1105 1106 TP_STRUCT__entry( 1107 __field(unsigned int, task_id) 1108 __field(unsigned int, client_id) 1109 __field(unsigned int, snd_task_id) 1110 __field(unsigned long, cong) 1111 __field(unsigned long, cwnd) 1112 __field(bool, wait) 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 __entry->cong = xprt->cong; 1127 __entry->cwnd = xprt->cwnd; 1128 __entry->wait = test_bit(XPRT_CWND_WAIT, &xprt->state); 1129 ), 1130 1131 TP_printk("task:%u@%u snd_task:%u cong=%lu cwnd=%lu%s", 1132 __entry->task_id, __entry->client_id, 1133 __entry->snd_task_id, __entry->cong, __entry->cwnd, 1134 __entry->wait ? " (wait)" : "") 1135 ); 1136 1137 #define DEFINE_CONG_EVENT(name) \ 1138 DEFINE_EVENT(xprt_cong_event, xprt_##name, \ 1139 TP_PROTO( \ 1140 const struct rpc_xprt *xprt, \ 1141 const struct rpc_task *task \ 1142 ), \ 1143 TP_ARGS(xprt, task)) 1144 1145 DEFINE_CONG_EVENT(reserve_cong); 1146 DEFINE_CONG_EVENT(release_cong); 1147 DEFINE_CONG_EVENT(get_cong); 1148 DEFINE_CONG_EVENT(put_cong); 1149 1150 TRACE_EVENT(xs_stream_read_data, 1151 TP_PROTO(struct rpc_xprt *xprt, ssize_t err, size_t total), 1152 1153 TP_ARGS(xprt, err, total), 1154 1155 TP_STRUCT__entry( 1156 __field(ssize_t, err) 1157 __field(size_t, total) 1158 __string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] : 1159 "(null)") 1160 __string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] : 1161 "(null)") 1162 ), 1163 1164 TP_fast_assign( 1165 __entry->err = err; 1166 __entry->total = total; 1167 __assign_str(addr, xprt ? 1168 xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)"); 1169 __assign_str(port, xprt ? 1170 xprt->address_strings[RPC_DISPLAY_PORT] : "(null)"); 1171 ), 1172 1173 TP_printk("peer=[%s]:%s err=%zd total=%zu", __get_str(addr), 1174 __get_str(port), __entry->err, __entry->total) 1175 ); 1176 1177 TRACE_EVENT(xs_stream_read_request, 1178 TP_PROTO(struct sock_xprt *xs), 1179 1180 TP_ARGS(xs), 1181 1182 TP_STRUCT__entry( 1183 __string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]) 1184 __string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]) 1185 __field(u32, xid) 1186 __field(unsigned long, copied) 1187 __field(unsigned int, reclen) 1188 __field(unsigned int, offset) 1189 ), 1190 1191 TP_fast_assign( 1192 __assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]); 1193 __assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]); 1194 __entry->xid = be32_to_cpu(xs->recv.xid); 1195 __entry->copied = xs->recv.copied; 1196 __entry->reclen = xs->recv.len; 1197 __entry->offset = xs->recv.offset; 1198 ), 1199 1200 TP_printk("peer=[%s]:%s xid=0x%08x copied=%lu reclen=%u offset=%u", 1201 __get_str(addr), __get_str(port), __entry->xid, 1202 __entry->copied, __entry->reclen, __entry->offset) 1203 ); 1204 1205 1206 DECLARE_EVENT_CLASS(svc_xdr_buf_class, 1207 TP_PROTO( 1208 const struct svc_rqst *rqst, 1209 const struct xdr_buf *xdr 1210 ), 1211 1212 TP_ARGS(rqst, xdr), 1213 1214 TP_STRUCT__entry( 1215 __field(u32, xid) 1216 __field(const void *, head_base) 1217 __field(size_t, head_len) 1218 __field(const void *, tail_base) 1219 __field(size_t, tail_len) 1220 __field(unsigned int, page_len) 1221 __field(unsigned int, msg_len) 1222 ), 1223 1224 TP_fast_assign( 1225 __entry->xid = be32_to_cpu(rqst->rq_xid); 1226 __entry->head_base = xdr->head[0].iov_base; 1227 __entry->head_len = xdr->head[0].iov_len; 1228 __entry->tail_base = xdr->tail[0].iov_base; 1229 __entry->tail_len = xdr->tail[0].iov_len; 1230 __entry->page_len = xdr->page_len; 1231 __entry->msg_len = xdr->len; 1232 ), 1233 1234 TP_printk("xid=0x%08x head=[%p,%zu] page=%u tail=[%p,%zu] len=%u", 1235 __entry->xid, 1236 __entry->head_base, __entry->head_len, __entry->page_len, 1237 __entry->tail_base, __entry->tail_len, __entry->msg_len 1238 ) 1239 ); 1240 1241 #define DEFINE_SVCXDRBUF_EVENT(name) \ 1242 DEFINE_EVENT(svc_xdr_buf_class, \ 1243 svc_xdr_##name, \ 1244 TP_PROTO( \ 1245 const struct svc_rqst *rqst, \ 1246 const struct xdr_buf *xdr \ 1247 ), \ 1248 TP_ARGS(rqst, xdr)) 1249 1250 DEFINE_SVCXDRBUF_EVENT(recvfrom); 1251 DEFINE_SVCXDRBUF_EVENT(sendto); 1252 1253 /* 1254 * from include/linux/sunrpc/svc.h 1255 */ 1256 #define SVC_RQST_FLAG_LIST \ 1257 svc_rqst_flag(SECURE) \ 1258 svc_rqst_flag(LOCAL) \ 1259 svc_rqst_flag(USEDEFERRAL) \ 1260 svc_rqst_flag(DROPME) \ 1261 svc_rqst_flag(SPLICE_OK) \ 1262 svc_rqst_flag(VICTIM) \ 1263 svc_rqst_flag(BUSY) \ 1264 svc_rqst_flag(DATA) \ 1265 svc_rqst_flag_end(AUTHERR) 1266 1267 #undef svc_rqst_flag 1268 #undef svc_rqst_flag_end 1269 #define svc_rqst_flag(x) TRACE_DEFINE_ENUM(RQ_##x); 1270 #define svc_rqst_flag_end(x) TRACE_DEFINE_ENUM(RQ_##x); 1271 1272 SVC_RQST_FLAG_LIST 1273 1274 #undef svc_rqst_flag 1275 #undef svc_rqst_flag_end 1276 #define svc_rqst_flag(x) { BIT(RQ_##x), #x }, 1277 #define svc_rqst_flag_end(x) { BIT(RQ_##x), #x } 1278 1279 #define show_rqstp_flags(flags) \ 1280 __print_flags(flags, "|", SVC_RQST_FLAG_LIST) 1281 1282 TRACE_EVENT(svc_recv, 1283 TP_PROTO(struct svc_rqst *rqst, int len), 1284 1285 TP_ARGS(rqst, len), 1286 1287 TP_STRUCT__entry( 1288 __field(u32, xid) 1289 __field(int, len) 1290 __field(unsigned long, flags) 1291 __string(addr, rqst->rq_xprt->xpt_remotebuf) 1292 ), 1293 1294 TP_fast_assign( 1295 __entry->xid = be32_to_cpu(rqst->rq_xid); 1296 __entry->len = len; 1297 __entry->flags = rqst->rq_flags; 1298 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 1299 ), 1300 1301 TP_printk("addr=%s xid=0x%08x len=%d flags=%s", 1302 __get_str(addr), __entry->xid, __entry->len, 1303 show_rqstp_flags(__entry->flags)) 1304 ); 1305 1306 TRACE_DEFINE_ENUM(SVC_GARBAGE); 1307 TRACE_DEFINE_ENUM(SVC_SYSERR); 1308 TRACE_DEFINE_ENUM(SVC_VALID); 1309 TRACE_DEFINE_ENUM(SVC_NEGATIVE); 1310 TRACE_DEFINE_ENUM(SVC_OK); 1311 TRACE_DEFINE_ENUM(SVC_DROP); 1312 TRACE_DEFINE_ENUM(SVC_CLOSE); 1313 TRACE_DEFINE_ENUM(SVC_DENIED); 1314 TRACE_DEFINE_ENUM(SVC_PENDING); 1315 TRACE_DEFINE_ENUM(SVC_COMPLETE); 1316 1317 #define svc_show_status(status) \ 1318 __print_symbolic(status, \ 1319 { SVC_GARBAGE, "SVC_GARBAGE" }, \ 1320 { SVC_SYSERR, "SVC_SYSERR" }, \ 1321 { SVC_VALID, "SVC_VALID" }, \ 1322 { SVC_NEGATIVE, "SVC_NEGATIVE" }, \ 1323 { SVC_OK, "SVC_OK" }, \ 1324 { SVC_DROP, "SVC_DROP" }, \ 1325 { SVC_CLOSE, "SVC_CLOSE" }, \ 1326 { SVC_DENIED, "SVC_DENIED" }, \ 1327 { SVC_PENDING, "SVC_PENDING" }, \ 1328 { SVC_COMPLETE, "SVC_COMPLETE" }) 1329 1330 TRACE_EVENT(svc_authenticate, 1331 TP_PROTO(const struct svc_rqst *rqst, int auth_res, __be32 auth_stat), 1332 1333 TP_ARGS(rqst, auth_res, auth_stat), 1334 1335 TP_STRUCT__entry( 1336 __field(u32, xid) 1337 __field(unsigned long, svc_status) 1338 __field(unsigned long, auth_stat) 1339 ), 1340 1341 TP_fast_assign( 1342 __entry->xid = be32_to_cpu(rqst->rq_xid); 1343 __entry->svc_status = auth_res; 1344 __entry->auth_stat = be32_to_cpu(auth_stat); 1345 ), 1346 1347 TP_printk("xid=0x%08x auth_res=%s auth_stat=%s", 1348 __entry->xid, svc_show_status(__entry->svc_status), 1349 rpc_show_auth_stat(__entry->auth_stat)) 1350 ); 1351 1352 TRACE_EVENT(svc_process, 1353 TP_PROTO(const struct svc_rqst *rqst, const char *name), 1354 1355 TP_ARGS(rqst, name), 1356 1357 TP_STRUCT__entry( 1358 __field(u32, xid) 1359 __field(u32, vers) 1360 __field(u32, proc) 1361 __string(service, name) 1362 __string(addr, rqst->rq_xprt ? 1363 rqst->rq_xprt->xpt_remotebuf : "(null)") 1364 ), 1365 1366 TP_fast_assign( 1367 __entry->xid = be32_to_cpu(rqst->rq_xid); 1368 __entry->vers = rqst->rq_vers; 1369 __entry->proc = rqst->rq_proc; 1370 __assign_str(service, name); 1371 __assign_str(addr, rqst->rq_xprt ? 1372 rqst->rq_xprt->xpt_remotebuf : "(null)"); 1373 ), 1374 1375 TP_printk("addr=%s xid=0x%08x service=%s vers=%u proc=%u", 1376 __get_str(addr), __entry->xid, 1377 __get_str(service), __entry->vers, __entry->proc) 1378 ); 1379 1380 DECLARE_EVENT_CLASS(svc_rqst_event, 1381 1382 TP_PROTO( 1383 const struct svc_rqst *rqst 1384 ), 1385 1386 TP_ARGS(rqst), 1387 1388 TP_STRUCT__entry( 1389 __field(u32, xid) 1390 __field(unsigned long, flags) 1391 __string(addr, rqst->rq_xprt->xpt_remotebuf) 1392 ), 1393 1394 TP_fast_assign( 1395 __entry->xid = be32_to_cpu(rqst->rq_xid); 1396 __entry->flags = rqst->rq_flags; 1397 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 1398 ), 1399 1400 TP_printk("addr=%s xid=0x%08x flags=%s", 1401 __get_str(addr), __entry->xid, 1402 show_rqstp_flags(__entry->flags)) 1403 ); 1404 #define DEFINE_SVC_RQST_EVENT(name) \ 1405 DEFINE_EVENT(svc_rqst_event, svc_##name, \ 1406 TP_PROTO( \ 1407 const struct svc_rqst *rqst \ 1408 ), \ 1409 TP_ARGS(rqst)) 1410 1411 DEFINE_SVC_RQST_EVENT(defer); 1412 DEFINE_SVC_RQST_EVENT(drop); 1413 1414 DECLARE_EVENT_CLASS(svc_rqst_status, 1415 1416 TP_PROTO(struct svc_rqst *rqst, int status), 1417 1418 TP_ARGS(rqst, status), 1419 1420 TP_STRUCT__entry( 1421 __field(u32, xid) 1422 __field(int, status) 1423 __field(unsigned long, flags) 1424 __string(addr, rqst->rq_xprt->xpt_remotebuf) 1425 ), 1426 1427 TP_fast_assign( 1428 __entry->xid = be32_to_cpu(rqst->rq_xid); 1429 __entry->status = status; 1430 __entry->flags = rqst->rq_flags; 1431 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 1432 ), 1433 1434 TP_printk("addr=%s xid=0x%08x status=%d flags=%s", 1435 __get_str(addr), __entry->xid, 1436 __entry->status, show_rqstp_flags(__entry->flags)) 1437 ); 1438 1439 DEFINE_EVENT(svc_rqst_status, svc_send, 1440 TP_PROTO(struct svc_rqst *rqst, int status), 1441 TP_ARGS(rqst, status)); 1442 1443 #define show_svc_xprt_flags(flags) \ 1444 __print_flags(flags, "|", \ 1445 { (1UL << XPT_BUSY), "XPT_BUSY"}, \ 1446 { (1UL << XPT_CONN), "XPT_CONN"}, \ 1447 { (1UL << XPT_CLOSE), "XPT_CLOSE"}, \ 1448 { (1UL << XPT_DATA), "XPT_DATA"}, \ 1449 { (1UL << XPT_TEMP), "XPT_TEMP"}, \ 1450 { (1UL << XPT_DEAD), "XPT_DEAD"}, \ 1451 { (1UL << XPT_CHNGBUF), "XPT_CHNGBUF"}, \ 1452 { (1UL << XPT_DEFERRED), "XPT_DEFERRED"}, \ 1453 { (1UL << XPT_OLD), "XPT_OLD"}, \ 1454 { (1UL << XPT_LISTENER), "XPT_LISTENER"}, \ 1455 { (1UL << XPT_CACHE_AUTH), "XPT_CACHE_AUTH"}, \ 1456 { (1UL << XPT_LOCAL), "XPT_LOCAL"}, \ 1457 { (1UL << XPT_KILL_TEMP), "XPT_KILL_TEMP"}, \ 1458 { (1UL << XPT_CONG_CTRL), "XPT_CONG_CTRL"}) 1459 1460 TRACE_EVENT(svc_xprt_create_err, 1461 TP_PROTO( 1462 const char *program, 1463 const char *protocol, 1464 struct sockaddr *sap, 1465 const struct svc_xprt *xprt 1466 ), 1467 1468 TP_ARGS(program, protocol, sap, xprt), 1469 1470 TP_STRUCT__entry( 1471 __field(long, error) 1472 __string(program, program) 1473 __string(protocol, protocol) 1474 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 1475 ), 1476 1477 TP_fast_assign( 1478 __entry->error = PTR_ERR(xprt); 1479 __assign_str(program, program); 1480 __assign_str(protocol, protocol); 1481 memcpy(__entry->addr, sap, sizeof(__entry->addr)); 1482 ), 1483 1484 TP_printk("addr=%pISpc program=%s protocol=%s error=%ld", 1485 __entry->addr, __get_str(program), __get_str(protocol), 1486 __entry->error) 1487 ); 1488 1489 TRACE_EVENT(svc_xprt_do_enqueue, 1490 TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst), 1491 1492 TP_ARGS(xprt, rqst), 1493 1494 TP_STRUCT__entry( 1495 __field(int, pid) 1496 __field(unsigned long, flags) 1497 __string(addr, xprt->xpt_remotebuf) 1498 ), 1499 1500 TP_fast_assign( 1501 __entry->pid = rqst? rqst->rq_task->pid : 0; 1502 __entry->flags = xprt->xpt_flags; 1503 __assign_str(addr, xprt->xpt_remotebuf); 1504 ), 1505 1506 TP_printk("addr=%s pid=%d flags=%s", __get_str(addr), 1507 __entry->pid, show_svc_xprt_flags(__entry->flags)) 1508 ); 1509 1510 DECLARE_EVENT_CLASS(svc_xprt_event, 1511 TP_PROTO(struct svc_xprt *xprt), 1512 1513 TP_ARGS(xprt), 1514 1515 TP_STRUCT__entry( 1516 __field(unsigned long, flags) 1517 __string(addr, xprt->xpt_remotebuf) 1518 ), 1519 1520 TP_fast_assign( 1521 __entry->flags = xprt->xpt_flags; 1522 __assign_str(addr, xprt->xpt_remotebuf); 1523 ), 1524 1525 TP_printk("addr=%s flags=%s", __get_str(addr), 1526 show_svc_xprt_flags(__entry->flags)) 1527 ); 1528 1529 #define DEFINE_SVC_XPRT_EVENT(name) \ 1530 DEFINE_EVENT(svc_xprt_event, svc_xprt_##name, \ 1531 TP_PROTO( \ 1532 struct svc_xprt *xprt \ 1533 ), \ 1534 TP_ARGS(xprt)) 1535 1536 DEFINE_SVC_XPRT_EVENT(no_write_space); 1537 DEFINE_SVC_XPRT_EVENT(close); 1538 DEFINE_SVC_XPRT_EVENT(detach); 1539 DEFINE_SVC_XPRT_EVENT(free); 1540 1541 TRACE_EVENT(svc_xprt_accept, 1542 TP_PROTO( 1543 const struct svc_xprt *xprt, 1544 const char *service 1545 ), 1546 1547 TP_ARGS(xprt, service), 1548 1549 TP_STRUCT__entry( 1550 __string(addr, xprt->xpt_remotebuf) 1551 __string(protocol, xprt->xpt_class->xcl_name) 1552 __string(service, service) 1553 ), 1554 1555 TP_fast_assign( 1556 __assign_str(addr, xprt->xpt_remotebuf); 1557 __assign_str(protocol, xprt->xpt_class->xcl_name) 1558 __assign_str(service, service); 1559 ), 1560 1561 TP_printk("addr=%s protocol=%s service=%s", 1562 __get_str(addr), __get_str(protocol), __get_str(service) 1563 ) 1564 ); 1565 1566 TRACE_EVENT(svc_xprt_dequeue, 1567 TP_PROTO(struct svc_rqst *rqst), 1568 1569 TP_ARGS(rqst), 1570 1571 TP_STRUCT__entry( 1572 __field(unsigned long, flags) 1573 __field(unsigned long, wakeup) 1574 __string(addr, rqst->rq_xprt->xpt_remotebuf) 1575 ), 1576 1577 TP_fast_assign( 1578 __entry->flags = rqst->rq_xprt->xpt_flags; 1579 __entry->wakeup = ktime_to_us(ktime_sub(ktime_get(), 1580 rqst->rq_qtime)); 1581 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 1582 ), 1583 1584 TP_printk("addr=%s flags=%s wakeup-us=%lu", __get_str(addr), 1585 show_svc_xprt_flags(__entry->flags), __entry->wakeup) 1586 ); 1587 1588 TRACE_EVENT(svc_wake_up, 1589 TP_PROTO(int pid), 1590 1591 TP_ARGS(pid), 1592 1593 TP_STRUCT__entry( 1594 __field(int, pid) 1595 ), 1596 1597 TP_fast_assign( 1598 __entry->pid = pid; 1599 ), 1600 1601 TP_printk("pid=%d", __entry->pid) 1602 ); 1603 1604 TRACE_EVENT(svc_handle_xprt, 1605 TP_PROTO(struct svc_xprt *xprt, int len), 1606 1607 TP_ARGS(xprt, len), 1608 1609 TP_STRUCT__entry( 1610 __field(int, len) 1611 __field(unsigned long, flags) 1612 __string(addr, xprt->xpt_remotebuf) 1613 ), 1614 1615 TP_fast_assign( 1616 __entry->len = len; 1617 __entry->flags = xprt->xpt_flags; 1618 __assign_str(addr, xprt->xpt_remotebuf); 1619 ), 1620 1621 TP_printk("addr=%s len=%d flags=%s", __get_str(addr), 1622 __entry->len, show_svc_xprt_flags(__entry->flags)) 1623 ); 1624 1625 TRACE_EVENT(svc_stats_latency, 1626 TP_PROTO(const struct svc_rqst *rqst), 1627 1628 TP_ARGS(rqst), 1629 1630 TP_STRUCT__entry( 1631 __field(u32, xid) 1632 __field(unsigned long, execute) 1633 __string(addr, rqst->rq_xprt->xpt_remotebuf) 1634 ), 1635 1636 TP_fast_assign( 1637 __entry->xid = be32_to_cpu(rqst->rq_xid); 1638 __entry->execute = ktime_to_us(ktime_sub(ktime_get(), 1639 rqst->rq_stime)); 1640 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 1641 ), 1642 1643 TP_printk("addr=%s xid=0x%08x execute-us=%lu", 1644 __get_str(addr), __entry->xid, __entry->execute) 1645 ); 1646 1647 DECLARE_EVENT_CLASS(svc_deferred_event, 1648 TP_PROTO( 1649 const struct svc_deferred_req *dr 1650 ), 1651 1652 TP_ARGS(dr), 1653 1654 TP_STRUCT__entry( 1655 __field(const void *, dr) 1656 __field(u32, xid) 1657 __string(addr, dr->xprt->xpt_remotebuf) 1658 ), 1659 1660 TP_fast_assign( 1661 __entry->dr = dr; 1662 __entry->xid = be32_to_cpu(*(__be32 *)(dr->args + 1663 (dr->xprt_hlen>>2))); 1664 __assign_str(addr, dr->xprt->xpt_remotebuf); 1665 ), 1666 1667 TP_printk("addr=%s dr=%p xid=0x%08x", __get_str(addr), __entry->dr, 1668 __entry->xid) 1669 ); 1670 1671 #define DEFINE_SVC_DEFERRED_EVENT(name) \ 1672 DEFINE_EVENT(svc_deferred_event, svc_defer_##name, \ 1673 TP_PROTO( \ 1674 const struct svc_deferred_req *dr \ 1675 ), \ 1676 TP_ARGS(dr)) 1677 1678 DEFINE_SVC_DEFERRED_EVENT(drop); 1679 DEFINE_SVC_DEFERRED_EVENT(queue); 1680 DEFINE_SVC_DEFERRED_EVENT(recv); 1681 1682 TRACE_EVENT(svcsock_new_socket, 1683 TP_PROTO( 1684 const struct socket *socket 1685 ), 1686 1687 TP_ARGS(socket), 1688 1689 TP_STRUCT__entry( 1690 __field(unsigned long, type) 1691 __field(unsigned long, family) 1692 __field(bool, listener) 1693 ), 1694 1695 TP_fast_assign( 1696 __entry->type = socket->type; 1697 __entry->family = socket->sk->sk_family; 1698 __entry->listener = (socket->sk->sk_state == TCP_LISTEN); 1699 ), 1700 1701 TP_printk("type=%s family=%s%s", 1702 show_socket_type(__entry->type), 1703 rpc_show_address_family(__entry->family), 1704 __entry->listener ? " (listener)" : "" 1705 ) 1706 ); 1707 1708 TRACE_EVENT(svcsock_marker, 1709 TP_PROTO( 1710 const struct svc_xprt *xprt, 1711 __be32 marker 1712 ), 1713 1714 TP_ARGS(xprt, marker), 1715 1716 TP_STRUCT__entry( 1717 __field(unsigned int, length) 1718 __field(bool, last) 1719 __string(addr, xprt->xpt_remotebuf) 1720 ), 1721 1722 TP_fast_assign( 1723 __entry->length = be32_to_cpu(marker) & RPC_FRAGMENT_SIZE_MASK; 1724 __entry->last = be32_to_cpu(marker) & RPC_LAST_STREAM_FRAGMENT; 1725 __assign_str(addr, xprt->xpt_remotebuf); 1726 ), 1727 1728 TP_printk("addr=%s length=%u%s", __get_str(addr), 1729 __entry->length, __entry->last ? " (last)" : "") 1730 ); 1731 1732 DECLARE_EVENT_CLASS(svcsock_class, 1733 TP_PROTO( 1734 const struct svc_xprt *xprt, 1735 ssize_t result 1736 ), 1737 1738 TP_ARGS(xprt, result), 1739 1740 TP_STRUCT__entry( 1741 __field(ssize_t, result) 1742 __field(unsigned long, flags) 1743 __string(addr, xprt->xpt_remotebuf) 1744 ), 1745 1746 TP_fast_assign( 1747 __entry->result = result; 1748 __entry->flags = xprt->xpt_flags; 1749 __assign_str(addr, xprt->xpt_remotebuf); 1750 ), 1751 1752 TP_printk("addr=%s result=%zd flags=%s", __get_str(addr), 1753 __entry->result, show_svc_xprt_flags(__entry->flags) 1754 ) 1755 ); 1756 1757 #define DEFINE_SVCSOCK_EVENT(name) \ 1758 DEFINE_EVENT(svcsock_class, svcsock_##name, \ 1759 TP_PROTO( \ 1760 const struct svc_xprt *xprt, \ 1761 ssize_t result \ 1762 ), \ 1763 TP_ARGS(xprt, result)) 1764 1765 DEFINE_SVCSOCK_EVENT(udp_send); 1766 DEFINE_SVCSOCK_EVENT(udp_recv); 1767 DEFINE_SVCSOCK_EVENT(udp_recv_err); 1768 DEFINE_SVCSOCK_EVENT(tcp_send); 1769 DEFINE_SVCSOCK_EVENT(tcp_recv); 1770 DEFINE_SVCSOCK_EVENT(tcp_recv_eagain); 1771 DEFINE_SVCSOCK_EVENT(tcp_recv_err); 1772 DEFINE_SVCSOCK_EVENT(data_ready); 1773 DEFINE_SVCSOCK_EVENT(write_space); 1774 1775 TRACE_EVENT(svcsock_tcp_recv_short, 1776 TP_PROTO( 1777 const struct svc_xprt *xprt, 1778 u32 expected, 1779 u32 received 1780 ), 1781 1782 TP_ARGS(xprt, expected, received), 1783 1784 TP_STRUCT__entry( 1785 __field(u32, expected) 1786 __field(u32, received) 1787 __field(unsigned long, flags) 1788 __string(addr, xprt->xpt_remotebuf) 1789 ), 1790 1791 TP_fast_assign( 1792 __entry->expected = expected; 1793 __entry->received = received; 1794 __entry->flags = xprt->xpt_flags; 1795 __assign_str(addr, xprt->xpt_remotebuf); 1796 ), 1797 1798 TP_printk("addr=%s flags=%s expected=%u received=%u", 1799 __get_str(addr), show_svc_xprt_flags(__entry->flags), 1800 __entry->expected, __entry->received 1801 ) 1802 ); 1803 1804 TRACE_EVENT(svcsock_tcp_state, 1805 TP_PROTO( 1806 const struct svc_xprt *xprt, 1807 const struct socket *socket 1808 ), 1809 1810 TP_ARGS(xprt, socket), 1811 1812 TP_STRUCT__entry( 1813 __field(unsigned long, socket_state) 1814 __field(unsigned long, sock_state) 1815 __field(unsigned long, flags) 1816 __string(addr, xprt->xpt_remotebuf) 1817 ), 1818 1819 TP_fast_assign( 1820 __entry->socket_state = socket->state; 1821 __entry->sock_state = socket->sk->sk_state; 1822 __entry->flags = xprt->xpt_flags; 1823 __assign_str(addr, xprt->xpt_remotebuf); 1824 ), 1825 1826 TP_printk("addr=%s state=%s sk_state=%s flags=%s", __get_str(addr), 1827 rpc_show_socket_state(__entry->socket_state), 1828 rpc_show_sock_state(__entry->sock_state), 1829 show_svc_xprt_flags(__entry->flags) 1830 ) 1831 ); 1832 1833 DECLARE_EVENT_CLASS(svcsock_accept_class, 1834 TP_PROTO( 1835 const struct svc_xprt *xprt, 1836 const char *service, 1837 long status 1838 ), 1839 1840 TP_ARGS(xprt, service, status), 1841 1842 TP_STRUCT__entry( 1843 __field(long, status) 1844 __string(service, service) 1845 __array(unsigned char, addr, sizeof(struct sockaddr_in6)) 1846 ), 1847 1848 TP_fast_assign( 1849 __entry->status = status; 1850 __assign_str(service, service); 1851 memcpy(__entry->addr, &xprt->xpt_local, sizeof(__entry->addr)); 1852 ), 1853 1854 TP_printk("listener=%pISpc service=%s status=%ld", 1855 __entry->addr, __get_str(service), __entry->status 1856 ) 1857 ); 1858 1859 #define DEFINE_ACCEPT_EVENT(name) \ 1860 DEFINE_EVENT(svcsock_accept_class, svcsock_##name##_err, \ 1861 TP_PROTO( \ 1862 const struct svc_xprt *xprt, \ 1863 const char *service, \ 1864 long status \ 1865 ), \ 1866 TP_ARGS(xprt, service, status)) 1867 1868 DEFINE_ACCEPT_EVENT(accept); 1869 DEFINE_ACCEPT_EVENT(getpeername); 1870 1871 DECLARE_EVENT_CLASS(cache_event, 1872 TP_PROTO( 1873 const struct cache_detail *cd, 1874 const struct cache_head *h 1875 ), 1876 1877 TP_ARGS(cd, h), 1878 1879 TP_STRUCT__entry( 1880 __field(const struct cache_head *, h) 1881 __string(name, cd->name) 1882 ), 1883 1884 TP_fast_assign( 1885 __entry->h = h; 1886 __assign_str(name, cd->name); 1887 ), 1888 1889 TP_printk("cache=%s entry=%p", __get_str(name), __entry->h) 1890 ); 1891 #define DEFINE_CACHE_EVENT(name) \ 1892 DEFINE_EVENT(cache_event, name, \ 1893 TP_PROTO( \ 1894 const struct cache_detail *cd, \ 1895 const struct cache_head *h \ 1896 ), \ 1897 TP_ARGS(cd, h)) 1898 DEFINE_CACHE_EVENT(cache_entry_expired); 1899 DEFINE_CACHE_EVENT(cache_entry_upcall); 1900 DEFINE_CACHE_EVENT(cache_entry_update); 1901 DEFINE_CACHE_EVENT(cache_entry_make_negative); 1902 DEFINE_CACHE_EVENT(cache_entry_no_listener); 1903 1904 DECLARE_EVENT_CLASS(register_class, 1905 TP_PROTO( 1906 const char *program, 1907 const u32 version, 1908 const int family, 1909 const unsigned short protocol, 1910 const unsigned short port, 1911 int error 1912 ), 1913 1914 TP_ARGS(program, version, family, protocol, port, error), 1915 1916 TP_STRUCT__entry( 1917 __field(u32, version) 1918 __field(unsigned long, family) 1919 __field(unsigned short, protocol) 1920 __field(unsigned short, port) 1921 __field(int, error) 1922 __string(program, program) 1923 ), 1924 1925 TP_fast_assign( 1926 __entry->version = version; 1927 __entry->family = family; 1928 __entry->protocol = protocol; 1929 __entry->port = port; 1930 __entry->error = error; 1931 __assign_str(program, program); 1932 ), 1933 1934 TP_printk("program=%sv%u proto=%s port=%u family=%s error=%d", 1935 __get_str(program), __entry->version, 1936 __entry->protocol == IPPROTO_UDP ? "udp" : "tcp", 1937 __entry->port, rpc_show_address_family(__entry->family), 1938 __entry->error 1939 ) 1940 ); 1941 1942 #define DEFINE_REGISTER_EVENT(name) \ 1943 DEFINE_EVENT(register_class, svc_##name, \ 1944 TP_PROTO( \ 1945 const char *program, \ 1946 const u32 version, \ 1947 const int family, \ 1948 const unsigned short protocol, \ 1949 const unsigned short port, \ 1950 int error \ 1951 ), \ 1952 TP_ARGS(program, version, family, protocol, \ 1953 port, error)) 1954 1955 DEFINE_REGISTER_EVENT(register); 1956 DEFINE_REGISTER_EVENT(noregister); 1957 1958 TRACE_EVENT(svc_unregister, 1959 TP_PROTO( 1960 const char *program, 1961 const u32 version, 1962 int error 1963 ), 1964 1965 TP_ARGS(program, version, error), 1966 1967 TP_STRUCT__entry( 1968 __field(u32, version) 1969 __field(int, error) 1970 __string(program, program) 1971 ), 1972 1973 TP_fast_assign( 1974 __entry->version = version; 1975 __entry->error = error; 1976 __assign_str(program, program); 1977 ), 1978 1979 TP_printk("program=%sv%u error=%d", 1980 __get_str(program), __entry->version, __entry->error 1981 ) 1982 ); 1983 1984 #endif /* _TRACE_SUNRPC_H */ 1985 1986 #include <trace/define_trace.h> 1987