From e468f3168267365b20e33888c33fd5d0f67dd9be Mon Sep 17 00:00:00 2001 From: Shi Jin Date: Fri, 22 Nov 2024 03:42:28 +0000 Subject: [PATCH] prov/efa: Add tracepoints for rma operations 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 --- prov/efa/src/efa_tp.h | 18 ++++++++++++++++++ prov/efa/src/efa_tp_def.h | 10 ++++++++++ prov/efa/src/rdm/efa_rdm_pke.c | 8 ++++++++ prov/efa/src/rdm/efa_rdm_rma.c | 7 +++++++ prov/efa/src/rdm/efa_rdm_tracepoint_def.h | 10 ++++++++++ 5 files changed, 53 insertions(+) diff --git a/prov/efa/src/efa_tp.h b/prov/efa/src/efa_tp.h index ec3ce8ebc47..dd2f32f79fb 100644 --- a/prov/efa/src/efa_tp.h +++ b/prov/efa/src/efa_tp.h @@ -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) diff --git a/prov/efa/src/efa_tp_def.h b/prov/efa/src/efa_tp_def.h index 72e03988a56..46617d2d2a7 100644 --- a/prov/efa/src/efa_tp_def.h +++ b/prov/efa/src/efa_tp_def.h @@ -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 diff --git a/prov/efa/src/rdm/efa_rdm_pke.c b/prov/efa/src/rdm/efa_rdm_pke.c index 73cb58c82b9..6b97eccda1c 100644 --- a/prov/efa/src/rdm/efa_rdm_pke.c +++ b/prov/efa/src/rdm/efa_rdm_pke.c @@ -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)) @@ -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; diff --git a/prov/efa/src/rdm/efa_rdm_rma.c b/prov/efa/src/rdm/efa_rdm_rma.c index fdb0d629a8a..36b2d5171da 100644 --- a/prov/efa/src/rdm/efa_rdm_rma.c +++ b/prov/efa/src/rdm/efa_rdm_rma.c @@ -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, @@ -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), @@ -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, diff --git a/prov/efa/src/rdm/efa_rdm_tracepoint_def.h b/prov/efa/src/rdm/efa_rdm_tracepoint_def.h index a11e8c3889c..6e2fab54b7f 100644 --- a/prov/efa/src/rdm/efa_rdm_tracepoint_def.h +++ b/prov/efa/src/rdm/efa_rdm_tracepoint_def.h @@ -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