From patchwork Thu Dec 20 02:22:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 10738483 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C4B713B5 for ; Thu, 20 Dec 2018 02:23:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69C5928899 for ; Thu, 20 Dec 2018 02:23:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D90E288C5; Thu, 20 Dec 2018 02:23:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FA1A28899 for ; Thu, 20 Dec 2018 02:23:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730039AbeLTCXV (ORCPT ); Wed, 19 Dec 2018 21:23:21 -0500 Received: from mga03.intel.com ([134.134.136.65]:19148 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726604AbeLTCXV (ORCPT ); Wed, 19 Dec 2018 21:23:21 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2018 18:23:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,375,1539673200"; d="scan'208";a="103141031" Received: from phlsvsds.ph.intel.com ([10.228.164.149]) by orsmga008.jf.intel.com with ESMTP; 19 Dec 2018 18:23:19 -0800 Received: from phlsvsds.ph.intel.com (localhost.localdomain [127.0.0.1]) by phlsvsds.ph.intel.com (8.13.8/8.13.8) with ESMTP id wBK2NA3A029565; Wed, 19 Dec 2018 21:23:10 -0500 Received: (from iweiny@localhost) by phlsvsds.ph.intel.com (8.13.8/8.13.8/Submit) id wBK2N9CW029562; Wed, 19 Dec 2018 21:23:09 -0500 X-Authentication-Warning: phlsvsds.ph.intel.com: iweiny set sender to ira.weiny@intel.com using -f From: ira.weiny@intel.com To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Steven Rostedt , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann , Ira Weiny Subject: [RDMA for-next v2 1/6] IB/MAD: Add send path trace points Date: Wed, 19 Dec 2018 21:22:40 -0500 Message-Id: <1545272565-29493-2-git-send-email-ira.weiny@intel.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1545272565-29493-1-git-send-email-ira.weiny@intel.com> References: <1545074124-18185-1-git-send-email-ira.weiny@intel.com> <1545272565-29493-1-git-send-email-ira.weiny@intel.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ira Weiny Use the standard Linux trace mechanism to trace MADs being sent. 4 trace points are added, when the MAD is posted to the qp, when the MAD is completed, if a MAD is resent, and when the MAD completes in error. Signed-off-by: Ira Weiny --- Changes since v1: Update MAINTAINERS with tracing file MAINTAINERS | 1 + drivers/infiniband/core/mad.c | 73 +++++++++++++++- include/trace/events/ib_mad.h | 193 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 266 insertions(+), 1 deletion(-) create mode 100644 include/trace/events/ib_mad.h diff --git a/MAINTAINERS b/MAINTAINERS index f4855974f325..1d35dd8d3ce1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7294,6 +7294,7 @@ F: drivers/infiniband/ F: include/uapi/linux/if_infiniband.h F: include/uapi/rdma/ F: include/rdma/ +F: include/trace/events/ib_mad.h INGENIC JZ4780 DMA Driver M: Zubair Lutfullah Kakakhel diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index d7025cd5be28..3853c57bce40 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -3,7 +3,7 @@ * Copyright (c) 2005 Intel Corporation. All rights reserved. * Copyright (c) 2005 Mellanox Technologies Ltd. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. - * Copyright (c) 2014 Intel Corporation. All rights reserved. + * Copyright (c) 2014,2018 Intel Corporation. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -51,6 +51,51 @@ #include "opa_smi.h" #include "agent.h" +struct rdma_mad_trace_addr { + u32 dlid; + u8 dmac[ETH_ALEN]; + u8 sl; + u16 pkey; + u32 rqpn; + u32 rqkey; +}; +static void trace_create_mad_addr(struct ib_device *dev, u8 pnum, + struct ib_ud_wr *wr, + struct rdma_mad_trace_addr *addr) +{ + struct rdma_ah_attr attr; + + memset(&attr, 0, sizeof(attr)); + rdma_query_ah(wr->ah, &attr); + + /* These are common */ + addr->sl = attr.sl; + ib_query_pkey(dev, pnum, wr->pkey_index, &addr->pkey); + addr->rqpn = wr->remote_qpn; + addr->rqkey = wr->remote_qkey; + + switch (attr.type) { + case RDMA_AH_ATTR_TYPE_IB: + addr->dlid = attr.ib.dlid; + memset(addr->dmac, 0, sizeof(attr.roce.dmac)); + break; + case RDMA_AH_ATTR_TYPE_OPA: + addr->dlid = attr.opa.dlid; + memset(addr->dmac, 0, sizeof(attr.roce.dmac)); + break; + case RDMA_AH_ATTR_TYPE_ROCE: + addr->dlid = 0; + memcpy(addr->dmac, attr.roce.dmac, sizeof(attr.roce.dmac)); + break; + case RDMA_AH_ATTR_TYPE_UNDEFINED: + addr->dlid = 0; + memset(addr->dmac, 0, sizeof(attr.roce.dmac)); + break; + } +} +#define CREATE_TRACE_POINTS +#include + static int mad_sendq_size = IB_MAD_QP_SEND_SIZE; static int mad_recvq_size = IB_MAD_QP_RECV_SIZE; @@ -1223,6 +1268,14 @@ int ib_send_mad(struct ib_mad_send_wr_private *mad_send_wr) spin_lock_irqsave(&qp_info->send_queue.lock, flags); if (qp_info->send_queue.count < qp_info->send_queue.max_active) { + if (trace_ib_mad_ib_send_mad_enabled()) { + struct rdma_mad_trace_addr addr; + + trace_create_mad_addr(qp_info->port_priv->device, + qp_info->port_priv->port_num, + &mad_send_wr->send_wr, &addr); + trace_ib_mad_ib_send_mad(mad_send_wr, &addr); + } ret = ib_post_send(mad_agent->qp, &mad_send_wr->send_wr.wr, NULL); list = &qp_info->send_queue.list; @@ -2498,6 +2551,8 @@ static void ib_mad_send_done(struct ib_cq *cq, struct ib_wc *wc) send_queue = mad_list->mad_queue; qp_info = send_queue->qp_info; + trace_ib_mad_send_done_handler(mad_send_wr, wc); + retry: ib_dma_unmap_single(mad_send_wr->send_buf.mad_agent->device, mad_send_wr->header_mapping, @@ -2529,6 +2584,14 @@ static void ib_mad_send_done(struct ib_cq *cq, struct ib_wc *wc) ib_mad_complete_send_wr(mad_send_wr, &mad_send_wc); if (queued_send_wr) { + if (trace_ib_mad_send_done_resend_enabled()) { + struct rdma_mad_trace_addr addr; + + trace_create_mad_addr(qp_info->port_priv->device, + qp_info->port_priv->port_num, + &mad_send_wr->send_wr, &addr); + trace_ib_mad_send_done_resend(queued_send_wr, &addr); + } ret = ib_post_send(qp_info->qp, &queued_send_wr->send_wr.wr, NULL); if (ret) { @@ -2576,6 +2639,14 @@ static bool ib_mad_send_error(struct ib_mad_port_private *port_priv, if (mad_send_wr->retry) { /* Repost send */ mad_send_wr->retry = 0; + if (trace_ib_mad_error_handler_enabled()) { + struct rdma_mad_trace_addr addr; + + trace_create_mad_addr(qp_info->port_priv->device, + qp_info->port_priv->port_num, + &mad_send_wr->send_wr, &addr); + trace_ib_mad_error_handler(mad_send_wr, &addr); + } ret = ib_post_send(qp_info->qp, &mad_send_wr->send_wr.wr, NULL); if (!ret) diff --git a/include/trace/events/ib_mad.h b/include/trace/events/ib_mad.h new file mode 100644 index 000000000000..8c08eaefbc08 --- /dev/null +++ b/include/trace/events/ib_mad.h @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2018 Intel Corporation. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM ib_mad + +#if !defined(_TRACE_IB_MAD_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_IB_MAD_H + +#include +#include + +DECLARE_EVENT_CLASS(ib_mad_send_template, + TP_PROTO(struct ib_mad_send_wr_private *wr, struct rdma_mad_trace_addr *addr), + TP_ARGS(wr, addr), + + TP_STRUCT__entry( + __array(char, dev_name, IB_DEVICE_NAME_MAX) + __field(u8, port_num) + __field(u32, qp_num) + __field(void *, agent_priv) + __field(u64, wrtid) + __field(int, retries_left) + __field(int, max_retries) + __field(int, retry) + __field(unsigned long, timeout) + __field(u32, length) + __field(u8, base_version) + __field(u8, mgmt_class) + __field(u8, class_version) + __field(u8, method) + __field(u16, status) + __field(u16, class_specific) + __field(u64, tid) + __field(u16, attr_id) + __field(u32, attr_mod) + __field(u32, dlid) + __field(u8, sl) + __field(u16, pkey) + __field(u32, rqpn) + __field(u32, rqkey) + ), + + TP_fast_assign( + memcpy(__entry->dev_name, wr->mad_agent_priv->agent.device->name, + IB_DEVICE_NAME_MAX); + __entry->port_num = wr->mad_agent_priv->agent.port_num; + __entry->qp_num = wr->mad_agent_priv->qp_info->qp->qp_num; + __entry->agent_priv = wr->mad_agent_priv; + __entry->wrtid = wr->tid; + __entry->max_retries = wr->max_retries; + __entry->retries_left = wr->retries_left; + __entry->retry = wr->retry; + __entry->timeout = wr->timeout; + __entry->length = wr->send_buf.hdr_len + + wr->send_buf.data_len; + __entry->base_version = ((struct ib_mad_hdr *)wr->send_buf.mad)->base_version; + __entry->mgmt_class = ((struct ib_mad_hdr *)wr->send_buf.mad)->mgmt_class; + __entry->class_version = ((struct ib_mad_hdr *)wr->send_buf.mad)->class_version; + __entry->method = ((struct ib_mad_hdr *)wr->send_buf.mad)->method; + __entry->status = ((struct ib_mad_hdr *)wr->send_buf.mad)->status; + __entry->class_specific = ((struct ib_mad_hdr *)wr->send_buf.mad)->class_specific; + __entry->tid = ((struct ib_mad_hdr *)wr->send_buf.mad)->tid; + __entry->attr_id = ((struct ib_mad_hdr *)wr->send_buf.mad)->attr_id; + __entry->attr_mod = ((struct ib_mad_hdr *)wr->send_buf.mad)->attr_mod; + __entry->dlid = addr->dlid; + __entry->sl = addr->sl; + __entry->pkey = addr->pkey; + __entry->rqpn = addr->rqpn; + __entry->rqkey = addr->rqkey; + ), + + TP_printk("%s:%d QP%d agent %p: " \ + "wrtid 0x%llx; %d/%d retries(%d); timeout %lu length %d : hdr : " \ + "base_ver 0x%x class 0x%x class_ver 0x%x method 0x%x " \ + "status 0x%x class_specific 0x%x tid 0x%llx attr_id 0x%x attr_mod 0x%x " \ + " => dlid 0x%08x sl %d pkey 0x%x rpqn 0x%x rqpkey 0x%x", + __entry->dev_name, __entry->port_num, __entry->qp_num, + __entry->agent_priv, be64_to_cpu(__entry->wrtid), + __entry->retries_left, __entry->max_retries, + __entry->retry, __entry->timeout, __entry->length, + __entry->base_version, __entry->mgmt_class, __entry->class_version, + __entry->method, be16_to_cpu(__entry->status), + be16_to_cpu(__entry->class_specific), + be64_to_cpu(__entry->tid), be16_to_cpu(__entry->attr_id), + be32_to_cpu(__entry->attr_mod), + be32_to_cpu(__entry->dlid), __entry->sl, __entry->pkey, __entry->rqpn, + __entry->rqkey + ) +); + +DEFINE_EVENT(ib_mad_send_template, ib_mad_error_handler, + TP_PROTO(struct ib_mad_send_wr_private *wr, struct rdma_mad_trace_addr *addr), + TP_ARGS(wr, addr)); +DEFINE_EVENT(ib_mad_send_template, ib_mad_ib_send_mad, + TP_PROTO(struct ib_mad_send_wr_private *wr, struct rdma_mad_trace_addr *addr), + TP_ARGS(wr, addr)); +DEFINE_EVENT(ib_mad_send_template, ib_mad_send_done_resend, + TP_PROTO(struct ib_mad_send_wr_private *wr, struct rdma_mad_trace_addr *addr), + TP_ARGS(wr, addr)); + +TRACE_EVENT(ib_mad_send_done_handler, + TP_PROTO(struct ib_mad_send_wr_private *wr, struct ib_wc *wc), + TP_ARGS(wr, wc), + + TP_STRUCT__entry( + __array(char, dev_name, IB_DEVICE_NAME_MAX) + __field(u8, port_num) + __field(u32, qp_num) + __field(void *, agent_priv) + __field(u64, wrtid) + __field(int, retries_left) + __field(int, max_retries) + __field(int, retry) + __field(unsigned long, timeout) + __field(u8, base_version) + __field(u8, mgmt_class) + __field(u8, class_version) + __field(u8, method) + __field(u16, status) + __field(u16, wc_status) + __field(u32, length) + ), + + TP_fast_assign( + memcpy(__entry->dev_name, wr->mad_agent_priv->agent.device->name, + IB_DEVICE_NAME_MAX); + __entry->port_num = wr->mad_agent_priv->agent.port_num; + __entry->qp_num = wr->mad_agent_priv->qp_info->qp->qp_num; + __entry->agent_priv = wr->mad_agent_priv; + __entry->wrtid = wr->tid; + __entry->max_retries = wr->max_retries; + __entry->retries_left = wr->retries_left; + __entry->retry = wr->retry; + __entry->timeout = wr->timeout; + __entry->base_version = ((struct ib_mad_hdr *)wr->send_buf.mad)->base_version; + __entry->mgmt_class = ((struct ib_mad_hdr *)wr->send_buf.mad)->mgmt_class; + __entry->class_version = ((struct ib_mad_hdr *)wr->send_buf.mad)->class_version; + __entry->method = ((struct ib_mad_hdr *)wr->send_buf.mad)->method; + __entry->status = ((struct ib_mad_hdr *)wr->send_buf.mad)->status; + __entry->wc_status = wc->status; + __entry->length = wc->byte_len; + ), + + TP_printk("%s:%d QP%d : SEND WC Status %d : agent %p: " \ + "wrtid 0x%llx %d/%d retries(%d) timeout %lu length %d: hdr : " \ + "base_ver 0x%x class 0x%x class_ver 0x%x method 0x%x " \ + "status 0x%x", + __entry->dev_name, __entry->port_num, __entry->qp_num, + __entry->wc_status, + __entry->agent_priv, be64_to_cpu(__entry->wrtid), + __entry->retries_left, __entry->max_retries, + __entry->retry, __entry->timeout, + __entry->length, + __entry->base_version, __entry->mgmt_class, __entry->class_version, + __entry->method, be16_to_cpu(__entry->status) + ) +); + + +#endif /* _TRACE_IB_MAD_H */ + +#include From patchwork Thu Dec 20 02:22:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 10738485 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB15E13B5 for ; Thu, 20 Dec 2018 02:23:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA9782884F for ; Thu, 20 Dec 2018 02:23:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE94B28899; Thu, 20 Dec 2018 02:23:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4A33C2884F for ; Thu, 20 Dec 2018 02:23:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730044AbeLTCXZ (ORCPT ); Wed, 19 Dec 2018 21:23:25 -0500 Received: from mga11.intel.com ([192.55.52.93]:38899 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726604AbeLTCXZ (ORCPT ); Wed, 19 Dec 2018 21:23:25 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2018 18:23:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,375,1539673200"; d="scan'208";a="303653399" Received: from phlsvsds.ph.intel.com ([10.228.164.149]) by fmsmga006.fm.intel.com with ESMTP; 19 Dec 2018 18:23:23 -0800 Received: from phlsvsds.ph.intel.com (localhost.localdomain [127.0.0.1]) by phlsvsds.ph.intel.com (8.13.8/8.13.8) with ESMTP id wBK2NFpQ029574; Wed, 19 Dec 2018 21:23:15 -0500 Received: (from iweiny@localhost) by phlsvsds.ph.intel.com (8.13.8/8.13.8/Submit) id wBK2NEci029571; Wed, 19 Dec 2018 21:23:14 -0500 X-Authentication-Warning: phlsvsds.ph.intel.com: iweiny set sender to ira.weiny@intel.com using -f From: ira.weiny@intel.com To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Steven Rostedt , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann , Ira Weiny Subject: [RDMA for-next v2 2/6] IB/MAD: Add recv path trace point Date: Wed, 19 Dec 2018 21:22:41 -0500 Message-Id: <1545272565-29493-3-git-send-email-ira.weiny@intel.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1545272565-29493-1-git-send-email-ira.weiny@intel.com> References: <1545074124-18185-1-git-send-email-ira.weiny@intel.com> <1545272565-29493-1-git-send-email-ira.weiny@intel.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ira Weiny Trace received MAD details. Signed-off-by: Ira Weiny --- drivers/infiniband/core/mad.c | 10 +++++++ include/trace/events/ib_mad.h | 64 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 3853c57bce40..880a23811923 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -2339,6 +2339,16 @@ static void ib_mad_recv_done(struct ib_cq *cq, struct ib_wc *wc) if (!validate_mad((const struct ib_mad_hdr *)recv->mad, qp_info, opa)) goto out; + if (trace_ib_mad_recv_done_handler_enabled()) { + u16 pkey; + + ib_query_pkey(qp_info->port_priv->device, qp_info->port_priv->port_num, + wc->pkey_index, &pkey); + + trace_ib_mad_recv_done_handler(qp_info, wc, (struct ib_mad_hdr *)recv->mad, + pkey); + } + mad_size = recv->mad_size; response = alloc_mad_private(mad_size, GFP_KERNEL); if (!response) diff --git a/include/trace/events/ib_mad.h b/include/trace/events/ib_mad.h index 8c08eaefbc08..95a78732e643 100644 --- a/include/trace/events/ib_mad.h +++ b/include/trace/events/ib_mad.h @@ -187,6 +187,70 @@ ) ); +TRACE_EVENT(ib_mad_recv_done_handler, + TP_PROTO(struct ib_mad_qp_info *qp_info, struct ib_wc *wc, struct ib_mad_hdr *mad_hdr, + u16 pkey), + TP_ARGS(qp_info, wc, mad_hdr, pkey), + + TP_STRUCT__entry( + __array(char, dev_name, IB_DEVICE_NAME_MAX) + __field(u8, port_num) + __field(u32, qp_num) + __field(u32, length) + __field(u8, base_version) + __field(u8, mgmt_class) + __field(u8, class_version) + __field(u8, method) + __field(u16, status) + __field(u16, class_specific) + __field(u64, tid) + __field(u16, attr_id) + __field(u32, attr_mod) + __field(u32, slid) + __field(u16, src_qp) + __field(u8, sl) + __field(u16, pkey) + __field(u16, wc_status) + ), + + TP_fast_assign( + memcpy(__entry->dev_name, qp_info->port_priv->device->name, IB_DEVICE_NAME_MAX); + __entry->port_num = qp_info->port_priv->port_num; + __entry->qp_num = qp_info->qp->qp_num; + __entry->length = wc->byte_len; + __entry->base_version = mad_hdr->base_version; + __entry->mgmt_class = mad_hdr->mgmt_class; + __entry->class_version = mad_hdr->class_version; + __entry->method = mad_hdr->method; + __entry->status = mad_hdr->status; + __entry->class_specific = mad_hdr->class_specific; + __entry->tid = mad_hdr->tid; + __entry->attr_id = mad_hdr->attr_id; + __entry->attr_mod = mad_hdr->attr_mod; + __entry->slid = wc->slid; + __entry->src_qp = wc->src_qp; + __entry->sl = wc->sl; + __entry->pkey = pkey; + __entry->wc_status = wc->status; + ), + + TP_printk("%s:%d QP%d : RECV WC Status %d : length %d : hdr : " \ + "base_ver 0x%02x class 0x%02x class_ver 0x%02x method 0x%02x " \ + "status 0x%04x class_specific 0x%04x tid 0x%016llx " \ + "attr_id 0x%04x attr_mod 0x%08x slid 0x%08x src QP%d, sl %d " \ + "pkey 0x%04x", + __entry->dev_name, __entry->port_num, __entry->qp_num, + __entry->wc_status, + __entry->length, + __entry->base_version, __entry->mgmt_class, __entry->class_version, + __entry->method, be16_to_cpu(__entry->status), + be16_to_cpu(__entry->class_specific), + be64_to_cpu(__entry->tid), be16_to_cpu(__entry->attr_id), + be32_to_cpu(__entry->attr_mod), + __entry->slid, __entry->src_qp, __entry->sl, __entry->pkey + ) +); + #endif /* _TRACE_IB_MAD_H */ From patchwork Thu Dec 20 02:22:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 10738487 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4B2726C5 for ; Thu, 20 Dec 2018 02:23:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3570328898 for ; Thu, 20 Dec 2018 02:23:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24B132884F; Thu, 20 Dec 2018 02:23:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B37BE2884F for ; Thu, 20 Dec 2018 02:23:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730061AbeLTCX2 (ORCPT ); Wed, 19 Dec 2018 21:23:28 -0500 Received: from mga11.intel.com ([192.55.52.93]:38899 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726604AbeLTCX2 (ORCPT ); Wed, 19 Dec 2018 21:23:28 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2018 18:23:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,375,1539673200"; d="scan'208";a="127518574" Received: from phlsvsds.ph.intel.com ([10.228.164.149]) by fmsmga002.fm.intel.com with ESMTP; 19 Dec 2018 18:23:27 -0800 Received: from phlsvsds.ph.intel.com (localhost.localdomain [127.0.0.1]) by phlsvsds.ph.intel.com (8.13.8/8.13.8) with ESMTP id wBK2NIqs029580; Wed, 19 Dec 2018 21:23:18 -0500 Received: (from iweiny@localhost) by phlsvsds.ph.intel.com (8.13.8/8.13.8/Submit) id wBK2NHCW029577; Wed, 19 Dec 2018 21:23:17 -0500 X-Authentication-Warning: phlsvsds.ph.intel.com: iweiny set sender to ira.weiny@intel.com using -f From: ira.weiny@intel.com To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Steven Rostedt , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann , Ira Weiny Subject: [RDMA for-next v2 3/6] IB/MAD: Add agent trace points Date: Wed, 19 Dec 2018 21:22:42 -0500 Message-Id: <1545272565-29493-4-git-send-email-ira.weiny@intel.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1545272565-29493-1-git-send-email-ira.weiny@intel.com> References: <1545074124-18185-1-git-send-email-ira.weiny@intel.com> <1545272565-29493-1-git-send-email-ira.weiny@intel.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ira Weiny Trace agent details when agents are [un]registered. In addition, report agent details on send/recv. Signed-off-by: Ira Weiny --- drivers/infiniband/core/mad.c | 4 ++++ include/trace/events/ib_mad.h | 44 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 880a23811923..2b967766d5b7 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -490,6 +490,7 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, } spin_unlock_irq(&port_priv->reg_lock); + trace_ib_mad_create_agent(mad_agent_priv); return &mad_agent_priv->agent; error6: spin_unlock_irq(&port_priv->reg_lock); @@ -647,6 +648,7 @@ static void unregister_mad_agent(struct ib_mad_agent_private *mad_agent_priv) struct ib_mad_port_private *port_priv; /* Note that we could still be handling received MADs */ + trace_ib_mad_unregister_agent(mad_agent_priv); /* * Canceling all sends results in dropping received response @@ -2397,6 +2399,7 @@ static void ib_mad_recv_done(struct ib_cq *cq, struct ib_wc *wc) mad_agent = find_mad_agent(port_priv, (const struct ib_mad_hdr *)recv->mad); if (mad_agent) { + trace_ib_mad_recv_done_agent(mad_agent); ib_mad_complete_recv(mad_agent, &recv->header.recv_wc); /* * recv is freed up in error cases in ib_mad_complete_recv @@ -2561,6 +2564,7 @@ static void ib_mad_send_done(struct ib_cq *cq, struct ib_wc *wc) send_queue = mad_list->mad_queue; qp_info = send_queue->qp_info; + trace_ib_mad_send_done_agent(mad_send_wr->mad_agent_priv); trace_ib_mad_send_done_handler(mad_send_wr, wc); retry: diff --git a/include/trace/events/ib_mad.h b/include/trace/events/ib_mad.h index 95a78732e643..c03bd44c6e4b 100644 --- a/include/trace/events/ib_mad.h +++ b/include/trace/events/ib_mad.h @@ -251,6 +251,50 @@ ) ); +DECLARE_EVENT_CLASS(ib_mad_agent_template, + TP_PROTO(struct ib_mad_agent_private *agent), + TP_ARGS(agent), + + TP_STRUCT__entry( + __array(char, dev_name, IB_DEVICE_NAME_MAX) + __field(u8, port_num) + __field(u32, hi_tid) + __field(u8, mgmt_class) + __field(u8, mgmt_class_version) + ), + + TP_fast_assign( + memcpy(__entry->dev_name, agent->agent.device->name, IB_DEVICE_NAME_MAX); + __entry->port_num = agent->agent.port_num; + __entry->hi_tid = agent->agent.hi_tid; + + if (agent->reg_req) { + __entry->mgmt_class = agent->reg_req->mgmt_class; + __entry->mgmt_class_version = agent->reg_req->mgmt_class_version; + } else { + __entry->mgmt_class = 0; + __entry->mgmt_class_version = 0; + } + ), + + TP_printk("%s:%d mad agent : hi_tid 0x%08x class 0x%02x class_ver 0x%02x", + __entry->dev_name, __entry->port_num, + __entry->hi_tid, __entry->mgmt_class, __entry->mgmt_class_version + ) +); +DEFINE_EVENT(ib_mad_agent_template, ib_mad_recv_done_agent, + TP_PROTO(struct ib_mad_agent_private *agent), + TP_ARGS(agent)); +DEFINE_EVENT(ib_mad_agent_template, ib_mad_send_done_agent, + TP_PROTO(struct ib_mad_agent_private *agent), + TP_ARGS(agent)); +DEFINE_EVENT(ib_mad_agent_template, ib_mad_create_agent, + TP_PROTO(struct ib_mad_agent_private *agent), + TP_ARGS(agent)); +DEFINE_EVENT(ib_mad_agent_template, ib_mad_unregister_agent, + TP_PROTO(struct ib_mad_agent_private *agent), + TP_ARGS(agent)); + #endif /* _TRACE_IB_MAD_H */ From patchwork Thu Dec 20 02:22:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 10738489 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F2C26C5 for ; Thu, 20 Dec 2018 02:23:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D3CC2884F for ; Thu, 20 Dec 2018 02:23:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80EC228899; Thu, 20 Dec 2018 02:23:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D139C2884F for ; Thu, 20 Dec 2018 02:23:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730064AbeLTCXb (ORCPT ); Wed, 19 Dec 2018 21:23:31 -0500 Received: from mga05.intel.com ([192.55.52.43]:57150 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726604AbeLTCXb (ORCPT ); Wed, 19 Dec 2018 21:23:31 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2018 18:23:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,375,1539673200"; d="scan'208";a="108746899" Received: from phlsvsds.ph.intel.com ([10.228.164.149]) by fmsmga007.fm.intel.com with ESMTP; 19 Dec 2018 18:23:30 -0800 Received: from phlsvsds.ph.intel.com (localhost.localdomain [127.0.0.1]) by phlsvsds.ph.intel.com (8.13.8/8.13.8) with ESMTP id wBK2NLR1029586; Wed, 19 Dec 2018 21:23:21 -0500 Received: (from iweiny@localhost) by phlsvsds.ph.intel.com (8.13.8/8.13.8/Submit) id wBK2NKRJ029583; Wed, 19 Dec 2018 21:23:20 -0500 X-Authentication-Warning: phlsvsds.ph.intel.com: iweiny set sender to ira.weiny@intel.com using -f From: ira.weiny@intel.com To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Steven Rostedt , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann , Ira Weiny Subject: [RDMA for-next v2 4/6] IB/UMAD: Add umad trace points Date: Wed, 19 Dec 2018 21:22:43 -0500 Message-Id: <1545272565-29493-5-git-send-email-ira.weiny@intel.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1545272565-29493-1-git-send-email-ira.weiny@intel.com> References: <1545074124-18185-1-git-send-email-ira.weiny@intel.com> <1545272565-29493-1-git-send-email-ira.weiny@intel.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ira Weiny Trace MADs going to/from user space. Signed-off-by: Ira Weiny --- Changes from v1 Update MAINTAINERS file MAINTAINERS | 1 + drivers/infiniband/core/user_mad.c | 7 ++ include/trace/events/ib_umad.h | 140 +++++++++++++++++++++++++++++++++++++ 3 files changed, 148 insertions(+) create mode 100644 include/trace/events/ib_umad.h diff --git a/MAINTAINERS b/MAINTAINERS index 1d35dd8d3ce1..853840253c2c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7295,6 +7295,7 @@ F: include/uapi/linux/if_infiniband.h F: include/uapi/rdma/ F: include/rdma/ F: include/trace/events/ib_mad.h +F: include/trace/events/ib_umad.h INGENIC JZ4780 DMA Driver M: Zubair Lutfullah Kakakhel diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index f55f48f6b272..1d2c6fb10951 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c @@ -130,6 +130,9 @@ struct ib_umad_packet { struct ib_user_mad mad; }; +#define CREATE_TRACE_POINTS +#include + static struct class *umad_class; static const dev_t base_umad_dev = MKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE); @@ -388,6 +391,8 @@ static ssize_t ib_umad_read(struct file *filp, char __user *buf, else ret = copy_send_mad(file, buf, packet, count); + trace_ib_umad_read(file, (struct ib_user_mad *)buf); + if (ret < 0) { /* Requeue packet */ mutex_lock(&file->mutex); @@ -505,6 +510,8 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf, mutex_lock(&file->mutex); + trace_ib_umad_write(file, &packet->mad); + agent = __get_agent(file, packet->mad.hdr.id); if (!agent) { ret = -EINVAL; diff --git a/include/trace/events/ib_umad.h b/include/trace/events/ib_umad.h new file mode 100644 index 000000000000..247802268d39 --- /dev/null +++ b/include/trace/events/ib_umad.h @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2018 Intel Corporation. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM ib_umad + +#if !defined(_TRACE_IB_UMAD_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_IB_UMAD_H + +#include + +DECLARE_EVENT_CLASS(ib_umad_template, + TP_PROTO(struct ib_umad_file *file, struct ib_user_mad *mad), + TP_ARGS(file, mad), + + TP_STRUCT__entry( + __array(char, dev_name, IB_DEVICE_NAME_MAX) + __field(u8, port_num) + + __field(u32, id) + __field(u32, status) + __field(u32, timeout_ms) + __field(u32, retires) + __field(u32, length) + __field(u32, qpn) + __field(u32, qkey) + __field(u16, lid) + __field(u8, sl) + __field(u8, path_bits) + __field(u8, grh_present) + __field(u8, gid_index) + __field(u8, hop_limit) + __field(u8, traffic_class) + __array(u8, gid, 16) + __field(u32, flow_label) + __field(u16, pkey_index) + + __field(u8, base_version) + __field(u8, mgmt_class) + __field(u8, class_version) + __field(u8, method) + __field(u16, mad_status) + __field(u16, class_specific) + __field(u64, tid) + __field(u16, attr_id) + __field(u32, attr_mod) + ), + + TP_fast_assign( + memcpy(__entry->dev_name, file->port->ib_dev->name, IB_DEVICE_NAME_MAX); + __entry->port_num = file->port->port_num; + + __entry->id = mad->hdr.id; + __entry->status = mad->hdr.status; + __entry->timeout_ms = mad->hdr.timeout_ms; + __entry->retires = mad->hdr.retries; + __entry->length = mad->hdr.length; + __entry->qpn = mad->hdr.qpn; + __entry->qkey = mad->hdr.qkey; + __entry->lid = mad->hdr.lid; + __entry->sl = mad->hdr.sl; + __entry->path_bits = mad->hdr.path_bits; + __entry->grh_present = mad->hdr.grh_present; + __entry->gid_index = mad->hdr.gid_index; + __entry->hop_limit = mad->hdr.hop_limit; + __entry->traffic_class = mad->hdr.traffic_class; + memcpy(__entry->gid, mad->hdr.gid, sizeof(mad->hdr.gid)); + __entry->flow_label = mad->hdr.flow_label; + __entry->pkey_index = mad->hdr.pkey_index; + + __entry->base_version = ((struct ib_mad_hdr *)mad->data)->base_version; + __entry->mgmt_class = ((struct ib_mad_hdr *)mad->data)->mgmt_class; + __entry->class_version = ((struct ib_mad_hdr *)mad->data)->class_version; + __entry->method = ((struct ib_mad_hdr *)mad->data)->method; + __entry->mad_status = ((struct ib_mad_hdr *)mad->data)->status; + __entry->class_specific = ((struct ib_mad_hdr *)mad->data)->class_specific; + __entry->tid = ((struct ib_mad_hdr *)mad->data)->tid; + __entry->attr_id = ((struct ib_mad_hdr *)mad->data)->attr_id; + __entry->attr_mod = ((struct ib_mad_hdr *)mad->data)->attr_mod; + ), + + TP_printk("%s:%d umad_hdr: id 0x%08x status 0x%08x ms %u ret %u len %u QP%u " \ + "qkey 0x%08x lid 0x%04x sl %u path_bits 0x%x grh 0x%x gidi %u " \ + "hop_lim %u traf_cl %u gid %pI6c flow 0x%08x pkeyi %u " \ + "MAD: base_ver 0x%x class 0x%x class_ver 0x%x method 0x%x " \ + "status 0x%04x class_specific 0x%04x tid 0x%016llx attr_id 0x%04x attr_mod 0x%08x ", + __entry->dev_name, __entry->port_num, + __entry->id, __entry->status, __entry->timeout_ms, + __entry->retires, __entry->length, be32_to_cpu(__entry->qpn), + be32_to_cpu(__entry->qkey), be16_to_cpu(__entry->lid), __entry->sl, + __entry->path_bits, __entry->grh_present, __entry->gid_index, + __entry->hop_limit, __entry->traffic_class, &__entry->gid, + be32_to_cpu(__entry->flow_label), __entry->pkey_index, + __entry->base_version, __entry->mgmt_class, __entry->class_version, + __entry->method, be16_to_cpu(__entry->mad_status), be16_to_cpu(__entry->class_specific), + be64_to_cpu(__entry->tid), be16_to_cpu(__entry->attr_id), be32_to_cpu(__entry->attr_mod) + ) +); + +DEFINE_EVENT(ib_umad_template, ib_umad_write, + TP_PROTO(struct ib_umad_file *file, struct ib_user_mad *mad), + TP_ARGS(file, mad)); + +DEFINE_EVENT(ib_umad_template, ib_umad_read, + TP_PROTO(struct ib_umad_file *file, struct ib_user_mad *mad), + TP_ARGS(file, mad)); + +#endif /* _TRACE_IB_UMAD_H */ + +#include From patchwork Thu Dec 20 02:22:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 10738491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC9C813B5 for ; Thu, 20 Dec 2018 02:23:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA8762884F for ; Thu, 20 Dec 2018 02:23:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE97528899; Thu, 20 Dec 2018 02:23:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41B452884F for ; Thu, 20 Dec 2018 02:23:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730065AbeLTCXf (ORCPT ); Wed, 19 Dec 2018 21:23:35 -0500 Received: from mga17.intel.com ([192.55.52.151]:40255 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726604AbeLTCXe (ORCPT ); Wed, 19 Dec 2018 21:23:34 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2018 18:23:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,375,1539673200"; d="scan'208";a="129330921" Received: from phlsvsds.ph.intel.com ([10.228.164.149]) by fmsmga004.fm.intel.com with ESMTP; 19 Dec 2018 18:23:33 -0800 Received: from phlsvsds.ph.intel.com (localhost.localdomain [127.0.0.1]) by phlsvsds.ph.intel.com (8.13.8/8.13.8) with ESMTP id wBK2NOp1029592; Wed, 19 Dec 2018 21:23:25 -0500 Received: (from iweiny@localhost) by phlsvsds.ph.intel.com (8.13.8/8.13.8/Submit) id wBK2NOEF029589; Wed, 19 Dec 2018 21:23:24 -0500 X-Authentication-Warning: phlsvsds.ph.intel.com: iweiny set sender to ira.weiny@intel.com using -f From: ira.weiny@intel.com To: linux-rdma@vger.kernel.org Cc: Doug Ledford , Jason Gunthorpe , Steven Rostedt , Ingo Molnar , Alexei Starovoitov , Daniel Borkmann , Ira Weiny Subject: [RDMA for-next v2 5/6] IB/MAD: Add SMP details to MAD tracing Date: Wed, 19 Dec 2018 21:22:44 -0500 Message-Id: <1545272565-29493-6-git-send-email-ira.weiny@intel.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1545272565-29493-1-git-send-email-ira.weiny@intel.com> References: <1545074124-18185-1-git-send-email-ira.weiny@intel.com> <1545272565-29493-1-git-send-email-ira.weiny@intel.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ira Weiny Signed-off-by: Ira Weiny --- drivers/infiniband/core/mad.c | 8 ++++ include/trace/events/ib_mad.h | 90 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 2b967766d5b7..75c14cac83e5 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -868,6 +868,8 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, if (opa && smp->class_version == OPA_SM_CLASS_VERSION) { u32 opa_drslid; + trace_ib_mad_handle_out_opa_smi(opa_smp); + if ((opa_get_smp_direction(opa_smp) ? opa_smp->route.dr.dr_dlid : opa_smp->route.dr.dr_slid) == OPA_LID_PERMISSIVE && @@ -893,6 +895,8 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, opa_smi_check_local_returning_smp(opa_smp, device) == IB_SMI_DISCARD) goto out; } else { + trace_ib_mad_handle_out_ib_smi(smp); + if ((ib_get_smp_direction(smp) ? smp->dr_dlid : smp->dr_slid) == IB_LID_PERMISSIVE && smi_handle_dr_smp_send(smp, rdma_cap_ib_switch(device), port_num) == @@ -2132,6 +2136,8 @@ static enum smi_action handle_ib_smi(const struct ib_mad_port_private *port_priv enum smi_forward_action retsmi; struct ib_smp *smp = (struct ib_smp *)recv->mad; + trace_ib_mad_handle_ib_smi(smp); + if (smi_handle_dr_smp_recv(smp, rdma_cap_ib_switch(port_priv->device), port_num, @@ -2217,6 +2223,8 @@ static bool generate_unmatched_resp(const struct ib_mad_private *recv, enum smi_forward_action retsmi; struct opa_smp *smp = (struct opa_smp *)recv->mad; + trace_ib_mad_handle_opa_smi(smp); + if (opa_smi_handle_dr_smp_recv(smp, rdma_cap_ib_switch(port_priv->device), port_num, diff --git a/include/trace/events/ib_mad.h b/include/trace/events/ib_mad.h index c03bd44c6e4b..719a2f57e32d 100644 --- a/include/trace/events/ib_mad.h +++ b/include/trace/events/ib_mad.h @@ -296,6 +296,96 @@ TP_ARGS(agent)); + +DECLARE_EVENT_CLASS(ib_mad_opa_smi_template, + TP_PROTO(struct opa_smp *smp), + TP_ARGS(smp), + + TP_STRUCT__entry( + __field(u8, hop_ptr) + __field(u8, hop_cnt) + __field(u64, mkey) + __field(u32, dr_slid) + __field(u32, dr_dlid) + __array(u8, initial_path, OPA_SMP_MAX_PATH_HOPS) + __array(u8, return_path, OPA_SMP_MAX_PATH_HOPS) + ), + + TP_fast_assign( + __entry->hop_ptr = smp->hop_ptr; + __entry->hop_cnt = smp->hop_cnt; + __entry->mkey = smp->mkey; + __entry->dr_slid = smp->route.dr.dr_slid; + __entry->dr_dlid = smp->route.dr.dr_dlid; + memcpy(__entry->initial_path, smp->route.dr.initial_path, + OPA_SMP_MAX_PATH_HOPS); + memcpy(__entry->return_path, smp->route.dr.return_path, + OPA_SMP_MAX_PATH_HOPS); + ), + + TP_printk("OPA SMP: hop_ptr %d hop_cnt %d " \ + "mkey 0x%016llx dr_slid 0x%08x dr_dlid 0x%08x " \ + "initial_path %*ph return_path %*ph ", + __entry->hop_ptr, __entry->hop_cnt, + be64_to_cpu(__entry->mkey), be32_to_cpu(__entry->dr_slid), + be32_to_cpu(__entry->dr_dlid), + OPA_SMP_MAX_PATH_HOPS, __entry->initial_path, + OPA_SMP_MAX_PATH_HOPS, __entry->return_path + ) +); + +DEFINE_EVENT(ib_mad_opa_smi_template, ib_mad_handle_opa_smi, + TP_PROTO(struct opa_smp *smp), + TP_ARGS(smp)); +DEFINE_EVENT(ib_mad_opa_smi_template, ib_mad_handle_out_opa_smi, + TP_PROTO(struct opa_smp *smp), + TP_ARGS(smp)); + + +DECLARE_EVENT_CLASS(ib_mad_opa_ib_template, + TP_PROTO(struct ib_smp *smp), + TP_ARGS(smp), + + TP_STRUCT__entry( + __field(u8, hop_ptr) + __field(u8, hop_cnt) + __field(u64, mkey) + __field(u32, dr_slid) + __field(u32, dr_dlid) + __array(u8, initial_path, IB_SMP_MAX_PATH_HOPS) + __array(u8, return_path, IB_SMP_MAX_PATH_HOPS) + ), + + TP_fast_assign( + __entry->hop_ptr = smp->hop_ptr; + __entry->hop_cnt = smp->hop_cnt; + __entry->mkey = smp->mkey; + __entry->dr_slid = smp->dr_slid; + __entry->dr_dlid = smp->dr_dlid; + memcpy(__entry->initial_path, smp->initial_path, + IB_SMP_MAX_PATH_HOPS); + memcpy(__entry->return_path, smp->return_path, + IB_SMP_MAX_PATH_HOPS); + ), + + TP_printk("OPA SMP: hop_ptr %d hop_cnt %d " \ + "mkey 0x%016llx dr_slid 0x%04x dr_dlid 0x%04x " \ + "initial_path %*ph return_path %*ph ", + __entry->hop_ptr, __entry->hop_cnt, + be64_to_cpu(__entry->mkey), be16_to_cpu(__entry->dr_slid), + be16_to_cpu(__entry->dr_dlid), + IB_SMP_MAX_PATH_HOPS, __entry->initial_path, + IB_SMP_MAX_PATH_HOPS, __entry->return_path + ) +); + +DEFINE_EVENT(ib_mad_opa_ib_template, ib_mad_handle_ib_smi, + TP_PROTO(struct ib_smp *smp), + TP_ARGS(smp)); +DEFINE_EVENT(ib_mad_opa_ib_template, ib_mad_handle_out_ib_smi, + TP_PROTO(struct ib_smp *smp), + TP_ARGS(smp)); + #endif /* _TRACE_IB_MAD_H */ #include