Skip to content

Commit

Permalink
prov/efa: Add tracepoints for rma operations
Browse files Browse the repository at this point in the history
Add tracepoints for read and write, including:

- efa_rdm:read/write_msg_context_begin: the tp when
rma operations begins
- efa:post_read/write: the tp when rma requests are posted
to efa device

Signed-off-by: Shi Jin <[email protected]>
  • Loading branch information
shijin-aws authored and j-xiong committed Nov 23, 2024
1 parent 5713d82 commit e468f31
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
18 changes: 18 additions & 0 deletions prov/efa/src/efa_tp.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@ static inline void efa_tracepoint_wr_id_post_recv(const void *wr_id)
efa_tracepoint(post_recv, (size_t) wr_id, (size_t) ope, (size_t) ope->cq_entry.op_context);
}

static inline void efa_tracepoint_wr_id_post_read(const void *wr_id)
{
struct efa_rdm_pke *pkt_entry = (struct efa_rdm_pke *) wr_id;
struct efa_rdm_ope *ope = pkt_entry->ope;
if (!ope)
return;
efa_tracepoint(post_read, (size_t) wr_id, (size_t) ope, (size_t) ope->cq_entry.op_context);
}

static inline void efa_tracepoint_wr_id_post_write(const void *wr_id)
{
struct efa_rdm_pke *pkt_entry = (struct efa_rdm_pke *) wr_id;
struct efa_rdm_ope *ope = pkt_entry->ope;
if (!ope)
return;
efa_tracepoint(post_write, (size_t) wr_id, (size_t) ope, (size_t) ope->cq_entry.op_context);
}

#else

#define efa_tracepoint(...) do {} while(0)
Expand Down
10 changes: 10 additions & 0 deletions prov/efa/src/efa_tp_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_TP_PROV, post_wr_id, EFA_TP_PROV,
LTTNG_UST_TP_ARGS(X_PKT_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_TP_PROV, post_recv, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_TP_PROV, post_wr_id, EFA_TP_PROV,
post_read,
LTTNG_UST_TP_ARGS(X_PKT_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_TP_PROV, post_read, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_TP_PROV, post_wr_id, EFA_TP_PROV,
post_write,
LTTNG_UST_TP_ARGS(X_PKT_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_TP_PROV, post_write, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

#endif /* _EFA_TP_DEF_H */

#include <lttng/tracepoint-event.h>
8 changes: 8 additions & 0 deletions prov/efa/src/rdm/efa_rdm_pke.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,10 @@ int efa_rdm_pke_read(struct efa_rdm_pke *pkt_entry,
conn->ep_addr->qpn, conn->ep_addr->qkey);
}

#if HAVE_LTTNG
efa_tracepoint_wr_id_post_read((void *)pkt_entry);
#endif

err = ibv_wr_complete(qp->ibv_qp_ex);

if (OFI_UNLIKELY(err))
Expand Down Expand Up @@ -597,6 +601,10 @@ int efa_rdm_pke_write(struct efa_rdm_pke *pkt_entry)
conn->ep_addr->qpn, conn->ep_addr->qkey);
}

#if HAVE_LTTNG
efa_tracepoint_wr_id_post_write((void *)pkt_entry);
#endif

if (!(txe->fi_flags & FI_MORE)) {
err = ibv_wr_complete(qp->ibv_qp_ex);
ep->base_ep.is_wr_started = false;
Expand Down
7 changes: 7 additions & 0 deletions prov/efa/src/rdm/efa_rdm_rma.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "efa_rdm_rma.h"
#include "efa_rdm_pke_cmd.h"
#include "efa_cntr.h"
#include "efa_rdm_tracepoint.h"

int efa_rdm_rma_verified_copy_iov(struct efa_rdm_ep *ep, struct efa_rma_iov *rma,
size_t count, uint32_t flags,
Expand Down Expand Up @@ -174,6 +175,9 @@ ssize_t efa_rdm_rma_readmsg(struct fid_ep *ep, const struct fi_msg_rma *msg, uin
void **tmp_desc;
struct util_srx_ctx *srx_ctx;

efa_rdm_tracepoint(read_begin_msg_context,
(size_t) msg->context, (size_t) msg->addr);

EFA_DBG(FI_LOG_EP_DATA,
"read iov_len: %lu flags: %lx\n",
ofi_total_iov_len(msg->msg_iov, msg->iov_count),
Expand Down Expand Up @@ -430,6 +434,9 @@ static inline ssize_t efa_rdm_generic_writemsg(struct efa_rdm_ep *efa_rdm_ep,
struct efa_rdm_ope *txe;
struct util_srx_ctx *srx_ctx;

efa_rdm_tracepoint(write_begin_msg_context,
(size_t) msg->context, (size_t) msg->addr);

efa_perfset_start(efa_rdm_ep, perf_efa_tx);

EFA_DBG(FI_LOG_EP_DATA,
Expand Down
10 changes: 10 additions & 0 deletions prov/efa/src/rdm/efa_rdm_tracepoint_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,16 @@ LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, msg_context, EFA_RDM_TP_PRO
LTTNG_UST_TP_ARGS(MSG_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, recv_begin_msg_context, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, msg_context, EFA_RDM_TP_PROV,
read_begin_msg_context,
LTTNG_UST_TP_ARGS(MSG_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, read_begin_msg_context, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

LTTNG_UST_TRACEPOINT_EVENT_INSTANCE(EFA_RDM_TP_PROV, msg_context, EFA_RDM_TP_PROV,
write_begin_msg_context,
LTTNG_UST_TP_ARGS(MSG_ARGS))
LTTNG_UST_TRACEPOINT_LOGLEVEL(EFA_RDM_TP_PROV, write_begin_msg_context, LTTNG_UST_TRACEPOINT_LOGLEVEL_INFO)

#define CQ_ENTRY_ARGS \
int, tag, \
size_t, addr
Expand Down

0 comments on commit e468f31

Please sign in to comment.