Skip to content

Commit 5d7c4f7

Browse files
committed
provides: add support for USDT tracing using libbpf/usdt
Default to providing lightweight USDT trace points when LTTng is unavailable. This piggybacks on the existing tracing code added for LTTng for a minimal set of changes. > $ sudo bpftrace -l usdt:build/lib/lib*.so:* > usdt:build/lib/libefa-rdmav59.so:rdma_core_efa:post_recv > usdt:build/lib/libefa-rdmav59.so:rdma_core_efa:post_send > usdt:build/lib/libefa-rdmav59.so:rdma_core_efa:process_completion > usdt:build/lib/libefa.so:rdma_core_efa:post_recv > usdt:build/lib/libefa.so:rdma_core_efa:post_send > usdt:build/lib/libefa.so:rdma_core_efa:process_completion > usdt:build/lib/libhns-rdmav59.so:rdma_core_hns:poll_cq > usdt:build/lib/libhns-rdmav59.so:rdma_core_hns:post_recv > usdt:build/lib/libhns-rdmav59.so:rdma_core_hns:post_send > usdt:build/lib/libhns.so:rdma_core_hns:poll_cq > usdt:build/lib/libhns.so:rdma_core_hns:post_recv > usdt:build/lib/libhns.so:rdma_core_hns:post_send > usdt:build/lib/libmlx5-rdmav59.so:rdma_core_mlx5:post_send > usdt:build/lib/libmlx5.so:rdma_core_mlx5:post_send > usdt:build/lib/librxe-rdmav59.so:rdma_core_rxe:post_send The USDT header used here is from the libbpf/usdt project at https://github.com/libbpf/usdt.git Further background discussion for this commit is included in linux-rdma#1621 Signed-off-by: Nathan Scott <[email protected]>
1 parent 7528827 commit 5d7c4f7

File tree

8 files changed

+558
-8
lines changed

8 files changed

+558
-8
lines changed

providers/efa/efa_trace.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ LTTNG_UST_TRACEPOINT_EVENT(
114114
#ifndef __EFA_TRACE_H__
115115
#define __EFA_TRACE_H__
116116

117-
#define rdma_tracepoint(arg...)
117+
#include <util/usdt.h>
118+
119+
#define rdma_tracepoint(arg...) USDT(arg)
118120

119121
#endif /* __EFA_TRACE_H__*/
120122

providers/efa/verbs.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2170,7 +2170,6 @@ static void efa_set_common_ctrl_flags(struct efa_io_tx_meta_desc *desc,
21702170
EFA_SET(&desc->ctrl2, EFA_IO_TX_META_DESC_COMP_REQ, 1);
21712171
}
21722172

2173-
#ifdef LTTNG_ENABLED
21742173
static uint32_t efa_get_wqe_length(struct efa_io_tx_wqe *tx_wqe)
21752174
{
21762175
enum efa_io_send_op_type op_type;
@@ -2194,7 +2193,6 @@ static uint32_t efa_get_wqe_length(struct efa_io_tx_wqe *tx_wqe)
21942193

21952194
return 0;
21962195
}
2197-
#endif
21982196

21992197
static int efa_post_send_validate(struct efa_qp *qp,
22002198
unsigned int wr_flags)

providers/hns/hns_roce_u_hw_v2.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,6 @@ static int parse_cqe_for_cq(struct hns_roce_context *ctx, struct hns_roce_cq *cq
678678
return 0;
679679
}
680680

681-
#ifdef LTTNG_ENABLED
682681
static uint8_t read_wc_sl(struct hns_roce_qp *hr_qp,
683682
struct hns_roce_v2_cqe *cqe,
684683
struct ibv_wc *wc)
@@ -750,7 +749,6 @@ static uint8_t get_send_wr_tclass(struct ibv_send_wr *wr,
750749
return qp_type == IBV_QPT_UD ?
751750
to_hr_ah(wr->wr.ud.ah)->av.tclass : UINT8_MAX;
752751
}
753-
#endif
754752

755753
static int hns_roce_poll_one(struct hns_roce_context *ctx,
756754
struct hns_roce_qp **cur_qp, struct hns_roce_cq *cq,

providers/hns/hns_roce_u_trace.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ LTTNG_UST_TRACEPOINT_EVENT(
126126
#ifndef __HNS_TRACE_H__
127127
#define __HNS_TRACE_H__
128128

129-
#define rdma_tracepoint(arg...)
129+
#include <util/usdt.h>
130+
131+
#define rdma_tracepoint(arg...) USDT(arg)
130132

131133
#endif /* __HNS_TRACE_H__*/
132134

providers/mlx5/mlx5_trace.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ LTTNG_UST_TRACEPOINT_EVENT(
5252
#ifndef __MLX5_TRACE_H__
5353
#define __MLX5_TRACE_H__
5454

55-
#define rdma_tracepoint(arg...)
55+
#include <util/usdt.h>
56+
57+
#define rdma_tracepoint(arg...) USDT(arg)
5658

5759
#endif /* __MLX5_TRACE_H__*/
5860

providers/rxe/rxe_trace.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ LTTNG_UST_TRACEPOINT_EVENT(
5252
#ifndef __RXE_TRACE_H__
5353
#define __RXE_TRACE_H__
5454

55-
#define rdma_tracepoint(arg...)
55+
#include <util/usdt.h>
56+
57+
#define rdma_tracepoint(arg...) USDT(arg)
5658

5759
#endif /* __RXE_TRACE_H__*/
5860

util/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ publish_internal_headers(util
66
node_name_map.h
77
rdma_nl.h
88
symver.h
9+
usdt.h
910
util.h
1011
)
1112

0 commit comments

Comments
 (0)