1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Trace point definitions for core RDMA functions.
5 * Author: Chuck Lever <chuck.lever@oracle.com>
7 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
11 #define TRACE_SYSTEM rdma_core
13 #if !defined(_TRACE_RDMA_CORE_H) || defined(TRACE_HEADER_MULTI_READ)
14 #define _TRACE_RDMA_CORE_H
16 #include <linux/tracepoint.h>
17 #include <rdma/ib_verbs.h>
20 * enum ib_poll_context, from include/rdma/ib_verbs.h
22 #define IB_POLL_CTX_LIST \
24 ib_poll_ctx(SOFTIRQ) \
25 ib_poll_ctx(WORKQUEUE) \
26 ib_poll_ctx_end(UNBOUND_WORKQUEUE)
29 #undef ib_poll_ctx_end
31 #define ib_poll_ctx(x) TRACE_DEFINE_ENUM(IB_POLL_##x);
32 #define ib_poll_ctx_end(x) TRACE_DEFINE_ENUM(IB_POLL_##x);
37 #undef ib_poll_ctx_end
39 #define ib_poll_ctx(x) { IB_POLL_##x, #x },
40 #define ib_poll_ctx_end(x) { IB_POLL_##x, #x }
42 #define rdma_show_ib_poll_ctx(x) \
43 __print_symbolic(x, IB_POLL_CTX_LIST)
46 ** Completion Queue events
49 TRACE_EVENT(cq_schedule
,
61 cq
->timestamp
= ktime_get();
64 __entry
->cq_id
= cq
->res
.id
;
67 TP_printk("cq.id=%u", __entry
->cq_id
)
70 TRACE_EVENT(cq_reschedule
,
82 cq
->timestamp
= ktime_get();
83 cq
->interrupt
= false;
85 __entry
->cq_id
= cq
->res
.id
;
88 TP_printk("cq.id=%u", __entry
->cq_id
)
91 TRACE_EVENT(cq_process
,
93 const struct ib_cq
*cq
100 __field(bool, interrupt
)
101 __field(s64
, latency
)
105 ktime_t latency
= ktime_sub(ktime_get(), cq
->timestamp
);
107 __entry
->cq_id
= cq
->res
.id
;
108 __entry
->latency
= ktime_to_us(latency
);
109 __entry
->interrupt
= cq
->interrupt
;
112 TP_printk("cq.id=%u wake-up took %lld [us] from %s",
113 __entry
->cq_id
, __entry
->latency
,
114 __entry
->interrupt
? "interrupt" : "reschedule"
120 const struct ib_cq
*cq
,
125 TP_ARGS(cq
, requested
, rc
),
129 __field(int, requested
)
134 __entry
->cq_id
= cq
->res
.id
;
135 __entry
->requested
= requested
;
139 TP_printk("cq.id=%u requested %d, returned %d",
140 __entry
->cq_id
, __entry
->requested
, __entry
->rc
144 TRACE_EVENT(cq_drain_complete
,
146 const struct ib_cq
*cq
156 __entry
->cq_id
= cq
->res
.id
;
159 TP_printk("cq.id=%u",
165 TRACE_EVENT(cq_modify
,
167 const struct ib_cq
*cq
,
172 TP_ARGS(cq
, comps
, usec
),
176 __field(unsigned int, comps
)
177 __field(unsigned int, usec
)
181 __entry
->cq_id
= cq
->res
.id
;
182 __entry
->comps
= comps
;
183 __entry
->usec
= usec
;
186 TP_printk("cq.id=%u comps=%u usec=%u",
187 __entry
->cq_id
, __entry
->comps
, __entry
->usec
191 TRACE_EVENT(cq_alloc
,
193 const struct ib_cq
*cq
,
196 enum ib_poll_context poll_ctx
199 TP_ARGS(cq
, nr_cqe
, comp_vector
, poll_ctx
),
204 __field(int, comp_vector
)
205 __field(unsigned long, poll_ctx
)
209 __entry
->cq_id
= cq
->res
.id
;
210 __entry
->nr_cqe
= nr_cqe
;
211 __entry
->comp_vector
= comp_vector
;
212 __entry
->poll_ctx
= poll_ctx
;
215 TP_printk("cq.id=%u nr_cqe=%d comp_vector=%d poll_ctx=%s",
216 __entry
->cq_id
, __entry
->nr_cqe
, __entry
->comp_vector
,
217 rdma_show_ib_poll_ctx(__entry
->poll_ctx
)
221 TRACE_EVENT(cq_alloc_error
,
225 enum ib_poll_context poll_ctx
,
229 TP_ARGS(nr_cqe
, comp_vector
, poll_ctx
, rc
),
234 __field(int, comp_vector
)
235 __field(unsigned long, poll_ctx
)
240 __entry
->nr_cqe
= nr_cqe
;
241 __entry
->comp_vector
= comp_vector
;
242 __entry
->poll_ctx
= poll_ctx
;
245 TP_printk("nr_cqe=%d comp_vector=%d poll_ctx=%s rc=%d",
246 __entry
->nr_cqe
, __entry
->comp_vector
,
247 rdma_show_ib_poll_ctx(__entry
->poll_ctx
), __entry
->rc
253 const struct ib_cq
*cq
263 __entry
->cq_id
= cq
->res
.id
;
266 TP_printk("cq.id=%u", __entry
->cq_id
)
270 ** Memory Region events
274 * enum ib_mr_type, from include/rdma/ib_verbs.h
276 #define IB_MR_TYPE_LIST \
277 ib_mr_type_item(MEM_REG) \
278 ib_mr_type_item(SG_GAPS) \
279 ib_mr_type_item(DM) \
280 ib_mr_type_item(USER) \
281 ib_mr_type_item(DMA) \
282 ib_mr_type_end(INTEGRITY)
284 #undef ib_mr_type_item
285 #undef ib_mr_type_end
287 #define ib_mr_type_item(x) TRACE_DEFINE_ENUM(IB_MR_TYPE_##x);
288 #define ib_mr_type_end(x) TRACE_DEFINE_ENUM(IB_MR_TYPE_##x);
292 #undef ib_mr_type_item
293 #undef ib_mr_type_end
295 #define ib_mr_type_item(x) { IB_MR_TYPE_##x, #x },
296 #define ib_mr_type_end(x) { IB_MR_TYPE_##x, #x }
298 #define rdma_show_ib_mr_type(x) \
299 __print_symbolic(x, IB_MR_TYPE_LIST)
301 TRACE_EVENT(mr_alloc
,
303 const struct ib_pd
*pd
,
304 enum ib_mr_type mr_type
,
306 const struct ib_mr
*mr
309 TP_ARGS(pd
, mr_type
, max_num_sg
, mr
),
314 __field(u32
, max_num_sg
)
316 __field(unsigned long, mr_type
)
320 __entry
->pd_id
= pd
->res
.id
;
323 __entry
->rc
= PTR_ERR(mr
);
325 __entry
->mr_id
= mr
->res
.id
;
328 __entry
->max_num_sg
= max_num_sg
;
329 __entry
->mr_type
= mr_type
;
332 TP_printk("pd.id=%u mr.id=%u type=%s max_num_sg=%u rc=%d",
333 __entry
->pd_id
, __entry
->mr_id
,
334 rdma_show_ib_mr_type(__entry
->mr_type
),
335 __entry
->max_num_sg
, __entry
->rc
)
338 TRACE_EVENT(mr_integ_alloc
,
340 const struct ib_pd
*pd
,
343 const struct ib_mr
*mr
346 TP_ARGS(pd
, max_num_data_sg
, max_num_meta_sg
, mr
),
351 __field(u32
, max_num_data_sg
)
352 __field(u32
, max_num_meta_sg
)
357 __entry
->pd_id
= pd
->res
.id
;
360 __entry
->rc
= PTR_ERR(mr
);
362 __entry
->mr_id
= mr
->res
.id
;
365 __entry
->max_num_data_sg
= max_num_data_sg
;
366 __entry
->max_num_meta_sg
= max_num_meta_sg
;
369 TP_printk("pd.id=%u mr.id=%u max_num_data_sg=%u max_num_meta_sg=%u rc=%d",
370 __entry
->pd_id
, __entry
->mr_id
, __entry
->max_num_data_sg
,
371 __entry
->max_num_meta_sg
, __entry
->rc
)
374 TRACE_EVENT(mr_dereg
,
376 const struct ib_mr
*mr
386 __entry
->id
= mr
->res
.id
;
389 TP_printk("mr.id=%u", __entry
->id
)
392 #endif /* _TRACE_RDMA_CORE_H */
394 #include <trace/define_trace.h>