xref: /openbmc/linux/drivers/infiniband/sw/rdmavt/trace_mr.h (revision 762f99f4f3cb41a775b5157dd761217beba65873)
1*d164bf64SCai Huoqing /* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
2fcb29a66SMike Marciniszyn /*
3fcb29a66SMike Marciniszyn  * Copyright(c) 2016 Intel Corporation.
4fcb29a66SMike Marciniszyn  */
5fcb29a66SMike Marciniszyn #if !defined(__RVT_TRACE_MR_H) || defined(TRACE_HEADER_MULTI_READ)
6fcb29a66SMike Marciniszyn #define __RVT_TRACE_MR_H
7fcb29a66SMike Marciniszyn 
8fcb29a66SMike Marciniszyn #include <linux/tracepoint.h>
9fcb29a66SMike Marciniszyn #include <linux/trace_seq.h>
10fcb29a66SMike Marciniszyn 
11fcb29a66SMike Marciniszyn #include <rdma/ib_verbs.h>
12fcb29a66SMike Marciniszyn #include <rdma/rdma_vt.h>
13fcb29a66SMike Marciniszyn #include <rdma/rdmavt_mr.h>
14fcb29a66SMike Marciniszyn 
158bd516bdSMike Marciniszyn #include "mr.h"
168bd516bdSMike Marciniszyn 
17fcb29a66SMike Marciniszyn #undef TRACE_SYSTEM
18fcb29a66SMike Marciniszyn #define TRACE_SYSTEM rvt_mr
19fcb29a66SMike Marciniszyn DECLARE_EVENT_CLASS(
20fcb29a66SMike Marciniszyn 	rvt_mr_template,
21fcb29a66SMike Marciniszyn 	TP_PROTO(struct rvt_mregion *mr, u16 m, u16 n, void *v, size_t len),
22fcb29a66SMike Marciniszyn 	TP_ARGS(mr, m, n, v, len),
23fcb29a66SMike Marciniszyn 	TP_STRUCT__entry(
24fcb29a66SMike Marciniszyn 		RDI_DEV_ENTRY(ib_to_rvt(mr->pd->device))
25fcb29a66SMike Marciniszyn 		__field(void *, vaddr)
26fcb29a66SMike Marciniszyn 		__field(struct page *, page)
27315aed11SMike Marciniszyn 		__field(u64, iova)
28315aed11SMike Marciniszyn 		__field(u64, user_base)
29fcb29a66SMike Marciniszyn 		__field(size_t, len)
30315aed11SMike Marciniszyn 		__field(size_t, length)
31fcb29a66SMike Marciniszyn 		__field(u32, lkey)
32315aed11SMike Marciniszyn 		__field(u32, offset)
33fcb29a66SMike Marciniszyn 		__field(u16, m)
34fcb29a66SMike Marciniszyn 		__field(u16, n)
35fcb29a66SMike Marciniszyn 	),
36fcb29a66SMike Marciniszyn 	TP_fast_assign(
37fcb29a66SMike Marciniszyn 		RDI_DEV_ASSIGN(ib_to_rvt(mr->pd->device));
38fcb29a66SMike Marciniszyn 		__entry->vaddr = v;
39fcb29a66SMike Marciniszyn 		__entry->page = virt_to_page(v);
40315aed11SMike Marciniszyn 		__entry->iova = mr->iova;
41315aed11SMike Marciniszyn 		__entry->user_base = mr->user_base;
42315aed11SMike Marciniszyn 		__entry->lkey = mr->lkey;
43fcb29a66SMike Marciniszyn 		__entry->m = m;
44fcb29a66SMike Marciniszyn 		__entry->n = n;
45fcb29a66SMike Marciniszyn 		__entry->len = len;
46315aed11SMike Marciniszyn 		__entry->length = mr->length;
47315aed11SMike Marciniszyn 		__entry->offset = mr->offset;
48fcb29a66SMike Marciniszyn 	),
49fcb29a66SMike Marciniszyn 	TP_printk(
50315aed11SMike Marciniszyn 		"[%s] lkey %x iova %llx user_base %llx mr_len %lu vaddr %llx page %p m %u n %u len %lu off %u",
51fcb29a66SMike Marciniszyn 		__get_str(dev),
52315aed11SMike Marciniszyn 		__entry->lkey,
53315aed11SMike Marciniszyn 		__entry->iova,
54315aed11SMike Marciniszyn 		__entry->user_base,
55315aed11SMike Marciniszyn 		__entry->length,
56315aed11SMike Marciniszyn 		(unsigned long long)__entry->vaddr,
57fcb29a66SMike Marciniszyn 		__entry->page,
58fcb29a66SMike Marciniszyn 		__entry->m,
59fcb29a66SMike Marciniszyn 		__entry->n,
60315aed11SMike Marciniszyn 		__entry->len,
61315aed11SMike Marciniszyn 		__entry->offset
62fcb29a66SMike Marciniszyn 	)
63fcb29a66SMike Marciniszyn );
64fcb29a66SMike Marciniszyn 
65fcb29a66SMike Marciniszyn DEFINE_EVENT(
66fcb29a66SMike Marciniszyn 	rvt_mr_template, rvt_mr_page_seg,
67fcb29a66SMike Marciniszyn 	TP_PROTO(struct rvt_mregion *mr, u16 m, u16 n, void *v, size_t len),
68fcb29a66SMike Marciniszyn 	TP_ARGS(mr, m, n, v, len));
69fcb29a66SMike Marciniszyn 
70fcb29a66SMike Marciniszyn DEFINE_EVENT(
71fcb29a66SMike Marciniszyn 	rvt_mr_template, rvt_mr_fmr_seg,
72fcb29a66SMike Marciniszyn 	TP_PROTO(struct rvt_mregion *mr, u16 m, u16 n, void *v, size_t len),
73fcb29a66SMike Marciniszyn 	TP_ARGS(mr, m, n, v, len));
74fcb29a66SMike Marciniszyn 
75fcb29a66SMike Marciniszyn DEFINE_EVENT(
76fcb29a66SMike Marciniszyn 	rvt_mr_template, rvt_mr_user_seg,
77fcb29a66SMike Marciniszyn 	TP_PROTO(struct rvt_mregion *mr, u16 m, u16 n, void *v, size_t len),
78fcb29a66SMike Marciniszyn 	TP_ARGS(mr, m, n, v, len));
79fcb29a66SMike Marciniszyn 
8014fe13fcSMike Marciniszyn DECLARE_EVENT_CLASS(
8114fe13fcSMike Marciniszyn 	rvt_sge_template,
8214fe13fcSMike Marciniszyn 	TP_PROTO(struct rvt_sge *sge, struct ib_sge *isge),
8314fe13fcSMike Marciniszyn 	TP_ARGS(sge, isge),
8414fe13fcSMike Marciniszyn 	TP_STRUCT__entry(
8514fe13fcSMike Marciniszyn 		RDI_DEV_ENTRY(ib_to_rvt(sge->mr->pd->device))
8614fe13fcSMike Marciniszyn 		__field(struct rvt_mregion *, mr)
8714fe13fcSMike Marciniszyn 		__field(struct rvt_sge *, sge)
8814fe13fcSMike Marciniszyn 		__field(struct ib_sge *, isge)
8914fe13fcSMike Marciniszyn 		__field(void *, vaddr)
9014fe13fcSMike Marciniszyn 		__field(u64, ivaddr)
9114fe13fcSMike Marciniszyn 		__field(u32, lkey)
9214fe13fcSMike Marciniszyn 		__field(u32, sge_length)
9314fe13fcSMike Marciniszyn 		__field(u32, length)
9414fe13fcSMike Marciniszyn 		__field(u32, ilength)
9514fe13fcSMike Marciniszyn 		__field(int, user)
9614fe13fcSMike Marciniszyn 		__field(u16, m)
9714fe13fcSMike Marciniszyn 		__field(u16, n)
9814fe13fcSMike Marciniszyn 	),
9914fe13fcSMike Marciniszyn 	TP_fast_assign(
10014fe13fcSMike Marciniszyn 		RDI_DEV_ASSIGN(ib_to_rvt(sge->mr->pd->device));
10114fe13fcSMike Marciniszyn 		__entry->mr = sge->mr;
10214fe13fcSMike Marciniszyn 		__entry->sge = sge;
10314fe13fcSMike Marciniszyn 		__entry->isge = isge;
10414fe13fcSMike Marciniszyn 		__entry->vaddr = sge->vaddr;
10514fe13fcSMike Marciniszyn 		__entry->ivaddr = isge->addr;
10614fe13fcSMike Marciniszyn 		__entry->lkey = sge->mr->lkey;
10714fe13fcSMike Marciniszyn 		__entry->sge_length = sge->sge_length;
10814fe13fcSMike Marciniszyn 		__entry->length = sge->length;
10914fe13fcSMike Marciniszyn 		__entry->ilength = isge->length;
11014fe13fcSMike Marciniszyn 		__entry->m = sge->m;
11114fe13fcSMike Marciniszyn 		__entry->n = sge->m;
11214fe13fcSMike Marciniszyn 		__entry->user = ibpd_to_rvtpd(sge->mr->pd)->user;
11314fe13fcSMike Marciniszyn 	),
11414fe13fcSMike Marciniszyn 	TP_printk(
11514fe13fcSMike Marciniszyn 		"[%s] mr %p sge %p isge %p vaddr %p ivaddr %llx lkey %x sge_length %u length %u ilength %u m %u n %u user %u",
11614fe13fcSMike Marciniszyn 		__get_str(dev),
11714fe13fcSMike Marciniszyn 		__entry->mr,
11814fe13fcSMike Marciniszyn 		__entry->sge,
11914fe13fcSMike Marciniszyn 		__entry->isge,
12014fe13fcSMike Marciniszyn 		__entry->vaddr,
12114fe13fcSMike Marciniszyn 		__entry->ivaddr,
12214fe13fcSMike Marciniszyn 		__entry->lkey,
12314fe13fcSMike Marciniszyn 		__entry->sge_length,
12414fe13fcSMike Marciniszyn 		__entry->length,
12514fe13fcSMike Marciniszyn 		__entry->ilength,
12614fe13fcSMike Marciniszyn 		__entry->m,
12714fe13fcSMike Marciniszyn 		__entry->n,
12814fe13fcSMike Marciniszyn 		__entry->user
12914fe13fcSMike Marciniszyn 	)
13014fe13fcSMike Marciniszyn );
13114fe13fcSMike Marciniszyn 
13214fe13fcSMike Marciniszyn DEFINE_EVENT(
13314fe13fcSMike Marciniszyn 	rvt_sge_template, rvt_sge_adjacent,
13414fe13fcSMike Marciniszyn 	TP_PROTO(struct rvt_sge *sge, struct ib_sge *isge),
13514fe13fcSMike Marciniszyn 	TP_ARGS(sge, isge));
13614fe13fcSMike Marciniszyn 
13714fe13fcSMike Marciniszyn DEFINE_EVENT(
13814fe13fcSMike Marciniszyn 	rvt_sge_template, rvt_sge_new,
13914fe13fcSMike Marciniszyn 	TP_PROTO(struct rvt_sge *sge, struct ib_sge *isge),
14014fe13fcSMike Marciniszyn 	TP_ARGS(sge, isge));
14114fe13fcSMike Marciniszyn 
1428bd516bdSMike Marciniszyn TRACE_EVENT(
1438bd516bdSMike Marciniszyn 	rvt_map_mr_sg,
1448bd516bdSMike Marciniszyn 	TP_PROTO(struct ib_mr *ibmr, int sg_nents, unsigned int *sg_offset),
1458bd516bdSMike Marciniszyn 	TP_ARGS(ibmr, sg_nents, sg_offset),
1468bd516bdSMike Marciniszyn 	TP_STRUCT__entry(
1478bd516bdSMike Marciniszyn 		RDI_DEV_ENTRY(ib_to_rvt(to_imr(ibmr)->mr.pd->device))
1488bd516bdSMike Marciniszyn 		__field(u64, iova)
1498bd516bdSMike Marciniszyn 		__field(u64, ibmr_iova)
1508bd516bdSMike Marciniszyn 		__field(u64, user_base)
1518bd516bdSMike Marciniszyn 		__field(u64, ibmr_length)
1528bd516bdSMike Marciniszyn 		__field(int, sg_nents)
1538bd516bdSMike Marciniszyn 		__field(uint, sg_offset)
1548bd516bdSMike Marciniszyn 	),
1558bd516bdSMike Marciniszyn 	TP_fast_assign(
15678c14b38SJoe Perches 		RDI_DEV_ASSIGN(ib_to_rvt(to_imr(ibmr)->mr.pd->device));
1578bd516bdSMike Marciniszyn 		__entry->ibmr_iova = ibmr->iova;
1588bd516bdSMike Marciniszyn 		__entry->iova = to_imr(ibmr)->mr.iova;
1598bd516bdSMike Marciniszyn 		__entry->user_base = to_imr(ibmr)->mr.user_base;
1608bd516bdSMike Marciniszyn 		__entry->ibmr_length = to_imr(ibmr)->mr.length;
1618bd516bdSMike Marciniszyn 		__entry->sg_nents = sg_nents;
1628bd516bdSMike Marciniszyn 		__entry->sg_offset = sg_offset ? *sg_offset : 0;
1638bd516bdSMike Marciniszyn 	),
1648bd516bdSMike Marciniszyn 	TP_printk(
1658bd516bdSMike Marciniszyn 		"[%s] ibmr_iova %llx iova %llx user_base %llx length %llx sg_nents %d sg_offset %u",
1668bd516bdSMike Marciniszyn 		__get_str(dev),
1678bd516bdSMike Marciniszyn 		__entry->ibmr_iova,
1688bd516bdSMike Marciniszyn 		__entry->iova,
1698bd516bdSMike Marciniszyn 		__entry->user_base,
1708bd516bdSMike Marciniszyn 		__entry->ibmr_length,
1718bd516bdSMike Marciniszyn 		__entry->sg_nents,
1728bd516bdSMike Marciniszyn 		__entry->sg_offset
1738bd516bdSMike Marciniszyn 	)
1748bd516bdSMike Marciniszyn );
1758bd516bdSMike Marciniszyn 
176fcb29a66SMike Marciniszyn #endif /* __RVT_TRACE_MR_H */
177fcb29a66SMike Marciniszyn 
178fcb29a66SMike Marciniszyn #undef TRACE_INCLUDE_PATH
179fcb29a66SMike Marciniszyn #undef TRACE_INCLUDE_FILE
180fcb29a66SMike Marciniszyn #define TRACE_INCLUDE_PATH .
181fcb29a66SMike Marciniszyn #define TRACE_INCLUDE_FILE trace_mr
182fcb29a66SMike Marciniszyn #include <trace/define_trace.h>
183