18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright(c) 2016 Intel Corporation. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * This file is provided under a dual BSD/GPLv2 license. When using or 58c2ecf20Sopenharmony_ci * redistributing this file, you may do so under either license. 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * GPL LICENSE SUMMARY 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 108c2ecf20Sopenharmony_ci * it under the terms of version 2 of the GNU General Public License as 118c2ecf20Sopenharmony_ci * published by the Free Software Foundation. 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, but 148c2ecf20Sopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of 158c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 168c2ecf20Sopenharmony_ci * General Public License for more details. 178c2ecf20Sopenharmony_ci * 188c2ecf20Sopenharmony_ci * BSD LICENSE 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 218c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions 228c2ecf20Sopenharmony_ci * are met: 238c2ecf20Sopenharmony_ci * 248c2ecf20Sopenharmony_ci * - Redistributions of source code must retain the above copyright 258c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer. 268c2ecf20Sopenharmony_ci * - Redistributions in binary form must reproduce the above copyright 278c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer in 288c2ecf20Sopenharmony_ci * the documentation and/or other materials provided with the 298c2ecf20Sopenharmony_ci * distribution. 308c2ecf20Sopenharmony_ci * - Neither the name of Intel Corporation nor the names of its 318c2ecf20Sopenharmony_ci * contributors may be used to endorse or promote products derived 328c2ecf20Sopenharmony_ci * from this software without specific prior written permission. 338c2ecf20Sopenharmony_ci * 348c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 358c2ecf20Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 368c2ecf20Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 378c2ecf20Sopenharmony_ci * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 388c2ecf20Sopenharmony_ci * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 398c2ecf20Sopenharmony_ci * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 408c2ecf20Sopenharmony_ci * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 418c2ecf20Sopenharmony_ci * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 428c2ecf20Sopenharmony_ci * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 438c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 448c2ecf20Sopenharmony_ci * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 458c2ecf20Sopenharmony_ci * 468c2ecf20Sopenharmony_ci */ 478c2ecf20Sopenharmony_ci#if !defined(__RVT_TRACE_MR_H) || defined(TRACE_HEADER_MULTI_READ) 488c2ecf20Sopenharmony_ci#define __RVT_TRACE_MR_H 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci#include <linux/tracepoint.h> 518c2ecf20Sopenharmony_ci#include <linux/trace_seq.h> 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#include <rdma/ib_verbs.h> 548c2ecf20Sopenharmony_ci#include <rdma/rdma_vt.h> 558c2ecf20Sopenharmony_ci#include <rdma/rdmavt_mr.h> 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#include "mr.h" 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#undef TRACE_SYSTEM 608c2ecf20Sopenharmony_ci#define TRACE_SYSTEM rvt_mr 618c2ecf20Sopenharmony_ciDECLARE_EVENT_CLASS( 628c2ecf20Sopenharmony_ci rvt_mr_template, 638c2ecf20Sopenharmony_ci TP_PROTO(struct rvt_mregion *mr, u16 m, u16 n, void *v, size_t len), 648c2ecf20Sopenharmony_ci TP_ARGS(mr, m, n, v, len), 658c2ecf20Sopenharmony_ci TP_STRUCT__entry( 668c2ecf20Sopenharmony_ci RDI_DEV_ENTRY(ib_to_rvt(mr->pd->device)) 678c2ecf20Sopenharmony_ci __field(void *, vaddr) 688c2ecf20Sopenharmony_ci __field(struct page *, page) 698c2ecf20Sopenharmony_ci __field(u64, iova) 708c2ecf20Sopenharmony_ci __field(u64, user_base) 718c2ecf20Sopenharmony_ci __field(size_t, len) 728c2ecf20Sopenharmony_ci __field(size_t, length) 738c2ecf20Sopenharmony_ci __field(u32, lkey) 748c2ecf20Sopenharmony_ci __field(u32, offset) 758c2ecf20Sopenharmony_ci __field(u16, m) 768c2ecf20Sopenharmony_ci __field(u16, n) 778c2ecf20Sopenharmony_ci ), 788c2ecf20Sopenharmony_ci TP_fast_assign( 798c2ecf20Sopenharmony_ci RDI_DEV_ASSIGN(ib_to_rvt(mr->pd->device)); 808c2ecf20Sopenharmony_ci __entry->vaddr = v; 818c2ecf20Sopenharmony_ci __entry->page = virt_to_page(v); 828c2ecf20Sopenharmony_ci __entry->iova = mr->iova; 838c2ecf20Sopenharmony_ci __entry->user_base = mr->user_base; 848c2ecf20Sopenharmony_ci __entry->lkey = mr->lkey; 858c2ecf20Sopenharmony_ci __entry->m = m; 868c2ecf20Sopenharmony_ci __entry->n = n; 878c2ecf20Sopenharmony_ci __entry->len = len; 888c2ecf20Sopenharmony_ci __entry->length = mr->length; 898c2ecf20Sopenharmony_ci __entry->offset = mr->offset; 908c2ecf20Sopenharmony_ci ), 918c2ecf20Sopenharmony_ci TP_printk( 928c2ecf20Sopenharmony_ci "[%s] lkey %x iova %llx user_base %llx mr_len %lu vaddr %llx page %p m %u n %u len %lu off %u", 938c2ecf20Sopenharmony_ci __get_str(dev), 948c2ecf20Sopenharmony_ci __entry->lkey, 958c2ecf20Sopenharmony_ci __entry->iova, 968c2ecf20Sopenharmony_ci __entry->user_base, 978c2ecf20Sopenharmony_ci __entry->length, 988c2ecf20Sopenharmony_ci (unsigned long long)__entry->vaddr, 998c2ecf20Sopenharmony_ci __entry->page, 1008c2ecf20Sopenharmony_ci __entry->m, 1018c2ecf20Sopenharmony_ci __entry->n, 1028c2ecf20Sopenharmony_ci __entry->len, 1038c2ecf20Sopenharmony_ci __entry->offset 1048c2ecf20Sopenharmony_ci ) 1058c2ecf20Sopenharmony_ci); 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ciDEFINE_EVENT( 1088c2ecf20Sopenharmony_ci rvt_mr_template, rvt_mr_page_seg, 1098c2ecf20Sopenharmony_ci TP_PROTO(struct rvt_mregion *mr, u16 m, u16 n, void *v, size_t len), 1108c2ecf20Sopenharmony_ci TP_ARGS(mr, m, n, v, len)); 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_ciDEFINE_EVENT( 1138c2ecf20Sopenharmony_ci rvt_mr_template, rvt_mr_fmr_seg, 1148c2ecf20Sopenharmony_ci TP_PROTO(struct rvt_mregion *mr, u16 m, u16 n, void *v, size_t len), 1158c2ecf20Sopenharmony_ci TP_ARGS(mr, m, n, v, len)); 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ciDEFINE_EVENT( 1188c2ecf20Sopenharmony_ci rvt_mr_template, rvt_mr_user_seg, 1198c2ecf20Sopenharmony_ci TP_PROTO(struct rvt_mregion *mr, u16 m, u16 n, void *v, size_t len), 1208c2ecf20Sopenharmony_ci TP_ARGS(mr, m, n, v, len)); 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ciDECLARE_EVENT_CLASS( 1238c2ecf20Sopenharmony_ci rvt_sge_template, 1248c2ecf20Sopenharmony_ci TP_PROTO(struct rvt_sge *sge, struct ib_sge *isge), 1258c2ecf20Sopenharmony_ci TP_ARGS(sge, isge), 1268c2ecf20Sopenharmony_ci TP_STRUCT__entry( 1278c2ecf20Sopenharmony_ci RDI_DEV_ENTRY(ib_to_rvt(sge->mr->pd->device)) 1288c2ecf20Sopenharmony_ci __field(struct rvt_mregion *, mr) 1298c2ecf20Sopenharmony_ci __field(struct rvt_sge *, sge) 1308c2ecf20Sopenharmony_ci __field(struct ib_sge *, isge) 1318c2ecf20Sopenharmony_ci __field(void *, vaddr) 1328c2ecf20Sopenharmony_ci __field(u64, ivaddr) 1338c2ecf20Sopenharmony_ci __field(u32, lkey) 1348c2ecf20Sopenharmony_ci __field(u32, sge_length) 1358c2ecf20Sopenharmony_ci __field(u32, length) 1368c2ecf20Sopenharmony_ci __field(u32, ilength) 1378c2ecf20Sopenharmony_ci __field(int, user) 1388c2ecf20Sopenharmony_ci __field(u16, m) 1398c2ecf20Sopenharmony_ci __field(u16, n) 1408c2ecf20Sopenharmony_ci ), 1418c2ecf20Sopenharmony_ci TP_fast_assign( 1428c2ecf20Sopenharmony_ci RDI_DEV_ASSIGN(ib_to_rvt(sge->mr->pd->device)); 1438c2ecf20Sopenharmony_ci __entry->mr = sge->mr; 1448c2ecf20Sopenharmony_ci __entry->sge = sge; 1458c2ecf20Sopenharmony_ci __entry->isge = isge; 1468c2ecf20Sopenharmony_ci __entry->vaddr = sge->vaddr; 1478c2ecf20Sopenharmony_ci __entry->ivaddr = isge->addr; 1488c2ecf20Sopenharmony_ci __entry->lkey = sge->mr->lkey; 1498c2ecf20Sopenharmony_ci __entry->sge_length = sge->sge_length; 1508c2ecf20Sopenharmony_ci __entry->length = sge->length; 1518c2ecf20Sopenharmony_ci __entry->ilength = isge->length; 1528c2ecf20Sopenharmony_ci __entry->m = sge->m; 1538c2ecf20Sopenharmony_ci __entry->n = sge->m; 1548c2ecf20Sopenharmony_ci __entry->user = ibpd_to_rvtpd(sge->mr->pd)->user; 1558c2ecf20Sopenharmony_ci ), 1568c2ecf20Sopenharmony_ci TP_printk( 1578c2ecf20Sopenharmony_ci "[%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", 1588c2ecf20Sopenharmony_ci __get_str(dev), 1598c2ecf20Sopenharmony_ci __entry->mr, 1608c2ecf20Sopenharmony_ci __entry->sge, 1618c2ecf20Sopenharmony_ci __entry->isge, 1628c2ecf20Sopenharmony_ci __entry->vaddr, 1638c2ecf20Sopenharmony_ci __entry->ivaddr, 1648c2ecf20Sopenharmony_ci __entry->lkey, 1658c2ecf20Sopenharmony_ci __entry->sge_length, 1668c2ecf20Sopenharmony_ci __entry->length, 1678c2ecf20Sopenharmony_ci __entry->ilength, 1688c2ecf20Sopenharmony_ci __entry->m, 1698c2ecf20Sopenharmony_ci __entry->n, 1708c2ecf20Sopenharmony_ci __entry->user 1718c2ecf20Sopenharmony_ci ) 1728c2ecf20Sopenharmony_ci); 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ciDEFINE_EVENT( 1758c2ecf20Sopenharmony_ci rvt_sge_template, rvt_sge_adjacent, 1768c2ecf20Sopenharmony_ci TP_PROTO(struct rvt_sge *sge, struct ib_sge *isge), 1778c2ecf20Sopenharmony_ci TP_ARGS(sge, isge)); 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ciDEFINE_EVENT( 1808c2ecf20Sopenharmony_ci rvt_sge_template, rvt_sge_new, 1818c2ecf20Sopenharmony_ci TP_PROTO(struct rvt_sge *sge, struct ib_sge *isge), 1828c2ecf20Sopenharmony_ci TP_ARGS(sge, isge)); 1838c2ecf20Sopenharmony_ci 1848c2ecf20Sopenharmony_ciTRACE_EVENT( 1858c2ecf20Sopenharmony_ci rvt_map_mr_sg, 1868c2ecf20Sopenharmony_ci TP_PROTO(struct ib_mr *ibmr, int sg_nents, unsigned int *sg_offset), 1878c2ecf20Sopenharmony_ci TP_ARGS(ibmr, sg_nents, sg_offset), 1888c2ecf20Sopenharmony_ci TP_STRUCT__entry( 1898c2ecf20Sopenharmony_ci RDI_DEV_ENTRY(ib_to_rvt(to_imr(ibmr)->mr.pd->device)) 1908c2ecf20Sopenharmony_ci __field(u64, iova) 1918c2ecf20Sopenharmony_ci __field(u64, ibmr_iova) 1928c2ecf20Sopenharmony_ci __field(u64, user_base) 1938c2ecf20Sopenharmony_ci __field(u64, ibmr_length) 1948c2ecf20Sopenharmony_ci __field(int, sg_nents) 1958c2ecf20Sopenharmony_ci __field(uint, sg_offset) 1968c2ecf20Sopenharmony_ci ), 1978c2ecf20Sopenharmony_ci TP_fast_assign( 1988c2ecf20Sopenharmony_ci RDI_DEV_ASSIGN(ib_to_rvt(to_imr(ibmr)->mr.pd->device)) 1998c2ecf20Sopenharmony_ci __entry->ibmr_iova = ibmr->iova; 2008c2ecf20Sopenharmony_ci __entry->iova = to_imr(ibmr)->mr.iova; 2018c2ecf20Sopenharmony_ci __entry->user_base = to_imr(ibmr)->mr.user_base; 2028c2ecf20Sopenharmony_ci __entry->ibmr_length = to_imr(ibmr)->mr.length; 2038c2ecf20Sopenharmony_ci __entry->sg_nents = sg_nents; 2048c2ecf20Sopenharmony_ci __entry->sg_offset = sg_offset ? *sg_offset : 0; 2058c2ecf20Sopenharmony_ci ), 2068c2ecf20Sopenharmony_ci TP_printk( 2078c2ecf20Sopenharmony_ci "[%s] ibmr_iova %llx iova %llx user_base %llx length %llx sg_nents %d sg_offset %u", 2088c2ecf20Sopenharmony_ci __get_str(dev), 2098c2ecf20Sopenharmony_ci __entry->ibmr_iova, 2108c2ecf20Sopenharmony_ci __entry->iova, 2118c2ecf20Sopenharmony_ci __entry->user_base, 2128c2ecf20Sopenharmony_ci __entry->ibmr_length, 2138c2ecf20Sopenharmony_ci __entry->sg_nents, 2148c2ecf20Sopenharmony_ci __entry->sg_offset 2158c2ecf20Sopenharmony_ci ) 2168c2ecf20Sopenharmony_ci); 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci#endif /* __RVT_TRACE_MR_H */ 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci#undef TRACE_INCLUDE_PATH 2218c2ecf20Sopenharmony_ci#undef TRACE_INCLUDE_FILE 2228c2ecf20Sopenharmony_ci#define TRACE_INCLUDE_PATH . 2238c2ecf20Sopenharmony_ci#define TRACE_INCLUDE_FILE trace_mr 2248c2ecf20Sopenharmony_ci#include <trace/define_trace.h> 225