1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (c) 2017, 2018 Oracle. All rights reserved. 4 * 5 * Trace point definitions for the "rpcrdma" subsystem. 6 */ 7 #undef TRACE_SYSTEM 8 #define TRACE_SYSTEM rpcrdma 9 10 #if !defined(_TRACE_RPCRDMA_H) || defined(TRACE_HEADER_MULTI_READ) 11 #define _TRACE_RPCRDMA_H 12 13 #include <linux/scatterlist.h> 14 #include <linux/tracepoint.h> 15 #include <trace/events/rdma.h> 16 17 /** 18 ** Event classes 19 **/ 20 21 DECLARE_EVENT_CLASS(xprtrdma_reply_event, 22 TP_PROTO( 23 const struct rpcrdma_rep *rep 24 ), 25 26 TP_ARGS(rep), 27 28 TP_STRUCT__entry( 29 __field(const void *, rep) 30 __field(const void *, r_xprt) 31 __field(u32, xid) 32 __field(u32, version) 33 __field(u32, proc) 34 ), 35 36 TP_fast_assign( 37 __entry->rep = rep; 38 __entry->r_xprt = rep->rr_rxprt; 39 __entry->xid = be32_to_cpu(rep->rr_xid); 40 __entry->version = be32_to_cpu(rep->rr_vers); 41 __entry->proc = be32_to_cpu(rep->rr_proc); 42 ), 43 44 TP_printk("rxprt %p xid=0x%08x rep=%p: version %u proc %u", 45 __entry->r_xprt, __entry->xid, __entry->rep, 46 __entry->version, __entry->proc 47 ) 48 ); 49 50 #define DEFINE_REPLY_EVENT(name) \ 51 DEFINE_EVENT(xprtrdma_reply_event, name, \ 52 TP_PROTO( \ 53 const struct rpcrdma_rep *rep \ 54 ), \ 55 TP_ARGS(rep)) 56 57 DECLARE_EVENT_CLASS(xprtrdma_rxprt, 58 TP_PROTO( 59 const struct rpcrdma_xprt *r_xprt 60 ), 61 62 TP_ARGS(r_xprt), 63 64 TP_STRUCT__entry( 65 __field(const void *, r_xprt) 66 __string(addr, rpcrdma_addrstr(r_xprt)) 67 __string(port, rpcrdma_portstr(r_xprt)) 68 ), 69 70 TP_fast_assign( 71 __entry->r_xprt = r_xprt; 72 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 73 __assign_str(port, rpcrdma_portstr(r_xprt)); 74 ), 75 76 TP_printk("peer=[%s]:%s r_xprt=%p", 77 __get_str(addr), __get_str(port), __entry->r_xprt 78 ) 79 ); 80 81 #define DEFINE_RXPRT_EVENT(name) \ 82 DEFINE_EVENT(xprtrdma_rxprt, name, \ 83 TP_PROTO( \ 84 const struct rpcrdma_xprt *r_xprt \ 85 ), \ 86 TP_ARGS(r_xprt)) 87 88 DECLARE_EVENT_CLASS(xprtrdma_connect_class, 89 TP_PROTO( 90 const struct rpcrdma_xprt *r_xprt, 91 int rc 92 ), 93 94 TP_ARGS(r_xprt, rc), 95 96 TP_STRUCT__entry( 97 __field(const void *, r_xprt) 98 __field(int, rc) 99 __field(int, connect_status) 100 __string(addr, rpcrdma_addrstr(r_xprt)) 101 __string(port, rpcrdma_portstr(r_xprt)) 102 ), 103 104 TP_fast_assign( 105 __entry->r_xprt = r_xprt; 106 __entry->rc = rc; 107 __entry->connect_status = r_xprt->rx_ep.rep_connected; 108 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 109 __assign_str(port, rpcrdma_portstr(r_xprt)); 110 ), 111 112 TP_printk("peer=[%s]:%s r_xprt=%p: rc=%d connect status=%d", 113 __get_str(addr), __get_str(port), __entry->r_xprt, 114 __entry->rc, __entry->connect_status 115 ) 116 ); 117 118 #define DEFINE_CONN_EVENT(name) \ 119 DEFINE_EVENT(xprtrdma_connect_class, xprtrdma_##name, \ 120 TP_PROTO( \ 121 const struct rpcrdma_xprt *r_xprt, \ 122 int rc \ 123 ), \ 124 TP_ARGS(r_xprt, rc)) 125 126 DECLARE_EVENT_CLASS(xprtrdma_rdch_event, 127 TP_PROTO( 128 const struct rpc_task *task, 129 unsigned int pos, 130 struct rpcrdma_mr *mr, 131 int nsegs 132 ), 133 134 TP_ARGS(task, pos, mr, nsegs), 135 136 TP_STRUCT__entry( 137 __field(unsigned int, task_id) 138 __field(unsigned int, client_id) 139 __field(unsigned int, pos) 140 __field(int, nents) 141 __field(u32, handle) 142 __field(u32, length) 143 __field(u64, offset) 144 __field(int, nsegs) 145 ), 146 147 TP_fast_assign( 148 __entry->task_id = task->tk_pid; 149 __entry->client_id = task->tk_client->cl_clid; 150 __entry->pos = pos; 151 __entry->nents = mr->mr_nents; 152 __entry->handle = mr->mr_handle; 153 __entry->length = mr->mr_length; 154 __entry->offset = mr->mr_offset; 155 __entry->nsegs = nsegs; 156 ), 157 158 TP_printk("task:%u@%u pos=%u %u@0x%016llx:0x%08x (%s)", 159 __entry->task_id, __entry->client_id, 160 __entry->pos, __entry->length, 161 (unsigned long long)__entry->offset, __entry->handle, 162 __entry->nents < __entry->nsegs ? "more" : "last" 163 ) 164 ); 165 166 #define DEFINE_RDCH_EVENT(name) \ 167 DEFINE_EVENT(xprtrdma_rdch_event, xprtrdma_chunk_##name,\ 168 TP_PROTO( \ 169 const struct rpc_task *task, \ 170 unsigned int pos, \ 171 struct rpcrdma_mr *mr, \ 172 int nsegs \ 173 ), \ 174 TP_ARGS(task, pos, mr, nsegs)) 175 176 DECLARE_EVENT_CLASS(xprtrdma_wrch_event, 177 TP_PROTO( 178 const struct rpc_task *task, 179 struct rpcrdma_mr *mr, 180 int nsegs 181 ), 182 183 TP_ARGS(task, mr, nsegs), 184 185 TP_STRUCT__entry( 186 __field(unsigned int, task_id) 187 __field(unsigned int, client_id) 188 __field(int, nents) 189 __field(u32, handle) 190 __field(u32, length) 191 __field(u64, offset) 192 __field(int, nsegs) 193 ), 194 195 TP_fast_assign( 196 __entry->task_id = task->tk_pid; 197 __entry->client_id = task->tk_client->cl_clid; 198 __entry->nents = mr->mr_nents; 199 __entry->handle = mr->mr_handle; 200 __entry->length = mr->mr_length; 201 __entry->offset = mr->mr_offset; 202 __entry->nsegs = nsegs; 203 ), 204 205 TP_printk("task:%u@%u %u@0x%016llx:0x%08x (%s)", 206 __entry->task_id, __entry->client_id, 207 __entry->length, (unsigned long long)__entry->offset, 208 __entry->handle, 209 __entry->nents < __entry->nsegs ? "more" : "last" 210 ) 211 ); 212 213 #define DEFINE_WRCH_EVENT(name) \ 214 DEFINE_EVENT(xprtrdma_wrch_event, xprtrdma_chunk_##name,\ 215 TP_PROTO( \ 216 const struct rpc_task *task, \ 217 struct rpcrdma_mr *mr, \ 218 int nsegs \ 219 ), \ 220 TP_ARGS(task, mr, nsegs)) 221 222 DECLARE_EVENT_CLASS(xprtrdma_frwr_done, 223 TP_PROTO( 224 const struct ib_wc *wc, 225 const struct rpcrdma_frwr *frwr 226 ), 227 228 TP_ARGS(wc, frwr), 229 230 TP_STRUCT__entry( 231 __field(const void *, mr) 232 __field(unsigned int, status) 233 __field(unsigned int, vendor_err) 234 ), 235 236 TP_fast_assign( 237 __entry->mr = container_of(frwr, struct rpcrdma_mr, frwr); 238 __entry->status = wc->status; 239 __entry->vendor_err = __entry->status ? wc->vendor_err : 0; 240 ), 241 242 TP_printk( 243 "mr=%p: %s (%u/0x%x)", 244 __entry->mr, rdma_show_wc_status(__entry->status), 245 __entry->status, __entry->vendor_err 246 ) 247 ); 248 249 #define DEFINE_FRWR_DONE_EVENT(name) \ 250 DEFINE_EVENT(xprtrdma_frwr_done, name, \ 251 TP_PROTO( \ 252 const struct ib_wc *wc, \ 253 const struct rpcrdma_frwr *frwr \ 254 ), \ 255 TP_ARGS(wc, frwr)) 256 257 TRACE_DEFINE_ENUM(DMA_BIDIRECTIONAL); 258 TRACE_DEFINE_ENUM(DMA_TO_DEVICE); 259 TRACE_DEFINE_ENUM(DMA_FROM_DEVICE); 260 TRACE_DEFINE_ENUM(DMA_NONE); 261 262 #define xprtrdma_show_direction(x) \ 263 __print_symbolic(x, \ 264 { DMA_BIDIRECTIONAL, "BIDIR" }, \ 265 { DMA_TO_DEVICE, "TO_DEVICE" }, \ 266 { DMA_FROM_DEVICE, "FROM_DEVICE" }, \ 267 { DMA_NONE, "NONE" }) 268 269 DECLARE_EVENT_CLASS(xprtrdma_mr, 270 TP_PROTO( 271 const struct rpcrdma_mr *mr 272 ), 273 274 TP_ARGS(mr), 275 276 TP_STRUCT__entry( 277 __field(const void *, mr) 278 __field(u32, handle) 279 __field(u32, length) 280 __field(u64, offset) 281 __field(u32, dir) 282 ), 283 284 TP_fast_assign( 285 __entry->mr = mr; 286 __entry->handle = mr->mr_handle; 287 __entry->length = mr->mr_length; 288 __entry->offset = mr->mr_offset; 289 __entry->dir = mr->mr_dir; 290 ), 291 292 TP_printk("mr=%p %u@0x%016llx:0x%08x (%s)", 293 __entry->mr, __entry->length, 294 (unsigned long long)__entry->offset, __entry->handle, 295 xprtrdma_show_direction(__entry->dir) 296 ) 297 ); 298 299 #define DEFINE_MR_EVENT(name) \ 300 DEFINE_EVENT(xprtrdma_mr, xprtrdma_mr_##name, \ 301 TP_PROTO( \ 302 const struct rpcrdma_mr *mr \ 303 ), \ 304 TP_ARGS(mr)) 305 306 DECLARE_EVENT_CLASS(xprtrdma_cb_event, 307 TP_PROTO( 308 const struct rpc_rqst *rqst 309 ), 310 311 TP_ARGS(rqst), 312 313 TP_STRUCT__entry( 314 __field(const void *, rqst) 315 __field(const void *, rep) 316 __field(const void *, req) 317 __field(u32, xid) 318 ), 319 320 TP_fast_assign( 321 __entry->rqst = rqst; 322 __entry->req = rpcr_to_rdmar(rqst); 323 __entry->rep = rpcr_to_rdmar(rqst)->rl_reply; 324 __entry->xid = be32_to_cpu(rqst->rq_xid); 325 ), 326 327 TP_printk("xid=0x%08x, rqst=%p req=%p rep=%p", 328 __entry->xid, __entry->rqst, __entry->req, __entry->rep 329 ) 330 ); 331 332 #define DEFINE_CB_EVENT(name) \ 333 DEFINE_EVENT(xprtrdma_cb_event, name, \ 334 TP_PROTO( \ 335 const struct rpc_rqst *rqst \ 336 ), \ 337 TP_ARGS(rqst)) 338 339 /** 340 ** Connection events 341 **/ 342 343 TRACE_EVENT(xprtrdma_cm_event, 344 TP_PROTO( 345 const struct rpcrdma_xprt *r_xprt, 346 struct rdma_cm_event *event 347 ), 348 349 TP_ARGS(r_xprt, event), 350 351 TP_STRUCT__entry( 352 __field(const void *, r_xprt) 353 __field(unsigned int, event) 354 __field(int, status) 355 __string(addr, rpcrdma_addrstr(r_xprt)) 356 __string(port, rpcrdma_portstr(r_xprt)) 357 ), 358 359 TP_fast_assign( 360 __entry->r_xprt = r_xprt; 361 __entry->event = event->event; 362 __entry->status = event->status; 363 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 364 __assign_str(port, rpcrdma_portstr(r_xprt)); 365 ), 366 367 TP_printk("peer=[%s]:%s r_xprt=%p: %s (%u/%d)", 368 __get_str(addr), __get_str(port), 369 __entry->r_xprt, rdma_show_cm_event(__entry->event), 370 __entry->event, __entry->status 371 ) 372 ); 373 374 TRACE_EVENT(xprtrdma_inline_thresh, 375 TP_PROTO( 376 const struct rpcrdma_xprt *r_xprt 377 ), 378 379 TP_ARGS(r_xprt), 380 381 TP_STRUCT__entry( 382 __field(const void *, r_xprt) 383 __field(unsigned int, inline_send) 384 __field(unsigned int, inline_recv) 385 __field(unsigned int, max_send) 386 __field(unsigned int, max_recv) 387 __string(addr, rpcrdma_addrstr(r_xprt)) 388 __string(port, rpcrdma_portstr(r_xprt)) 389 ), 390 391 TP_fast_assign( 392 const struct rpcrdma_ep *ep = &r_xprt->rx_ep; 393 394 __entry->r_xprt = r_xprt; 395 __entry->inline_send = ep->rep_inline_send; 396 __entry->inline_recv = ep->rep_inline_recv; 397 __entry->max_send = ep->rep_max_inline_send; 398 __entry->max_recv = ep->rep_max_inline_recv; 399 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 400 __assign_str(port, rpcrdma_portstr(r_xprt)); 401 ), 402 403 TP_printk("peer=[%s]:%s r_xprt=%p neg send/recv=%u/%u, calc send/recv=%u/%u", 404 __get_str(addr), __get_str(port), __entry->r_xprt, 405 __entry->inline_send, __entry->inline_recv, 406 __entry->max_send, __entry->max_recv 407 ) 408 ); 409 410 DEFINE_CONN_EVENT(connect); 411 DEFINE_CONN_EVENT(disconnect); 412 413 DEFINE_RXPRT_EVENT(xprtrdma_create); 414 DEFINE_RXPRT_EVENT(xprtrdma_op_destroy); 415 DEFINE_RXPRT_EVENT(xprtrdma_remove); 416 DEFINE_RXPRT_EVENT(xprtrdma_reinsert); 417 DEFINE_RXPRT_EVENT(xprtrdma_op_inject_dsc); 418 DEFINE_RXPRT_EVENT(xprtrdma_op_close); 419 DEFINE_RXPRT_EVENT(xprtrdma_op_setport); 420 421 TRACE_EVENT(xprtrdma_op_connect, 422 TP_PROTO( 423 const struct rpcrdma_xprt *r_xprt, 424 unsigned long delay 425 ), 426 427 TP_ARGS(r_xprt, delay), 428 429 TP_STRUCT__entry( 430 __field(const void *, r_xprt) 431 __field(unsigned long, delay) 432 __string(addr, rpcrdma_addrstr(r_xprt)) 433 __string(port, rpcrdma_portstr(r_xprt)) 434 ), 435 436 TP_fast_assign( 437 __entry->r_xprt = r_xprt; 438 __entry->delay = delay; 439 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 440 __assign_str(port, rpcrdma_portstr(r_xprt)); 441 ), 442 443 TP_printk("peer=[%s]:%s r_xprt=%p delay=%lu", 444 __get_str(addr), __get_str(port), __entry->r_xprt, 445 __entry->delay 446 ) 447 ); 448 449 450 TRACE_EVENT(xprtrdma_op_set_cto, 451 TP_PROTO( 452 const struct rpcrdma_xprt *r_xprt, 453 unsigned long connect, 454 unsigned long reconnect 455 ), 456 457 TP_ARGS(r_xprt, connect, reconnect), 458 459 TP_STRUCT__entry( 460 __field(const void *, r_xprt) 461 __field(unsigned long, connect) 462 __field(unsigned long, reconnect) 463 __string(addr, rpcrdma_addrstr(r_xprt)) 464 __string(port, rpcrdma_portstr(r_xprt)) 465 ), 466 467 TP_fast_assign( 468 __entry->r_xprt = r_xprt; 469 __entry->connect = connect; 470 __entry->reconnect = reconnect; 471 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 472 __assign_str(port, rpcrdma_portstr(r_xprt)); 473 ), 474 475 TP_printk("peer=[%s]:%s r_xprt=%p: connect=%lu reconnect=%lu", 476 __get_str(addr), __get_str(port), __entry->r_xprt, 477 __entry->connect / HZ, __entry->reconnect / HZ 478 ) 479 ); 480 481 TRACE_EVENT(xprtrdma_qp_event, 482 TP_PROTO( 483 const struct rpcrdma_xprt *r_xprt, 484 const struct ib_event *event 485 ), 486 487 TP_ARGS(r_xprt, event), 488 489 TP_STRUCT__entry( 490 __field(const void *, r_xprt) 491 __field(unsigned int, event) 492 __string(name, event->device->name) 493 __string(addr, rpcrdma_addrstr(r_xprt)) 494 __string(port, rpcrdma_portstr(r_xprt)) 495 ), 496 497 TP_fast_assign( 498 __entry->r_xprt = r_xprt; 499 __entry->event = event->event; 500 __assign_str(name, event->device->name); 501 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 502 __assign_str(port, rpcrdma_portstr(r_xprt)); 503 ), 504 505 TP_printk("peer=[%s]:%s r_xprt=%p: dev %s: %s (%u)", 506 __get_str(addr), __get_str(port), __entry->r_xprt, 507 __get_str(name), rdma_show_ib_event(__entry->event), 508 __entry->event 509 ) 510 ); 511 512 /** 513 ** Call events 514 **/ 515 516 TRACE_EVENT(xprtrdma_createmrs, 517 TP_PROTO( 518 const struct rpcrdma_xprt *r_xprt, 519 unsigned int count 520 ), 521 522 TP_ARGS(r_xprt, count), 523 524 TP_STRUCT__entry( 525 __field(const void *, r_xprt) 526 __string(addr, rpcrdma_addrstr(r_xprt)) 527 __string(port, rpcrdma_portstr(r_xprt)) 528 __field(unsigned int, count) 529 ), 530 531 TP_fast_assign( 532 __entry->r_xprt = r_xprt; 533 __entry->count = count; 534 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 535 __assign_str(port, rpcrdma_portstr(r_xprt)); 536 ), 537 538 TP_printk("peer=[%s]:%s r_xprt=%p: created %u MRs", 539 __get_str(addr), __get_str(port), __entry->r_xprt, 540 __entry->count 541 ) 542 ); 543 544 TRACE_EVENT(xprtrdma_mr_get, 545 TP_PROTO( 546 const struct rpcrdma_req *req 547 ), 548 549 TP_ARGS(req), 550 551 TP_STRUCT__entry( 552 __field(const void *, req) 553 __field(unsigned int, task_id) 554 __field(unsigned int, client_id) 555 __field(u32, xid) 556 ), 557 558 TP_fast_assign( 559 const struct rpc_rqst *rqst = &req->rl_slot; 560 561 __entry->req = req; 562 __entry->task_id = rqst->rq_task->tk_pid; 563 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 564 __entry->xid = be32_to_cpu(rqst->rq_xid); 565 ), 566 567 TP_printk("task:%u@%u xid=0x%08x req=%p", 568 __entry->task_id, __entry->client_id, __entry->xid, 569 __entry->req 570 ) 571 ); 572 573 TRACE_EVENT(xprtrdma_nomrs, 574 TP_PROTO( 575 const struct rpcrdma_req *req 576 ), 577 578 TP_ARGS(req), 579 580 TP_STRUCT__entry( 581 __field(const void *, req) 582 __field(unsigned int, task_id) 583 __field(unsigned int, client_id) 584 __field(u32, xid) 585 ), 586 587 TP_fast_assign( 588 const struct rpc_rqst *rqst = &req->rl_slot; 589 590 __entry->req = req; 591 __entry->task_id = rqst->rq_task->tk_pid; 592 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 593 __entry->xid = be32_to_cpu(rqst->rq_xid); 594 ), 595 596 TP_printk("task:%u@%u xid=0x%08x req=%p", 597 __entry->task_id, __entry->client_id, __entry->xid, 598 __entry->req 599 ) 600 ); 601 602 DEFINE_RDCH_EVENT(read); 603 DEFINE_WRCH_EVENT(write); 604 DEFINE_WRCH_EVENT(reply); 605 606 TRACE_DEFINE_ENUM(rpcrdma_noch); 607 TRACE_DEFINE_ENUM(rpcrdma_noch_pullup); 608 TRACE_DEFINE_ENUM(rpcrdma_noch_mapped); 609 TRACE_DEFINE_ENUM(rpcrdma_readch); 610 TRACE_DEFINE_ENUM(rpcrdma_areadch); 611 TRACE_DEFINE_ENUM(rpcrdma_writech); 612 TRACE_DEFINE_ENUM(rpcrdma_replych); 613 614 #define xprtrdma_show_chunktype(x) \ 615 __print_symbolic(x, \ 616 { rpcrdma_noch, "inline" }, \ 617 { rpcrdma_noch_pullup, "pullup" }, \ 618 { rpcrdma_noch_mapped, "mapped" }, \ 619 { rpcrdma_readch, "read list" }, \ 620 { rpcrdma_areadch, "*read list" }, \ 621 { rpcrdma_writech, "write list" }, \ 622 { rpcrdma_replych, "reply chunk" }) 623 624 TRACE_EVENT(xprtrdma_marshal, 625 TP_PROTO( 626 const struct rpcrdma_req *req, 627 unsigned int rtype, 628 unsigned int wtype 629 ), 630 631 TP_ARGS(req, rtype, wtype), 632 633 TP_STRUCT__entry( 634 __field(unsigned int, task_id) 635 __field(unsigned int, client_id) 636 __field(u32, xid) 637 __field(unsigned int, hdrlen) 638 __field(unsigned int, headlen) 639 __field(unsigned int, pagelen) 640 __field(unsigned int, taillen) 641 __field(unsigned int, rtype) 642 __field(unsigned int, wtype) 643 ), 644 645 TP_fast_assign( 646 const struct rpc_rqst *rqst = &req->rl_slot; 647 648 __entry->task_id = rqst->rq_task->tk_pid; 649 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 650 __entry->xid = be32_to_cpu(rqst->rq_xid); 651 __entry->hdrlen = req->rl_hdrbuf.len; 652 __entry->headlen = rqst->rq_snd_buf.head[0].iov_len; 653 __entry->pagelen = rqst->rq_snd_buf.page_len; 654 __entry->taillen = rqst->rq_snd_buf.tail[0].iov_len; 655 __entry->rtype = rtype; 656 __entry->wtype = wtype; 657 ), 658 659 TP_printk("task:%u@%u xid=0x%08x: hdr=%u xdr=%u/%u/%u %s/%s", 660 __entry->task_id, __entry->client_id, __entry->xid, 661 __entry->hdrlen, 662 __entry->headlen, __entry->pagelen, __entry->taillen, 663 xprtrdma_show_chunktype(__entry->rtype), 664 xprtrdma_show_chunktype(__entry->wtype) 665 ) 666 ); 667 668 TRACE_EVENT(xprtrdma_marshal_failed, 669 TP_PROTO(const struct rpc_rqst *rqst, 670 int ret 671 ), 672 673 TP_ARGS(rqst, ret), 674 675 TP_STRUCT__entry( 676 __field(unsigned int, task_id) 677 __field(unsigned int, client_id) 678 __field(u32, xid) 679 __field(int, ret) 680 ), 681 682 TP_fast_assign( 683 __entry->task_id = rqst->rq_task->tk_pid; 684 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 685 __entry->xid = be32_to_cpu(rqst->rq_xid); 686 __entry->ret = ret; 687 ), 688 689 TP_printk("task:%u@%u xid=0x%08x: ret=%d", 690 __entry->task_id, __entry->client_id, __entry->xid, 691 __entry->ret 692 ) 693 ); 694 695 TRACE_EVENT(xprtrdma_prepsend_failed, 696 TP_PROTO(const struct rpc_rqst *rqst, 697 int ret 698 ), 699 700 TP_ARGS(rqst, ret), 701 702 TP_STRUCT__entry( 703 __field(unsigned int, task_id) 704 __field(unsigned int, client_id) 705 __field(u32, xid) 706 __field(int, ret) 707 ), 708 709 TP_fast_assign( 710 __entry->task_id = rqst->rq_task->tk_pid; 711 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 712 __entry->xid = be32_to_cpu(rqst->rq_xid); 713 __entry->ret = ret; 714 ), 715 716 TP_printk("task:%u@%u xid=0x%08x: ret=%d", 717 __entry->task_id, __entry->client_id, __entry->xid, 718 __entry->ret 719 ) 720 ); 721 722 TRACE_EVENT(xprtrdma_post_send, 723 TP_PROTO( 724 const struct rpcrdma_req *req, 725 int status 726 ), 727 728 TP_ARGS(req, status), 729 730 TP_STRUCT__entry( 731 __field(const void *, req) 732 __field(unsigned int, task_id) 733 __field(unsigned int, client_id) 734 __field(int, num_sge) 735 __field(int, signaled) 736 __field(int, status) 737 ), 738 739 TP_fast_assign( 740 const struct rpc_rqst *rqst = &req->rl_slot; 741 742 __entry->task_id = rqst->rq_task->tk_pid; 743 __entry->client_id = rqst->rq_task->tk_client ? 744 rqst->rq_task->tk_client->cl_clid : -1; 745 __entry->req = req; 746 __entry->num_sge = req->rl_wr.num_sge; 747 __entry->signaled = req->rl_wr.send_flags & IB_SEND_SIGNALED; 748 __entry->status = status; 749 ), 750 751 TP_printk("task:%u@%u req=%p (%d SGE%s) %sstatus=%d", 752 __entry->task_id, __entry->client_id, 753 __entry->req, __entry->num_sge, 754 (__entry->num_sge == 1 ? "" : "s"), 755 (__entry->signaled ? "signaled " : ""), 756 __entry->status 757 ) 758 ); 759 760 TRACE_EVENT(xprtrdma_post_recv, 761 TP_PROTO( 762 const struct rpcrdma_rep *rep 763 ), 764 765 TP_ARGS(rep), 766 767 TP_STRUCT__entry( 768 __field(const void *, rep) 769 ), 770 771 TP_fast_assign( 772 __entry->rep = rep; 773 ), 774 775 TP_printk("rep=%p", 776 __entry->rep 777 ) 778 ); 779 780 TRACE_EVENT(xprtrdma_post_recvs, 781 TP_PROTO( 782 const struct rpcrdma_xprt *r_xprt, 783 unsigned int count, 784 int status 785 ), 786 787 TP_ARGS(r_xprt, count, status), 788 789 TP_STRUCT__entry( 790 __field(const void *, r_xprt) 791 __field(unsigned int, count) 792 __field(int, status) 793 __field(int, posted) 794 __string(addr, rpcrdma_addrstr(r_xprt)) 795 __string(port, rpcrdma_portstr(r_xprt)) 796 ), 797 798 TP_fast_assign( 799 __entry->r_xprt = r_xprt; 800 __entry->count = count; 801 __entry->status = status; 802 __entry->posted = r_xprt->rx_ep.rep_receive_count; 803 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 804 __assign_str(port, rpcrdma_portstr(r_xprt)); 805 ), 806 807 TP_printk("peer=[%s]:%s r_xprt=%p: %u new recvs, %d active (rc %d)", 808 __get_str(addr), __get_str(port), __entry->r_xprt, 809 __entry->count, __entry->posted, __entry->status 810 ) 811 ); 812 813 TRACE_EVENT(xprtrdma_post_linv, 814 TP_PROTO( 815 const struct rpcrdma_req *req, 816 int status 817 ), 818 819 TP_ARGS(req, status), 820 821 TP_STRUCT__entry( 822 __field(const void *, req) 823 __field(int, status) 824 __field(u32, xid) 825 ), 826 827 TP_fast_assign( 828 __entry->req = req; 829 __entry->status = status; 830 __entry->xid = be32_to_cpu(req->rl_slot.rq_xid); 831 ), 832 833 TP_printk("req=%p xid=0x%08x status=%d", 834 __entry->req, __entry->xid, __entry->status 835 ) 836 ); 837 838 /** 839 ** Completion events 840 **/ 841 842 TRACE_EVENT(xprtrdma_wc_send, 843 TP_PROTO( 844 const struct rpcrdma_sendctx *sc, 845 const struct ib_wc *wc 846 ), 847 848 TP_ARGS(sc, wc), 849 850 TP_STRUCT__entry( 851 __field(const void *, req) 852 __field(unsigned int, unmap_count) 853 __field(unsigned int, status) 854 __field(unsigned int, vendor_err) 855 ), 856 857 TP_fast_assign( 858 __entry->req = sc->sc_req; 859 __entry->unmap_count = sc->sc_unmap_count; 860 __entry->status = wc->status; 861 __entry->vendor_err = __entry->status ? wc->vendor_err : 0; 862 ), 863 864 TP_printk("req=%p, unmapped %u pages: %s (%u/0x%x)", 865 __entry->req, __entry->unmap_count, 866 rdma_show_wc_status(__entry->status), 867 __entry->status, __entry->vendor_err 868 ) 869 ); 870 871 TRACE_EVENT(xprtrdma_wc_receive, 872 TP_PROTO( 873 const struct ib_wc *wc 874 ), 875 876 TP_ARGS(wc), 877 878 TP_STRUCT__entry( 879 __field(const void *, rep) 880 __field(u32, byte_len) 881 __field(unsigned int, status) 882 __field(u32, vendor_err) 883 ), 884 885 TP_fast_assign( 886 __entry->rep = container_of(wc->wr_cqe, struct rpcrdma_rep, 887 rr_cqe); 888 __entry->status = wc->status; 889 if (wc->status) { 890 __entry->byte_len = 0; 891 __entry->vendor_err = wc->vendor_err; 892 } else { 893 __entry->byte_len = wc->byte_len; 894 __entry->vendor_err = 0; 895 } 896 ), 897 898 TP_printk("rep=%p %u bytes: %s (%u/0x%x)", 899 __entry->rep, __entry->byte_len, 900 rdma_show_wc_status(__entry->status), 901 __entry->status, __entry->vendor_err 902 ) 903 ); 904 905 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_fastreg); 906 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li); 907 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li_wake); 908 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li_done); 909 910 TRACE_EVENT(xprtrdma_frwr_alloc, 911 TP_PROTO( 912 const struct rpcrdma_mr *mr, 913 int rc 914 ), 915 916 TP_ARGS(mr, rc), 917 918 TP_STRUCT__entry( 919 __field(const void *, mr) 920 __field(int, rc) 921 ), 922 923 TP_fast_assign( 924 __entry->mr = mr; 925 __entry->rc = rc; 926 ), 927 928 TP_printk("mr=%p: rc=%d", 929 __entry->mr, __entry->rc 930 ) 931 ); 932 933 TRACE_EVENT(xprtrdma_frwr_dereg, 934 TP_PROTO( 935 const struct rpcrdma_mr *mr, 936 int rc 937 ), 938 939 TP_ARGS(mr, rc), 940 941 TP_STRUCT__entry( 942 __field(const void *, mr) 943 __field(u32, handle) 944 __field(u32, length) 945 __field(u64, offset) 946 __field(u32, dir) 947 __field(int, rc) 948 ), 949 950 TP_fast_assign( 951 __entry->mr = mr; 952 __entry->handle = mr->mr_handle; 953 __entry->length = mr->mr_length; 954 __entry->offset = mr->mr_offset; 955 __entry->dir = mr->mr_dir; 956 __entry->rc = rc; 957 ), 958 959 TP_printk("mr=%p %u@0x%016llx:0x%08x (%s): rc=%d", 960 __entry->mr, __entry->length, 961 (unsigned long long)__entry->offset, __entry->handle, 962 xprtrdma_show_direction(__entry->dir), 963 __entry->rc 964 ) 965 ); 966 967 TRACE_EVENT(xprtrdma_frwr_sgerr, 968 TP_PROTO( 969 const struct rpcrdma_mr *mr, 970 int sg_nents 971 ), 972 973 TP_ARGS(mr, sg_nents), 974 975 TP_STRUCT__entry( 976 __field(const void *, mr) 977 __field(u64, addr) 978 __field(u32, dir) 979 __field(int, nents) 980 ), 981 982 TP_fast_assign( 983 __entry->mr = mr; 984 __entry->addr = mr->mr_sg->dma_address; 985 __entry->dir = mr->mr_dir; 986 __entry->nents = sg_nents; 987 ), 988 989 TP_printk("mr=%p dma addr=0x%llx (%s) sg_nents=%d", 990 __entry->mr, __entry->addr, 991 xprtrdma_show_direction(__entry->dir), 992 __entry->nents 993 ) 994 ); 995 996 TRACE_EVENT(xprtrdma_frwr_maperr, 997 TP_PROTO( 998 const struct rpcrdma_mr *mr, 999 int num_mapped 1000 ), 1001 1002 TP_ARGS(mr, num_mapped), 1003 1004 TP_STRUCT__entry( 1005 __field(const void *, mr) 1006 __field(u64, addr) 1007 __field(u32, dir) 1008 __field(int, num_mapped) 1009 __field(int, nents) 1010 ), 1011 1012 TP_fast_assign( 1013 __entry->mr = mr; 1014 __entry->addr = mr->mr_sg->dma_address; 1015 __entry->dir = mr->mr_dir; 1016 __entry->num_mapped = num_mapped; 1017 __entry->nents = mr->mr_nents; 1018 ), 1019 1020 TP_printk("mr=%p dma addr=0x%llx (%s) nents=%d of %d", 1021 __entry->mr, __entry->addr, 1022 xprtrdma_show_direction(__entry->dir), 1023 __entry->num_mapped, __entry->nents 1024 ) 1025 ); 1026 1027 DEFINE_MR_EVENT(localinv); 1028 DEFINE_MR_EVENT(map); 1029 DEFINE_MR_EVENT(unmap); 1030 DEFINE_MR_EVENT(remoteinv); 1031 DEFINE_MR_EVENT(recycle); 1032 1033 TRACE_EVENT(xprtrdma_dma_maperr, 1034 TP_PROTO( 1035 u64 addr 1036 ), 1037 1038 TP_ARGS(addr), 1039 1040 TP_STRUCT__entry( 1041 __field(u64, addr) 1042 ), 1043 1044 TP_fast_assign( 1045 __entry->addr = addr; 1046 ), 1047 1048 TP_printk("dma addr=0x%llx\n", __entry->addr) 1049 ); 1050 1051 /** 1052 ** Reply events 1053 **/ 1054 1055 TRACE_EVENT(xprtrdma_reply, 1056 TP_PROTO( 1057 const struct rpc_task *task, 1058 const struct rpcrdma_rep *rep, 1059 const struct rpcrdma_req *req, 1060 unsigned int credits 1061 ), 1062 1063 TP_ARGS(task, rep, req, credits), 1064 1065 TP_STRUCT__entry( 1066 __field(unsigned int, task_id) 1067 __field(unsigned int, client_id) 1068 __field(const void *, rep) 1069 __field(const void *, req) 1070 __field(u32, xid) 1071 __field(unsigned int, credits) 1072 ), 1073 1074 TP_fast_assign( 1075 __entry->task_id = task->tk_pid; 1076 __entry->client_id = task->tk_client->cl_clid; 1077 __entry->rep = rep; 1078 __entry->req = req; 1079 __entry->xid = be32_to_cpu(rep->rr_xid); 1080 __entry->credits = credits; 1081 ), 1082 1083 TP_printk("task:%u@%u xid=0x%08x, %u credits, rep=%p -> req=%p", 1084 __entry->task_id, __entry->client_id, __entry->xid, 1085 __entry->credits, __entry->rep, __entry->req 1086 ) 1087 ); 1088 1089 TRACE_EVENT(xprtrdma_defer_cmp, 1090 TP_PROTO( 1091 const struct rpcrdma_rep *rep 1092 ), 1093 1094 TP_ARGS(rep), 1095 1096 TP_STRUCT__entry( 1097 __field(unsigned int, task_id) 1098 __field(unsigned int, client_id) 1099 __field(const void *, rep) 1100 __field(u32, xid) 1101 ), 1102 1103 TP_fast_assign( 1104 __entry->task_id = rep->rr_rqst->rq_task->tk_pid; 1105 __entry->client_id = rep->rr_rqst->rq_task->tk_client->cl_clid; 1106 __entry->rep = rep; 1107 __entry->xid = be32_to_cpu(rep->rr_xid); 1108 ), 1109 1110 TP_printk("task:%u@%u xid=0x%08x rep=%p", 1111 __entry->task_id, __entry->client_id, __entry->xid, 1112 __entry->rep 1113 ) 1114 ); 1115 1116 DEFINE_REPLY_EVENT(xprtrdma_reply_vers); 1117 DEFINE_REPLY_EVENT(xprtrdma_reply_rqst); 1118 DEFINE_REPLY_EVENT(xprtrdma_reply_short); 1119 DEFINE_REPLY_EVENT(xprtrdma_reply_hdr); 1120 1121 TRACE_EVENT(xprtrdma_fixup, 1122 TP_PROTO( 1123 const struct rpc_rqst *rqst, 1124 unsigned long fixup 1125 ), 1126 1127 TP_ARGS(rqst, fixup), 1128 1129 TP_STRUCT__entry( 1130 __field(unsigned int, task_id) 1131 __field(unsigned int, client_id) 1132 __field(unsigned long, fixup) 1133 __field(size_t, headlen) 1134 __field(unsigned int, pagelen) 1135 __field(size_t, taillen) 1136 ), 1137 1138 TP_fast_assign( 1139 __entry->task_id = rqst->rq_task->tk_pid; 1140 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 1141 __entry->fixup = fixup; 1142 __entry->headlen = rqst->rq_rcv_buf.head[0].iov_len; 1143 __entry->pagelen = rqst->rq_rcv_buf.page_len; 1144 __entry->taillen = rqst->rq_rcv_buf.tail[0].iov_len; 1145 ), 1146 1147 TP_printk("task:%u@%u fixup=%lu xdr=%zu/%u/%zu", 1148 __entry->task_id, __entry->client_id, __entry->fixup, 1149 __entry->headlen, __entry->pagelen, __entry->taillen 1150 ) 1151 ); 1152 1153 TRACE_EVENT(xprtrdma_decode_seg, 1154 TP_PROTO( 1155 u32 handle, 1156 u32 length, 1157 u64 offset 1158 ), 1159 1160 TP_ARGS(handle, length, offset), 1161 1162 TP_STRUCT__entry( 1163 __field(u32, handle) 1164 __field(u32, length) 1165 __field(u64, offset) 1166 ), 1167 1168 TP_fast_assign( 1169 __entry->handle = handle; 1170 __entry->length = length; 1171 __entry->offset = offset; 1172 ), 1173 1174 TP_printk("%u@0x%016llx:0x%08x", 1175 __entry->length, (unsigned long long)__entry->offset, 1176 __entry->handle 1177 ) 1178 ); 1179 1180 /** 1181 ** Allocation/release of rpcrdma_reqs and rpcrdma_reps 1182 **/ 1183 1184 TRACE_EVENT(xprtrdma_op_allocate, 1185 TP_PROTO( 1186 const struct rpc_task *task, 1187 const struct rpcrdma_req *req 1188 ), 1189 1190 TP_ARGS(task, req), 1191 1192 TP_STRUCT__entry( 1193 __field(unsigned int, task_id) 1194 __field(unsigned int, client_id) 1195 __field(const void *, req) 1196 __field(size_t, callsize) 1197 __field(size_t, rcvsize) 1198 ), 1199 1200 TP_fast_assign( 1201 __entry->task_id = task->tk_pid; 1202 __entry->client_id = task->tk_client->cl_clid; 1203 __entry->req = req; 1204 __entry->callsize = task->tk_rqstp->rq_callsize; 1205 __entry->rcvsize = task->tk_rqstp->rq_rcvsize; 1206 ), 1207 1208 TP_printk("task:%u@%u req=%p (%zu, %zu)", 1209 __entry->task_id, __entry->client_id, 1210 __entry->req, __entry->callsize, __entry->rcvsize 1211 ) 1212 ); 1213 1214 TRACE_EVENT(xprtrdma_op_free, 1215 TP_PROTO( 1216 const struct rpc_task *task, 1217 const struct rpcrdma_req *req 1218 ), 1219 1220 TP_ARGS(task, req), 1221 1222 TP_STRUCT__entry( 1223 __field(unsigned int, task_id) 1224 __field(unsigned int, client_id) 1225 __field(const void *, req) 1226 __field(const void *, rep) 1227 ), 1228 1229 TP_fast_assign( 1230 __entry->task_id = task->tk_pid; 1231 __entry->client_id = task->tk_client->cl_clid; 1232 __entry->req = req; 1233 __entry->rep = req->rl_reply; 1234 ), 1235 1236 TP_printk("task:%u@%u req=%p rep=%p", 1237 __entry->task_id, __entry->client_id, 1238 __entry->req, __entry->rep 1239 ) 1240 ); 1241 1242 /** 1243 ** Callback events 1244 **/ 1245 1246 TRACE_EVENT(xprtrdma_cb_setup, 1247 TP_PROTO( 1248 const struct rpcrdma_xprt *r_xprt, 1249 unsigned int reqs 1250 ), 1251 1252 TP_ARGS(r_xprt, reqs), 1253 1254 TP_STRUCT__entry( 1255 __field(const void *, r_xprt) 1256 __field(unsigned int, reqs) 1257 __string(addr, rpcrdma_addrstr(r_xprt)) 1258 __string(port, rpcrdma_portstr(r_xprt)) 1259 ), 1260 1261 TP_fast_assign( 1262 __entry->r_xprt = r_xprt; 1263 __entry->reqs = reqs; 1264 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 1265 __assign_str(port, rpcrdma_portstr(r_xprt)); 1266 ), 1267 1268 TP_printk("peer=[%s]:%s r_xprt=%p: %u reqs", 1269 __get_str(addr), __get_str(port), 1270 __entry->r_xprt, __entry->reqs 1271 ) 1272 ); 1273 1274 DEFINE_CB_EVENT(xprtrdma_cb_call); 1275 DEFINE_CB_EVENT(xprtrdma_cb_reply); 1276 1277 TRACE_EVENT(xprtrdma_leaked_rep, 1278 TP_PROTO( 1279 const struct rpc_rqst *rqst, 1280 const struct rpcrdma_rep *rep 1281 ), 1282 1283 TP_ARGS(rqst, rep), 1284 1285 TP_STRUCT__entry( 1286 __field(unsigned int, task_id) 1287 __field(unsigned int, client_id) 1288 __field(u32, xid) 1289 __field(const void *, rep) 1290 ), 1291 1292 TP_fast_assign( 1293 __entry->task_id = rqst->rq_task->tk_pid; 1294 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 1295 __entry->xid = be32_to_cpu(rqst->rq_xid); 1296 __entry->rep = rep; 1297 ), 1298 1299 TP_printk("task:%u@%u xid=0x%08x rep=%p", 1300 __entry->task_id, __entry->client_id, __entry->xid, 1301 __entry->rep 1302 ) 1303 ); 1304 1305 /** 1306 ** Server-side RPC/RDMA events 1307 **/ 1308 1309 DECLARE_EVENT_CLASS(svcrdma_xprt_event, 1310 TP_PROTO( 1311 const struct svc_xprt *xprt 1312 ), 1313 1314 TP_ARGS(xprt), 1315 1316 TP_STRUCT__entry( 1317 __field(const void *, xprt) 1318 __string(addr, xprt->xpt_remotebuf) 1319 ), 1320 1321 TP_fast_assign( 1322 __entry->xprt = xprt; 1323 __assign_str(addr, xprt->xpt_remotebuf); 1324 ), 1325 1326 TP_printk("xprt=%p addr=%s", 1327 __entry->xprt, __get_str(addr) 1328 ) 1329 ); 1330 1331 #define DEFINE_XPRT_EVENT(name) \ 1332 DEFINE_EVENT(svcrdma_xprt_event, svcrdma_xprt_##name, \ 1333 TP_PROTO( \ 1334 const struct svc_xprt *xprt \ 1335 ), \ 1336 TP_ARGS(xprt)) 1337 1338 DEFINE_XPRT_EVENT(accept); 1339 DEFINE_XPRT_EVENT(fail); 1340 DEFINE_XPRT_EVENT(free); 1341 1342 TRACE_DEFINE_ENUM(RDMA_MSG); 1343 TRACE_DEFINE_ENUM(RDMA_NOMSG); 1344 TRACE_DEFINE_ENUM(RDMA_MSGP); 1345 TRACE_DEFINE_ENUM(RDMA_DONE); 1346 TRACE_DEFINE_ENUM(RDMA_ERROR); 1347 1348 #define show_rpcrdma_proc(x) \ 1349 __print_symbolic(x, \ 1350 { RDMA_MSG, "RDMA_MSG" }, \ 1351 { RDMA_NOMSG, "RDMA_NOMSG" }, \ 1352 { RDMA_MSGP, "RDMA_MSGP" }, \ 1353 { RDMA_DONE, "RDMA_DONE" }, \ 1354 { RDMA_ERROR, "RDMA_ERROR" }) 1355 1356 TRACE_EVENT(svcrdma_decode_rqst, 1357 TP_PROTO( 1358 __be32 *p, 1359 unsigned int hdrlen 1360 ), 1361 1362 TP_ARGS(p, hdrlen), 1363 1364 TP_STRUCT__entry( 1365 __field(u32, xid) 1366 __field(u32, vers) 1367 __field(u32, proc) 1368 __field(u32, credits) 1369 __field(unsigned int, hdrlen) 1370 ), 1371 1372 TP_fast_assign( 1373 __entry->xid = be32_to_cpup(p++); 1374 __entry->vers = be32_to_cpup(p++); 1375 __entry->credits = be32_to_cpup(p++); 1376 __entry->proc = be32_to_cpup(p); 1377 __entry->hdrlen = hdrlen; 1378 ), 1379 1380 TP_printk("xid=0x%08x vers=%u credits=%u proc=%s hdrlen=%u", 1381 __entry->xid, __entry->vers, __entry->credits, 1382 show_rpcrdma_proc(__entry->proc), __entry->hdrlen) 1383 ); 1384 1385 TRACE_EVENT(svcrdma_decode_short, 1386 TP_PROTO( 1387 unsigned int hdrlen 1388 ), 1389 1390 TP_ARGS(hdrlen), 1391 1392 TP_STRUCT__entry( 1393 __field(unsigned int, hdrlen) 1394 ), 1395 1396 TP_fast_assign( 1397 __entry->hdrlen = hdrlen; 1398 ), 1399 1400 TP_printk("hdrlen=%u", __entry->hdrlen) 1401 ); 1402 1403 DECLARE_EVENT_CLASS(svcrdma_badreq_event, 1404 TP_PROTO( 1405 __be32 *p 1406 ), 1407 1408 TP_ARGS(p), 1409 1410 TP_STRUCT__entry( 1411 __field(u32, xid) 1412 __field(u32, vers) 1413 __field(u32, proc) 1414 __field(u32, credits) 1415 ), 1416 1417 TP_fast_assign( 1418 __entry->xid = be32_to_cpup(p++); 1419 __entry->vers = be32_to_cpup(p++); 1420 __entry->credits = be32_to_cpup(p++); 1421 __entry->proc = be32_to_cpup(p); 1422 ), 1423 1424 TP_printk("xid=0x%08x vers=%u credits=%u proc=%u", 1425 __entry->xid, __entry->vers, __entry->credits, __entry->proc) 1426 ); 1427 1428 #define DEFINE_BADREQ_EVENT(name) \ 1429 DEFINE_EVENT(svcrdma_badreq_event, svcrdma_decode_##name,\ 1430 TP_PROTO( \ 1431 __be32 *p \ 1432 ), \ 1433 TP_ARGS(p)) 1434 1435 DEFINE_BADREQ_EVENT(badvers); 1436 DEFINE_BADREQ_EVENT(drop); 1437 DEFINE_BADREQ_EVENT(badproc); 1438 DEFINE_BADREQ_EVENT(parse); 1439 1440 DECLARE_EVENT_CLASS(svcrdma_segment_event, 1441 TP_PROTO( 1442 u32 handle, 1443 u32 length, 1444 u64 offset 1445 ), 1446 1447 TP_ARGS(handle, length, offset), 1448 1449 TP_STRUCT__entry( 1450 __field(u32, handle) 1451 __field(u32, length) 1452 __field(u64, offset) 1453 ), 1454 1455 TP_fast_assign( 1456 __entry->handle = handle; 1457 __entry->length = length; 1458 __entry->offset = offset; 1459 ), 1460 1461 TP_printk("%u@0x%016llx:0x%08x", 1462 __entry->length, (unsigned long long)__entry->offset, 1463 __entry->handle 1464 ) 1465 ); 1466 1467 #define DEFINE_SEGMENT_EVENT(name) \ 1468 DEFINE_EVENT(svcrdma_segment_event, svcrdma_encode_##name,\ 1469 TP_PROTO( \ 1470 u32 handle, \ 1471 u32 length, \ 1472 u64 offset \ 1473 ), \ 1474 TP_ARGS(handle, length, offset)) 1475 1476 DEFINE_SEGMENT_EVENT(rseg); 1477 DEFINE_SEGMENT_EVENT(wseg); 1478 1479 DECLARE_EVENT_CLASS(svcrdma_chunk_event, 1480 TP_PROTO( 1481 u32 length 1482 ), 1483 1484 TP_ARGS(length), 1485 1486 TP_STRUCT__entry( 1487 __field(u32, length) 1488 ), 1489 1490 TP_fast_assign( 1491 __entry->length = length; 1492 ), 1493 1494 TP_printk("length=%u", 1495 __entry->length 1496 ) 1497 ); 1498 1499 #define DEFINE_CHUNK_EVENT(name) \ 1500 DEFINE_EVENT(svcrdma_chunk_event, svcrdma_encode_##name,\ 1501 TP_PROTO( \ 1502 u32 length \ 1503 ), \ 1504 TP_ARGS(length)) 1505 1506 DEFINE_CHUNK_EVENT(pzr); 1507 DEFINE_CHUNK_EVENT(write); 1508 DEFINE_CHUNK_EVENT(reply); 1509 1510 TRACE_EVENT(svcrdma_encode_read, 1511 TP_PROTO( 1512 u32 length, 1513 u32 position 1514 ), 1515 1516 TP_ARGS(length, position), 1517 1518 TP_STRUCT__entry( 1519 __field(u32, length) 1520 __field(u32, position) 1521 ), 1522 1523 TP_fast_assign( 1524 __entry->length = length; 1525 __entry->position = position; 1526 ), 1527 1528 TP_printk("length=%u position=%u", 1529 __entry->length, __entry->position 1530 ) 1531 ); 1532 1533 DECLARE_EVENT_CLASS(svcrdma_error_event, 1534 TP_PROTO( 1535 __be32 xid 1536 ), 1537 1538 TP_ARGS(xid), 1539 1540 TP_STRUCT__entry( 1541 __field(u32, xid) 1542 ), 1543 1544 TP_fast_assign( 1545 __entry->xid = be32_to_cpu(xid); 1546 ), 1547 1548 TP_printk("xid=0x%08x", 1549 __entry->xid 1550 ) 1551 ); 1552 1553 #define DEFINE_ERROR_EVENT(name) \ 1554 DEFINE_EVENT(svcrdma_error_event, svcrdma_err_##name, \ 1555 TP_PROTO( \ 1556 __be32 xid \ 1557 ), \ 1558 TP_ARGS(xid)) 1559 1560 DEFINE_ERROR_EVENT(vers); 1561 DEFINE_ERROR_EVENT(chunk); 1562 1563 /** 1564 ** Server-side RDMA API events 1565 **/ 1566 1567 DECLARE_EVENT_CLASS(svcrdma_dma_map_class, 1568 TP_PROTO( 1569 const struct svcxprt_rdma *rdma, 1570 u64 dma_addr, 1571 u32 length 1572 ), 1573 1574 TP_ARGS(rdma, dma_addr, length), 1575 1576 TP_STRUCT__entry( 1577 __field(u64, dma_addr) 1578 __field(u32, length) 1579 __string(device, rdma->sc_cm_id->device->name) 1580 __string(addr, rdma->sc_xprt.xpt_remotebuf) 1581 ), 1582 1583 TP_fast_assign( 1584 __entry->dma_addr = dma_addr; 1585 __entry->length = length; 1586 __assign_str(device, rdma->sc_cm_id->device->name); 1587 __assign_str(addr, rdma->sc_xprt.xpt_remotebuf); 1588 ), 1589 1590 TP_printk("addr=%s device=%s dma_addr=%llu length=%u", 1591 __get_str(addr), __get_str(device), 1592 __entry->dma_addr, __entry->length 1593 ) 1594 ); 1595 1596 #define DEFINE_SVC_DMA_EVENT(name) \ 1597 DEFINE_EVENT(svcrdma_dma_map_class, svcrdma_##name, \ 1598 TP_PROTO( \ 1599 const struct svcxprt_rdma *rdma,\ 1600 u64 dma_addr, \ 1601 u32 length \ 1602 ), \ 1603 TP_ARGS(rdma, dma_addr, length)) 1604 1605 DEFINE_SVC_DMA_EVENT(dma_map_page); 1606 DEFINE_SVC_DMA_EVENT(dma_unmap_page); 1607 1608 TRACE_EVENT(svcrdma_dma_map_rwctx, 1609 TP_PROTO( 1610 const struct svcxprt_rdma *rdma, 1611 int status 1612 ), 1613 1614 TP_ARGS(rdma, status), 1615 1616 TP_STRUCT__entry( 1617 __field(int, status) 1618 __string(device, rdma->sc_cm_id->device->name) 1619 __string(addr, rdma->sc_xprt.xpt_remotebuf) 1620 ), 1621 1622 TP_fast_assign( 1623 __entry->status = status; 1624 __assign_str(device, rdma->sc_cm_id->device->name); 1625 __assign_str(addr, rdma->sc_xprt.xpt_remotebuf); 1626 ), 1627 1628 TP_printk("addr=%s device=%s status=%d", 1629 __get_str(addr), __get_str(device), __entry->status 1630 ) 1631 ); 1632 1633 TRACE_EVENT(svcrdma_send_failed, 1634 TP_PROTO( 1635 const struct svc_rqst *rqst, 1636 int status 1637 ), 1638 1639 TP_ARGS(rqst, status), 1640 1641 TP_STRUCT__entry( 1642 __field(int, status) 1643 __field(u32, xid) 1644 __field(const void *, xprt) 1645 __string(addr, rqst->rq_xprt->xpt_remotebuf) 1646 ), 1647 1648 TP_fast_assign( 1649 __entry->status = status; 1650 __entry->xid = __be32_to_cpu(rqst->rq_xid); 1651 __entry->xprt = rqst->rq_xprt; 1652 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 1653 ), 1654 1655 TP_printk("xprt=%p addr=%s xid=0x%08x status=%d", 1656 __entry->xprt, __get_str(addr), 1657 __entry->xid, __entry->status 1658 ) 1659 ); 1660 1661 DECLARE_EVENT_CLASS(svcrdma_sendcomp_event, 1662 TP_PROTO( 1663 const struct ib_wc *wc 1664 ), 1665 1666 TP_ARGS(wc), 1667 1668 TP_STRUCT__entry( 1669 __field(const void *, cqe) 1670 __field(unsigned int, status) 1671 __field(unsigned int, vendor_err) 1672 ), 1673 1674 TP_fast_assign( 1675 __entry->cqe = wc->wr_cqe; 1676 __entry->status = wc->status; 1677 if (wc->status) 1678 __entry->vendor_err = wc->vendor_err; 1679 else 1680 __entry->vendor_err = 0; 1681 ), 1682 1683 TP_printk("cqe=%p status=%s (%u/0x%x)", 1684 __entry->cqe, rdma_show_wc_status(__entry->status), 1685 __entry->status, __entry->vendor_err 1686 ) 1687 ); 1688 1689 #define DEFINE_SENDCOMP_EVENT(name) \ 1690 DEFINE_EVENT(svcrdma_sendcomp_event, svcrdma_wc_##name, \ 1691 TP_PROTO( \ 1692 const struct ib_wc *wc \ 1693 ), \ 1694 TP_ARGS(wc)) 1695 1696 TRACE_EVENT(svcrdma_post_send, 1697 TP_PROTO( 1698 const struct ib_send_wr *wr, 1699 int status 1700 ), 1701 1702 TP_ARGS(wr, status), 1703 1704 TP_STRUCT__entry( 1705 __field(const void *, cqe) 1706 __field(unsigned int, num_sge) 1707 __field(u32, inv_rkey) 1708 __field(int, status) 1709 ), 1710 1711 TP_fast_assign( 1712 __entry->cqe = wr->wr_cqe; 1713 __entry->num_sge = wr->num_sge; 1714 __entry->inv_rkey = (wr->opcode == IB_WR_SEND_WITH_INV) ? 1715 wr->ex.invalidate_rkey : 0; 1716 __entry->status = status; 1717 ), 1718 1719 TP_printk("cqe=%p num_sge=%u inv_rkey=0x%08x status=%d", 1720 __entry->cqe, __entry->num_sge, 1721 __entry->inv_rkey, __entry->status 1722 ) 1723 ); 1724 1725 DEFINE_SENDCOMP_EVENT(send); 1726 1727 TRACE_EVENT(svcrdma_post_recv, 1728 TP_PROTO( 1729 const struct ib_recv_wr *wr, 1730 int status 1731 ), 1732 1733 TP_ARGS(wr, status), 1734 1735 TP_STRUCT__entry( 1736 __field(const void *, cqe) 1737 __field(int, status) 1738 ), 1739 1740 TP_fast_assign( 1741 __entry->cqe = wr->wr_cqe; 1742 __entry->status = status; 1743 ), 1744 1745 TP_printk("cqe=%p status=%d", 1746 __entry->cqe, __entry->status 1747 ) 1748 ); 1749 1750 TRACE_EVENT(svcrdma_wc_receive, 1751 TP_PROTO( 1752 const struct ib_wc *wc 1753 ), 1754 1755 TP_ARGS(wc), 1756 1757 TP_STRUCT__entry( 1758 __field(const void *, cqe) 1759 __field(u32, byte_len) 1760 __field(unsigned int, status) 1761 __field(u32, vendor_err) 1762 ), 1763 1764 TP_fast_assign( 1765 __entry->cqe = wc->wr_cqe; 1766 __entry->status = wc->status; 1767 if (wc->status) { 1768 __entry->byte_len = 0; 1769 __entry->vendor_err = wc->vendor_err; 1770 } else { 1771 __entry->byte_len = wc->byte_len; 1772 __entry->vendor_err = 0; 1773 } 1774 ), 1775 1776 TP_printk("cqe=%p byte_len=%u status=%s (%u/0x%x)", 1777 __entry->cqe, __entry->byte_len, 1778 rdma_show_wc_status(__entry->status), 1779 __entry->status, __entry->vendor_err 1780 ) 1781 ); 1782 1783 TRACE_EVENT(svcrdma_post_rw, 1784 TP_PROTO( 1785 const void *cqe, 1786 int sqecount, 1787 int status 1788 ), 1789 1790 TP_ARGS(cqe, sqecount, status), 1791 1792 TP_STRUCT__entry( 1793 __field(const void *, cqe) 1794 __field(int, sqecount) 1795 __field(int, status) 1796 ), 1797 1798 TP_fast_assign( 1799 __entry->cqe = cqe; 1800 __entry->sqecount = sqecount; 1801 __entry->status = status; 1802 ), 1803 1804 TP_printk("cqe=%p sqecount=%d status=%d", 1805 __entry->cqe, __entry->sqecount, __entry->status 1806 ) 1807 ); 1808 1809 DEFINE_SENDCOMP_EVENT(read); 1810 DEFINE_SENDCOMP_EVENT(write); 1811 1812 TRACE_EVENT(svcrdma_cm_event, 1813 TP_PROTO( 1814 const struct rdma_cm_event *event, 1815 const struct sockaddr *sap 1816 ), 1817 1818 TP_ARGS(event, sap), 1819 1820 TP_STRUCT__entry( 1821 __field(unsigned int, event) 1822 __field(int, status) 1823 __array(__u8, addr, INET6_ADDRSTRLEN + 10) 1824 ), 1825 1826 TP_fast_assign( 1827 __entry->event = event->event; 1828 __entry->status = event->status; 1829 snprintf(__entry->addr, sizeof(__entry->addr) - 1, 1830 "%pISpc", sap); 1831 ), 1832 1833 TP_printk("addr=%s event=%s (%u/%d)", 1834 __entry->addr, 1835 rdma_show_cm_event(__entry->event), 1836 __entry->event, __entry->status 1837 ) 1838 ); 1839 1840 TRACE_EVENT(svcrdma_qp_error, 1841 TP_PROTO( 1842 const struct ib_event *event, 1843 const struct sockaddr *sap 1844 ), 1845 1846 TP_ARGS(event, sap), 1847 1848 TP_STRUCT__entry( 1849 __field(unsigned int, event) 1850 __string(device, event->device->name) 1851 __array(__u8, addr, INET6_ADDRSTRLEN + 10) 1852 ), 1853 1854 TP_fast_assign( 1855 __entry->event = event->event; 1856 __assign_str(device, event->device->name); 1857 snprintf(__entry->addr, sizeof(__entry->addr) - 1, 1858 "%pISpc", sap); 1859 ), 1860 1861 TP_printk("addr=%s dev=%s event=%s (%u)", 1862 __entry->addr, __get_str(device), 1863 rdma_show_ib_event(__entry->event), __entry->event 1864 ) 1865 ); 1866 1867 DECLARE_EVENT_CLASS(svcrdma_sendqueue_event, 1868 TP_PROTO( 1869 const struct svcxprt_rdma *rdma 1870 ), 1871 1872 TP_ARGS(rdma), 1873 1874 TP_STRUCT__entry( 1875 __field(int, avail) 1876 __field(int, depth) 1877 __string(addr, rdma->sc_xprt.xpt_remotebuf) 1878 ), 1879 1880 TP_fast_assign( 1881 __entry->avail = atomic_read(&rdma->sc_sq_avail); 1882 __entry->depth = rdma->sc_sq_depth; 1883 __assign_str(addr, rdma->sc_xprt.xpt_remotebuf); 1884 ), 1885 1886 TP_printk("addr=%s sc_sq_avail=%d/%d", 1887 __get_str(addr), __entry->avail, __entry->depth 1888 ) 1889 ); 1890 1891 #define DEFINE_SQ_EVENT(name) \ 1892 DEFINE_EVENT(svcrdma_sendqueue_event, svcrdma_sq_##name,\ 1893 TP_PROTO( \ 1894 const struct svcxprt_rdma *rdma \ 1895 ), \ 1896 TP_ARGS(rdma)) 1897 1898 DEFINE_SQ_EVENT(full); 1899 DEFINE_SQ_EVENT(retry); 1900 1901 #endif /* _TRACE_RPCRDMA_H */ 1902 1903 #include <trace/define_trace.h> 1904