IB/rdmavt: Add trace for map_mr_sg
authorMike Marciniszyn <mike.marciniszyn@intel.com>
Fri, 28 Jun 2019 18:22:39 +0000 (14:22 -0400)
committerJason Gunthorpe <jgg@mellanox.com>
Sat, 29 Jun 2019 01:34:26 +0000 (22:34 -0300)
Add trace to debug map_mr_sg handling.

Reviewed-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/sw/rdmavt/mr.c
drivers/infiniband/sw/rdmavt/trace_mr.h

index 23ddc63cae61bf47b2ac9f141cb58f3cd42f0bb8..a6a39f01dca37112af1acdadc6bfd050d81c9b38 100644 (file)
@@ -642,6 +642,7 @@ int rvt_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg,
        mr->mr.iova = ibmr->iova;
        mr->mr.offset = ibmr->iova - (u64)mr->mr.map[0]->segs[0].vaddr;
        mr->mr.length = (size_t)ibmr->length;
+       trace_rvt_map_mr_sg(ibmr, sg_nents, sg_offset);
        return ret;
 }
 
index f43e477a8c91ff3cd249307e5b2ccc73dd37054a..95b8a0e3b8bdb52cdcb7b99665ca4f57bc49cbbe 100644 (file)
@@ -54,6 +54,8 @@
 #include <rdma/rdma_vt.h>
 #include <rdma/rdmavt_mr.h>
 
+#include "mr.h"
+
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM rvt_mr
 DECLARE_EVENT_CLASS(
@@ -179,6 +181,40 @@ DEFINE_EVENT(
        TP_PROTO(struct rvt_sge *sge, struct ib_sge *isge),
        TP_ARGS(sge, isge));
 
+TRACE_EVENT(
+       rvt_map_mr_sg,
+       TP_PROTO(struct ib_mr *ibmr, int sg_nents, unsigned int *sg_offset),
+       TP_ARGS(ibmr, sg_nents, sg_offset),
+       TP_STRUCT__entry(
+               RDI_DEV_ENTRY(ib_to_rvt(to_imr(ibmr)->mr.pd->device))
+               __field(u64, iova)
+               __field(u64, ibmr_iova)
+               __field(u64, user_base)
+               __field(u64, ibmr_length)
+               __field(int, sg_nents)
+               __field(uint, sg_offset)
+       ),
+       TP_fast_assign(
+               RDI_DEV_ASSIGN(ib_to_rvt(to_imr(ibmr)->mr.pd->device))
+               __entry->ibmr_iova = ibmr->iova;
+               __entry->iova = to_imr(ibmr)->mr.iova;
+               __entry->user_base = to_imr(ibmr)->mr.user_base;
+               __entry->ibmr_length = to_imr(ibmr)->mr.length;
+               __entry->sg_nents = sg_nents;
+               __entry->sg_offset = sg_offset ? *sg_offset : 0;
+       ),
+       TP_printk(
+               "[%s] ibmr_iova %llx iova %llx user_base %llx length %llx sg_nents %d sg_offset %u",
+               __get_str(dev),
+               __entry->ibmr_iova,
+               __entry->iova,
+               __entry->user_base,
+               __entry->ibmr_length,
+               __entry->sg_nents,
+               __entry->sg_offset
+       )
+);
+
 #endif /* __RVT_TRACE_MR_H */
 
 #undef TRACE_INCLUDE_PATH