1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM sunrpc 4 5 #if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ) 6 #define _TRACE_SUNRPC_H 7 8 #include <linux/sunrpc/sched.h> 9 #include <linux/sunrpc/clnt.h> 10 #include <linux/sunrpc/svc.h> 11 #include <linux/sunrpc/xprtsock.h> 12 #include <linux/sunrpc/svc_xprt.h> 13 #include <net/tcp_states.h> 14 #include <linux/net.h> 15 #include <linux/tracepoint.h> 16 17 DECLARE_EVENT_CLASS(rpc_task_status, 18 19 TP_PROTO(const struct rpc_task *task), 20 21 TP_ARGS(task), 22 23 TP_STRUCT__entry( 24 __field(unsigned int, task_id) 25 __field(unsigned int, client_id) 26 __field(int, status) 27 ), 28 29 TP_fast_assign( 30 __entry->task_id = task->tk_pid; 31 __entry->client_id = task->tk_client->cl_clid; 32 __entry->status = task->tk_status; 33 ), 34 35 TP_printk("task:%u@%u status=%d", 36 __entry->task_id, __entry->client_id, 37 __entry->status) 38 ); 39 #define DEFINE_RPC_STATUS_EVENT(name) \ 40 DEFINE_EVENT(rpc_task_status, rpc_##name##_status, \ 41 TP_PROTO( \ 42 const struct rpc_task *task \ 43 ), \ 44 TP_ARGS(task)) 45 46 DEFINE_RPC_STATUS_EVENT(call); 47 DEFINE_RPC_STATUS_EVENT(bind); 48 DEFINE_RPC_STATUS_EVENT(connect); 49 50 TRACE_EVENT(rpc_request, 51 TP_PROTO(const struct rpc_task *task), 52 53 TP_ARGS(task), 54 55 TP_STRUCT__entry( 56 __field(unsigned int, task_id) 57 __field(unsigned int, client_id) 58 __field(int, version) 59 __field(bool, async) 60 __string(progname, task->tk_client->cl_program->name) 61 __string(procname, rpc_proc_name(task)) 62 ), 63 64 TP_fast_assign( 65 __entry->task_id = task->tk_pid; 66 __entry->client_id = task->tk_client->cl_clid; 67 __entry->version = task->tk_client->cl_vers; 68 __entry->async = RPC_IS_ASYNC(task); 69 __assign_str(progname, task->tk_client->cl_program->name) 70 __assign_str(procname, rpc_proc_name(task)) 71 ), 72 73 TP_printk("task:%u@%u %sv%d %s (%ssync)", 74 __entry->task_id, __entry->client_id, 75 __get_str(progname), __entry->version, 76 __get_str(procname), __entry->async ? "a": "" 77 ) 78 ); 79 80 DECLARE_EVENT_CLASS(rpc_task_running, 81 82 TP_PROTO(const struct rpc_task *task, const void *action), 83 84 TP_ARGS(task, action), 85 86 TP_STRUCT__entry( 87 __field(unsigned int, task_id) 88 __field(unsigned int, client_id) 89 __field(const void *, action) 90 __field(unsigned long, runstate) 91 __field(int, status) 92 __field(unsigned short, flags) 93 ), 94 95 TP_fast_assign( 96 __entry->client_id = task->tk_client ? 97 task->tk_client->cl_clid : -1; 98 __entry->task_id = task->tk_pid; 99 __entry->action = action; 100 __entry->runstate = task->tk_runstate; 101 __entry->status = task->tk_status; 102 __entry->flags = task->tk_flags; 103 ), 104 105 TP_printk("task:%u@%d flags=%4.4x state=%4.4lx status=%d action=%pf", 106 __entry->task_id, __entry->client_id, 107 __entry->flags, 108 __entry->runstate, 109 __entry->status, 110 __entry->action 111 ) 112 ); 113 #define DEFINE_RPC_RUNNING_EVENT(name) \ 114 DEFINE_EVENT(rpc_task_running, rpc_task_##name, \ 115 TP_PROTO( \ 116 const struct rpc_task *task, \ 117 const void *action \ 118 ), \ 119 TP_ARGS(task, action)) 120 121 DEFINE_RPC_RUNNING_EVENT(begin); 122 DEFINE_RPC_RUNNING_EVENT(run_action); 123 DEFINE_RPC_RUNNING_EVENT(complete); 124 125 DECLARE_EVENT_CLASS(rpc_task_queued, 126 127 TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q), 128 129 TP_ARGS(task, q), 130 131 TP_STRUCT__entry( 132 __field(unsigned int, task_id) 133 __field(unsigned int, client_id) 134 __field(unsigned long, timeout) 135 __field(unsigned long, runstate) 136 __field(int, status) 137 __field(unsigned short, flags) 138 __string(q_name, rpc_qname(q)) 139 ), 140 141 TP_fast_assign( 142 __entry->client_id = task->tk_client ? 143 task->tk_client->cl_clid : -1; 144 __entry->task_id = task->tk_pid; 145 __entry->timeout = task->tk_timeout; 146 __entry->runstate = task->tk_runstate; 147 __entry->status = task->tk_status; 148 __entry->flags = task->tk_flags; 149 __assign_str(q_name, rpc_qname(q)); 150 ), 151 152 TP_printk("task:%u@%d flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s", 153 __entry->task_id, __entry->client_id, 154 __entry->flags, 155 __entry->runstate, 156 __entry->status, 157 __entry->timeout, 158 __get_str(q_name) 159 ) 160 ); 161 #define DEFINE_RPC_QUEUED_EVENT(name) \ 162 DEFINE_EVENT(rpc_task_queued, rpc_task_##name, \ 163 TP_PROTO( \ 164 const struct rpc_task *task, \ 165 const struct rpc_wait_queue *q \ 166 ), \ 167 TP_ARGS(task, q)) 168 169 DEFINE_RPC_QUEUED_EVENT(sleep); 170 DEFINE_RPC_QUEUED_EVENT(wakeup); 171 172 TRACE_EVENT(rpc_stats_latency, 173 174 TP_PROTO( 175 const struct rpc_task *task, 176 ktime_t backlog, 177 ktime_t rtt, 178 ktime_t execute 179 ), 180 181 TP_ARGS(task, backlog, rtt, execute), 182 183 TP_STRUCT__entry( 184 __field(unsigned int, task_id) 185 __field(unsigned int, client_id) 186 __field(u32, xid) 187 __field(int, version) 188 __string(progname, task->tk_client->cl_program->name) 189 __string(procname, rpc_proc_name(task)) 190 __field(unsigned long, backlog) 191 __field(unsigned long, rtt) 192 __field(unsigned long, execute) 193 ), 194 195 TP_fast_assign( 196 __entry->client_id = task->tk_client->cl_clid; 197 __entry->task_id = task->tk_pid; 198 __entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid); 199 __entry->version = task->tk_client->cl_vers; 200 __assign_str(progname, task->tk_client->cl_program->name) 201 __assign_str(procname, rpc_proc_name(task)) 202 __entry->backlog = ktime_to_us(backlog); 203 __entry->rtt = ktime_to_us(rtt); 204 __entry->execute = ktime_to_us(execute); 205 ), 206 207 TP_printk("task:%u@%d xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu", 208 __entry->task_id, __entry->client_id, __entry->xid, 209 __get_str(progname), __entry->version, __get_str(procname), 210 __entry->backlog, __entry->rtt, __entry->execute) 211 ); 212 213 /* 214 * First define the enums in the below macros to be exported to userspace 215 * via TRACE_DEFINE_ENUM(). 216 */ 217 #undef EM 218 #undef EMe 219 #define EM(a, b) TRACE_DEFINE_ENUM(a); 220 #define EMe(a, b) TRACE_DEFINE_ENUM(a); 221 222 #define RPC_SHOW_SOCKET \ 223 EM( SS_FREE, "FREE" ) \ 224 EM( SS_UNCONNECTED, "UNCONNECTED" ) \ 225 EM( SS_CONNECTING, "CONNECTING," ) \ 226 EM( SS_CONNECTED, "CONNECTED," ) \ 227 EMe(SS_DISCONNECTING, "DISCONNECTING" ) 228 229 #define rpc_show_socket_state(state) \ 230 __print_symbolic(state, RPC_SHOW_SOCKET) 231 232 RPC_SHOW_SOCKET 233 234 #define RPC_SHOW_SOCK \ 235 EM( TCP_ESTABLISHED, "ESTABLISHED" ) \ 236 EM( TCP_SYN_SENT, "SYN_SENT" ) \ 237 EM( TCP_SYN_RECV, "SYN_RECV" ) \ 238 EM( TCP_FIN_WAIT1, "FIN_WAIT1" ) \ 239 EM( TCP_FIN_WAIT2, "FIN_WAIT2" ) \ 240 EM( TCP_TIME_WAIT, "TIME_WAIT" ) \ 241 EM( TCP_CLOSE, "CLOSE" ) \ 242 EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" ) \ 243 EM( TCP_LAST_ACK, "LAST_ACK" ) \ 244 EM( TCP_LISTEN, "LISTEN" ) \ 245 EMe( TCP_CLOSING, "CLOSING" ) 246 247 #define rpc_show_sock_state(state) \ 248 __print_symbolic(state, RPC_SHOW_SOCK) 249 250 RPC_SHOW_SOCK 251 252 /* 253 * Now redefine the EM() and EMe() macros to map the enums to the strings 254 * that will be printed in the output. 255 */ 256 #undef EM 257 #undef EMe 258 #define EM(a, b) {a, b}, 259 #define EMe(a, b) {a, b} 260 261 DECLARE_EVENT_CLASS(xs_socket_event, 262 263 TP_PROTO( 264 struct rpc_xprt *xprt, 265 struct socket *socket 266 ), 267 268 TP_ARGS(xprt, socket), 269 270 TP_STRUCT__entry( 271 __field(unsigned int, socket_state) 272 __field(unsigned int, sock_state) 273 __field(unsigned long long, ino) 274 __string(dstaddr, 275 xprt->address_strings[RPC_DISPLAY_ADDR]) 276 __string(dstport, 277 xprt->address_strings[RPC_DISPLAY_PORT]) 278 ), 279 280 TP_fast_assign( 281 struct inode *inode = SOCK_INODE(socket); 282 __entry->socket_state = socket->state; 283 __entry->sock_state = socket->sk->sk_state; 284 __entry->ino = (unsigned long long)inode->i_ino; 285 __assign_str(dstaddr, 286 xprt->address_strings[RPC_DISPLAY_ADDR]); 287 __assign_str(dstport, 288 xprt->address_strings[RPC_DISPLAY_PORT]); 289 ), 290 291 TP_printk( 292 "socket:[%llu] dstaddr=%s/%s " 293 "state=%u (%s) sk_state=%u (%s)", 294 __entry->ino, __get_str(dstaddr), __get_str(dstport), 295 __entry->socket_state, 296 rpc_show_socket_state(__entry->socket_state), 297 __entry->sock_state, 298 rpc_show_sock_state(__entry->sock_state) 299 ) 300 ); 301 #define DEFINE_RPC_SOCKET_EVENT(name) \ 302 DEFINE_EVENT(xs_socket_event, name, \ 303 TP_PROTO( \ 304 struct rpc_xprt *xprt, \ 305 struct socket *socket \ 306 ), \ 307 TP_ARGS(xprt, socket)) 308 309 DECLARE_EVENT_CLASS(xs_socket_event_done, 310 311 TP_PROTO( 312 struct rpc_xprt *xprt, 313 struct socket *socket, 314 int error 315 ), 316 317 TP_ARGS(xprt, socket, error), 318 319 TP_STRUCT__entry( 320 __field(int, error) 321 __field(unsigned int, socket_state) 322 __field(unsigned int, sock_state) 323 __field(unsigned long long, ino) 324 __string(dstaddr, 325 xprt->address_strings[RPC_DISPLAY_ADDR]) 326 __string(dstport, 327 xprt->address_strings[RPC_DISPLAY_PORT]) 328 ), 329 330 TP_fast_assign( 331 struct inode *inode = SOCK_INODE(socket); 332 __entry->socket_state = socket->state; 333 __entry->sock_state = socket->sk->sk_state; 334 __entry->ino = (unsigned long long)inode->i_ino; 335 __entry->error = error; 336 __assign_str(dstaddr, 337 xprt->address_strings[RPC_DISPLAY_ADDR]); 338 __assign_str(dstport, 339 xprt->address_strings[RPC_DISPLAY_PORT]); 340 ), 341 342 TP_printk( 343 "error=%d socket:[%llu] dstaddr=%s/%s " 344 "state=%u (%s) sk_state=%u (%s)", 345 __entry->error, 346 __entry->ino, __get_str(dstaddr), __get_str(dstport), 347 __entry->socket_state, 348 rpc_show_socket_state(__entry->socket_state), 349 __entry->sock_state, 350 rpc_show_sock_state(__entry->sock_state) 351 ) 352 ); 353 #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \ 354 DEFINE_EVENT(xs_socket_event_done, name, \ 355 TP_PROTO( \ 356 struct rpc_xprt *xprt, \ 357 struct socket *socket, \ 358 int error \ 359 ), \ 360 TP_ARGS(xprt, socket, error)) 361 362 DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change); 363 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect); 364 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error); 365 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection); 366 DEFINE_RPC_SOCKET_EVENT(rpc_socket_close); 367 DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown); 368 369 DECLARE_EVENT_CLASS(rpc_xprt_event, 370 TP_PROTO( 371 const struct rpc_xprt *xprt, 372 __be32 xid, 373 int status 374 ), 375 376 TP_ARGS(xprt, xid, status), 377 378 TP_STRUCT__entry( 379 __field(u32, xid) 380 __field(int, status) 381 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR]) 382 __string(port, xprt->address_strings[RPC_DISPLAY_PORT]) 383 ), 384 385 TP_fast_assign( 386 __entry->xid = be32_to_cpu(xid); 387 __entry->status = status; 388 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]); 389 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]); 390 ), 391 392 TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr), 393 __get_str(port), __entry->xid, 394 __entry->status) 395 ); 396 #define DEFINE_RPC_XPRT_EVENT(name) \ 397 DEFINE_EVENT(rpc_xprt_event, xprt_##name, \ 398 TP_PROTO( \ 399 const struct rpc_xprt *xprt, \ 400 __be32 xid, \ 401 int status \ 402 ), \ 403 TP_ARGS(xprt, xid, status)) 404 405 DEFINE_RPC_XPRT_EVENT(timer); 406 DEFINE_RPC_XPRT_EVENT(lookup_rqst); 407 DEFINE_RPC_XPRT_EVENT(transmit); 408 DEFINE_RPC_XPRT_EVENT(complete_rqst); 409 410 TRACE_EVENT(xprt_ping, 411 TP_PROTO(const struct rpc_xprt *xprt, int status), 412 413 TP_ARGS(xprt, status), 414 415 TP_STRUCT__entry( 416 __field(int, status) 417 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR]) 418 __string(port, xprt->address_strings[RPC_DISPLAY_PORT]) 419 ), 420 421 TP_fast_assign( 422 __entry->status = status; 423 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]); 424 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]); 425 ), 426 427 TP_printk("peer=[%s]:%s status=%d", 428 __get_str(addr), __get_str(port), __entry->status) 429 ); 430 431 TRACE_EVENT(xs_stream_read_data, 432 TP_PROTO(struct rpc_xprt *xprt, ssize_t err, size_t total), 433 434 TP_ARGS(xprt, err, total), 435 436 TP_STRUCT__entry( 437 __field(ssize_t, err) 438 __field(size_t, total) 439 __string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] : 440 "(null)") 441 __string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] : 442 "(null)") 443 ), 444 445 TP_fast_assign( 446 __entry->err = err; 447 __entry->total = total; 448 __assign_str(addr, xprt ? 449 xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)"); 450 __assign_str(port, xprt ? 451 xprt->address_strings[RPC_DISPLAY_PORT] : "(null)"); 452 ), 453 454 TP_printk("peer=[%s]:%s err=%zd total=%zu", __get_str(addr), 455 __get_str(port), __entry->err, __entry->total) 456 ); 457 458 TRACE_EVENT(xs_stream_read_request, 459 TP_PROTO(struct sock_xprt *xs), 460 461 TP_ARGS(xs), 462 463 TP_STRUCT__entry( 464 __string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]) 465 __string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]) 466 __field(u32, xid) 467 __field(unsigned long, copied) 468 __field(unsigned int, reclen) 469 __field(unsigned int, offset) 470 ), 471 472 TP_fast_assign( 473 __assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]); 474 __assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]); 475 __entry->xid = be32_to_cpu(xs->recv.xid); 476 __entry->copied = xs->recv.copied; 477 __entry->reclen = xs->recv.len; 478 __entry->offset = xs->recv.offset; 479 ), 480 481 TP_printk("peer=[%s]:%s xid=0x%08x copied=%lu reclen=%u offset=%u", 482 __get_str(addr), __get_str(port), __entry->xid, 483 __entry->copied, __entry->reclen, __entry->offset) 484 ); 485 486 #define show_rqstp_flags(flags) \ 487 __print_flags(flags, "|", \ 488 { (1UL << RQ_SECURE), "RQ_SECURE"}, \ 489 { (1UL << RQ_LOCAL), "RQ_LOCAL"}, \ 490 { (1UL << RQ_USEDEFERRAL), "RQ_USEDEFERRAL"}, \ 491 { (1UL << RQ_DROPME), "RQ_DROPME"}, \ 492 { (1UL << RQ_SPLICE_OK), "RQ_SPLICE_OK"}, \ 493 { (1UL << RQ_VICTIM), "RQ_VICTIM"}, \ 494 { (1UL << RQ_BUSY), "RQ_BUSY"}) 495 496 TRACE_EVENT(svc_recv, 497 TP_PROTO(struct svc_rqst *rqst, int len), 498 499 TP_ARGS(rqst, len), 500 501 TP_STRUCT__entry( 502 __field(u32, xid) 503 __field(int, len) 504 __field(unsigned long, flags) 505 __string(addr, rqst->rq_xprt->xpt_remotebuf) 506 ), 507 508 TP_fast_assign( 509 __entry->xid = be32_to_cpu(rqst->rq_xid); 510 __entry->len = len; 511 __entry->flags = rqst->rq_flags; 512 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 513 ), 514 515 TP_printk("addr=%s xid=0x%08x len=%d flags=%s", 516 __get_str(addr), __entry->xid, __entry->len, 517 show_rqstp_flags(__entry->flags)) 518 ); 519 520 TRACE_EVENT(svc_process, 521 TP_PROTO(const struct svc_rqst *rqst, const char *name), 522 523 TP_ARGS(rqst, name), 524 525 TP_STRUCT__entry( 526 __field(u32, xid) 527 __field(u32, vers) 528 __field(u32, proc) 529 __string(service, name) 530 __string(addr, rqst->rq_xprt ? 531 rqst->rq_xprt->xpt_remotebuf : "(null)") 532 ), 533 534 TP_fast_assign( 535 __entry->xid = be32_to_cpu(rqst->rq_xid); 536 __entry->vers = rqst->rq_vers; 537 __entry->proc = rqst->rq_proc; 538 __assign_str(service, name); 539 __assign_str(addr, rqst->rq_xprt ? 540 rqst->rq_xprt->xpt_remotebuf : "(null)"); 541 ), 542 543 TP_printk("addr=%s xid=0x%08x service=%s vers=%u proc=%u", 544 __get_str(addr), __entry->xid, 545 __get_str(service), __entry->vers, __entry->proc) 546 ); 547 548 DECLARE_EVENT_CLASS(svc_rqst_event, 549 550 TP_PROTO( 551 const struct svc_rqst *rqst 552 ), 553 554 TP_ARGS(rqst), 555 556 TP_STRUCT__entry( 557 __field(u32, xid) 558 __field(unsigned long, flags) 559 __string(addr, rqst->rq_xprt->xpt_remotebuf) 560 ), 561 562 TP_fast_assign( 563 __entry->xid = be32_to_cpu(rqst->rq_xid); 564 __entry->flags = rqst->rq_flags; 565 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 566 ), 567 568 TP_printk("addr=%s xid=0x%08x flags=%s", 569 __get_str(addr), __entry->xid, 570 show_rqstp_flags(__entry->flags)) 571 ); 572 #define DEFINE_SVC_RQST_EVENT(name) \ 573 DEFINE_EVENT(svc_rqst_event, svc_##name, \ 574 TP_PROTO( \ 575 const struct svc_rqst *rqst \ 576 ), \ 577 TP_ARGS(rqst)) 578 579 DEFINE_SVC_RQST_EVENT(defer); 580 DEFINE_SVC_RQST_EVENT(drop); 581 582 DECLARE_EVENT_CLASS(svc_rqst_status, 583 584 TP_PROTO(struct svc_rqst *rqst, int status), 585 586 TP_ARGS(rqst, status), 587 588 TP_STRUCT__entry( 589 __field(u32, xid) 590 __field(int, status) 591 __field(unsigned long, flags) 592 __string(addr, rqst->rq_xprt->xpt_remotebuf) 593 ), 594 595 TP_fast_assign( 596 __entry->xid = be32_to_cpu(rqst->rq_xid); 597 __entry->status = status; 598 __entry->flags = rqst->rq_flags; 599 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 600 ), 601 602 TP_printk("addr=%s xid=0x%08x status=%d flags=%s", 603 __get_str(addr), __entry->xid, 604 __entry->status, show_rqstp_flags(__entry->flags)) 605 ); 606 607 DEFINE_EVENT(svc_rqst_status, svc_send, 608 TP_PROTO(struct svc_rqst *rqst, int status), 609 TP_ARGS(rqst, status)); 610 611 #define show_svc_xprt_flags(flags) \ 612 __print_flags(flags, "|", \ 613 { (1UL << XPT_BUSY), "XPT_BUSY"}, \ 614 { (1UL << XPT_CONN), "XPT_CONN"}, \ 615 { (1UL << XPT_CLOSE), "XPT_CLOSE"}, \ 616 { (1UL << XPT_DATA), "XPT_DATA"}, \ 617 { (1UL << XPT_TEMP), "XPT_TEMP"}, \ 618 { (1UL << XPT_DEAD), "XPT_DEAD"}, \ 619 { (1UL << XPT_CHNGBUF), "XPT_CHNGBUF"}, \ 620 { (1UL << XPT_DEFERRED), "XPT_DEFERRED"}, \ 621 { (1UL << XPT_OLD), "XPT_OLD"}, \ 622 { (1UL << XPT_LISTENER), "XPT_LISTENER"}, \ 623 { (1UL << XPT_CACHE_AUTH), "XPT_CACHE_AUTH"}, \ 624 { (1UL << XPT_LOCAL), "XPT_LOCAL"}, \ 625 { (1UL << XPT_KILL_TEMP), "XPT_KILL_TEMP"}, \ 626 { (1UL << XPT_CONG_CTRL), "XPT_CONG_CTRL"}) 627 628 TRACE_EVENT(svc_xprt_do_enqueue, 629 TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst), 630 631 TP_ARGS(xprt, rqst), 632 633 TP_STRUCT__entry( 634 __field(struct svc_xprt *, xprt) 635 __field(int, pid) 636 __field(unsigned long, flags) 637 __string(addr, xprt->xpt_remotebuf) 638 ), 639 640 TP_fast_assign( 641 __entry->xprt = xprt; 642 __entry->pid = rqst? rqst->rq_task->pid : 0; 643 __entry->flags = xprt->xpt_flags; 644 __assign_str(addr, xprt->xpt_remotebuf); 645 ), 646 647 TP_printk("xprt=%p addr=%s pid=%d flags=%s", 648 __entry->xprt, __get_str(addr), 649 __entry->pid, show_svc_xprt_flags(__entry->flags)) 650 ); 651 652 DECLARE_EVENT_CLASS(svc_xprt_event, 653 TP_PROTO(struct svc_xprt *xprt), 654 655 TP_ARGS(xprt), 656 657 TP_STRUCT__entry( 658 __field(struct svc_xprt *, xprt) 659 __field(unsigned long, flags) 660 __string(addr, xprt->xpt_remotebuf) 661 ), 662 663 TP_fast_assign( 664 __entry->xprt = xprt; 665 __entry->flags = xprt->xpt_flags; 666 __assign_str(addr, xprt->xpt_remotebuf); 667 ), 668 669 TP_printk("xprt=%p addr=%s flags=%s", 670 __entry->xprt, __get_str(addr), 671 show_svc_xprt_flags(__entry->flags)) 672 ); 673 674 DEFINE_EVENT(svc_xprt_event, svc_xprt_no_write_space, 675 TP_PROTO(struct svc_xprt *xprt), 676 TP_ARGS(xprt)); 677 678 TRACE_EVENT(svc_xprt_dequeue, 679 TP_PROTO(struct svc_rqst *rqst), 680 681 TP_ARGS(rqst), 682 683 TP_STRUCT__entry( 684 __field(struct svc_xprt *, xprt) 685 __field(unsigned long, flags) 686 __field(unsigned long, wakeup) 687 __string(addr, rqst->rq_xprt->xpt_remotebuf) 688 ), 689 690 TP_fast_assign( 691 __entry->xprt = rqst->rq_xprt; 692 __entry->flags = rqst->rq_xprt->xpt_flags; 693 __entry->wakeup = ktime_to_us(ktime_sub(ktime_get(), 694 rqst->rq_qtime)); 695 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 696 ), 697 698 TP_printk("xprt=%p addr=%s flags=%s wakeup-us=%lu", 699 __entry->xprt, __get_str(addr), 700 show_svc_xprt_flags(__entry->flags), 701 __entry->wakeup) 702 ); 703 704 TRACE_EVENT(svc_wake_up, 705 TP_PROTO(int pid), 706 707 TP_ARGS(pid), 708 709 TP_STRUCT__entry( 710 __field(int, pid) 711 ), 712 713 TP_fast_assign( 714 __entry->pid = pid; 715 ), 716 717 TP_printk("pid=%d", __entry->pid) 718 ); 719 720 TRACE_EVENT(svc_handle_xprt, 721 TP_PROTO(struct svc_xprt *xprt, int len), 722 723 TP_ARGS(xprt, len), 724 725 TP_STRUCT__entry( 726 __field(struct svc_xprt *, xprt) 727 __field(int, len) 728 __field(unsigned long, flags) 729 __string(addr, xprt->xpt_remotebuf) 730 ), 731 732 TP_fast_assign( 733 __entry->xprt = xprt; 734 __entry->len = len; 735 __entry->flags = xprt->xpt_flags; 736 __assign_str(addr, xprt->xpt_remotebuf); 737 ), 738 739 TP_printk("xprt=%p addr=%s len=%d flags=%s", 740 __entry->xprt, __get_str(addr), 741 __entry->len, show_svc_xprt_flags(__entry->flags)) 742 ); 743 744 TRACE_EVENT(svc_stats_latency, 745 TP_PROTO(const struct svc_rqst *rqst), 746 747 TP_ARGS(rqst), 748 749 TP_STRUCT__entry( 750 __field(u32, xid) 751 __field(unsigned long, execute) 752 __string(addr, rqst->rq_xprt->xpt_remotebuf) 753 ), 754 755 TP_fast_assign( 756 __entry->xid = be32_to_cpu(rqst->rq_xid); 757 __entry->execute = ktime_to_us(ktime_sub(ktime_get(), 758 rqst->rq_stime)); 759 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 760 ), 761 762 TP_printk("addr=%s xid=0x%08x execute-us=%lu", 763 __get_str(addr), __entry->xid, __entry->execute) 764 ); 765 766 DECLARE_EVENT_CLASS(svc_deferred_event, 767 TP_PROTO( 768 const struct svc_deferred_req *dr 769 ), 770 771 TP_ARGS(dr), 772 773 TP_STRUCT__entry( 774 __field(u32, xid) 775 __string(addr, dr->xprt->xpt_remotebuf) 776 ), 777 778 TP_fast_assign( 779 __entry->xid = be32_to_cpu(*(__be32 *)(dr->args + 780 (dr->xprt_hlen>>2))); 781 __assign_str(addr, dr->xprt->xpt_remotebuf); 782 ), 783 784 TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid) 785 ); 786 #define DEFINE_SVC_DEFERRED_EVENT(name) \ 787 DEFINE_EVENT(svc_deferred_event, svc_##name##_deferred, \ 788 TP_PROTO( \ 789 const struct svc_deferred_req *dr \ 790 ), \ 791 TP_ARGS(dr)) 792 793 DEFINE_SVC_DEFERRED_EVENT(drop); 794 DEFINE_SVC_DEFERRED_EVENT(revisit); 795 796 #endif /* _TRACE_SUNRPC_H */ 797 798 #include <trace/define_trace.h> 799