Browse Source

msm: ipa Add traces for latency measurement

Add traces for latency measurements
Add traces in ipa3_replenish_rx_page_recycle,
handle_page_completion, new qtimer trace to GSI IRQ.

Change-Id: Ie2f9bf5d61a23abded2bced86fd5e172e60cac8d
Acked-by: Abhishek Raghuvanshi <[email protected]>
Signed-off-by: Chaitanya Pratapa <[email protected]>
Signed-off-by: Jennifer Zenner <[email protected]>
Chaitanya Pratapa 3 years ago
parent
commit
ee9eb5478a

+ 20 - 0
drivers/platform/msm/gsi/gsi.c

@@ -26,6 +26,9 @@
 #include <linux/delay.h>
 #include <linux/version.h>
 
+#define CREATE_TRACE_POINTS
+#include "gsi_trace.h"
+
 #define GSI_CMD_TIMEOUT (5*HZ)
 #define GSI_FC_CMD_TIMEOUT (2*GSI_CMD_TIMEOUT)
 #define GSI_START_CMD_TIMEOUT_MS 1000
@@ -832,6 +835,15 @@ static void gsi_handle_ieob(int ee)
 			msk = gsihal_read_reg_nk(GSI_EE_n_CNTXT_SRC_IEOB_IRQ_MSK_k, ee, k);
 			gsihal_write_reg_nk(GSI_EE_n_CNTXT_SRC_IEOB_IRQ_CLR_k, ee, k, ch & msk);
 
+			if (trace_gsi_qtimer_enabled())
+			{
+				uint64_t qtimer = 0;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0))
+				qtimer = arch_timer_read_cntpct_el0();
+#endif
+				trace_gsi_qtimer(qtimer, false, 0, ch, msk);
+			}
+
 			for (i = 0; i < GSI_STTS_REG_BITS; i++) {
 				if ((1 << i) & ch & msk) {
 					evt_hdl = i + (GSI_STTS_REG_BITS * k);
@@ -1133,6 +1145,14 @@ static irqreturn_t gsi_msi_isr(int irq, void *ctxt)
 	evt = gsi_ctx->msi.evt[msi];
 	evt_ctxt = &gsi_ctx->evtr[evt];
 
+	if (trace_gsi_qtimer_enabled()) {
+		uint64_t qtimer = 0;
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0))
+		qtimer = arch_timer_read_cntpct_el0();
+#endif
+		trace_gsi_qtimer(qtimer, true, evt, 0, 0);
+	}
+
 	if (evt_ctxt->props.intf != GSI_EVT_CHTYPE_GPI_EV) {
 		GSIERR("Unexpected irq intf %d\n",
 			evt_ctxt->props.intf);

+ 56 - 0
drivers/platform/msm/gsi/gsi_trace.h

@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM gsi
+#define TRACE_INCLUDE_FILE gsi_trace
+
+#if !defined(_GSI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _GSI_TRACE_H
+
+#include <linux/tracepoint.h>
+
+
+TRACE_EVENT(
+	gsi_qtimer,
+
+	TP_PROTO(u64 qtimer, bool is_ll, uint8_t evt, uint32_t ch, uint32_t msk),
+
+	TP_ARGS(qtimer, is_ll, evt, ch, msk),
+
+	TP_STRUCT__entry(
+		__field(u64,		qtimer)
+		__field(bool,		is_ll)
+		__field(uint8_t,	evt)
+		__field(uint32_t,	ch)
+		__field(uint32_t,	msk)
+	),
+
+	TP_fast_assign(
+		__entry->qtimer = qtimer;
+		__entry->is_ll = is_ll;
+		__entry->evt = evt;
+		__entry->ch = ch;
+		__entry->msk = msk;
+	),
+
+	TP_printk("qtimer=%llu is_ll=%s, evt=%u, ch=0x%x, msk=0x%x",
+		__entry->qtimer,
+		__entry->is_ll ? "true" : "false",
+		__entry->evt,
+		__entry->ch,
+		__entry->msk)
+);
+
+#endif /* _GSI_TRACE_H */
+
+/* This part must be outside protection */
+#undef TRACE_INCLUDE_PATH
+#ifdef CONFIG_IPA_VENDOR_DLKM
+#define TRACE_INCLUDE_PATH ../../../../vendor/qcom/opensource/dataipa/drivers/platform/msm/gsi
+#else
+#define TRACE_INCLUDE_PATH ../../techpack/dataipa/drivers/platform/msm/gsi
+#endif
+#include <trace/define_trace.h>

+ 18 - 0
drivers/platform/msm/ipa/ipa_v3/ipa_dp.c

@@ -2697,6 +2697,11 @@ static void ipa3_replenish_rx_page_recycle(struct ipa3_sys_context *sys)
 		}
 		rx_pkt->sys = sys;
 
+		trace_ipa3_replenish_rx_page_recycle(
+			stats_i,
+			rx_pkt->page_data.page,
+			rx_pkt->page_data.is_tmp_alloc);
+
 		dma_sync_single_for_device(ipa3_ctx->pdev,
 			rx_pkt->page_data.dma_addr,
 			rx_pkt->len, DMA_FROM_DEVICE);
@@ -4349,6 +4354,10 @@ static struct sk_buff *handle_page_completion(struct gsi_chan_xfer_notify
 				rx_page.page, 0,
 				size,
 				PAGE_SIZE << rx_page.page_order);
+
+			trace_handle_page_completion(rx_page.page,
+				rx_skb, notify->bytes_xfered,
+				rx_page.is_tmp_alloc, sys->ep->client);
 		}
 	} else {
 		return NULL;
@@ -4416,6 +4425,10 @@ static void ipa3_rx_napi_chain(struct ipa3_sys_context *sys,
 					skb_shinfo(prev_skb)->frag_list =
 						rx_skb;
 
+				trace_ipa3_rx_napi_chain(first_skb,
+							 prev_skb,
+							 rx_skb);
+
 				prev_skb = rx_skb;
 			}
 		}
@@ -4463,6 +4476,11 @@ static void ipa3_rx_napi_chain(struct ipa3_sys_context *sys,
 							= rx_skb;
 
 					prev_skb = rx_skb;
+
+					trace_ipa3_rx_napi_chain(first_skb,
+								 prev_skb,
+								 rx_skb);
+
 				}
 			}
 			if (prev_skb) {

+ 84 - 0
drivers/platform/msm/ipa/ipa_v3/ipa_trace.h

@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #undef TRACE_SYSTEM
@@ -297,6 +298,89 @@ TRACE_EVENT(
 	TP_printk("client=%lu", __entry->client)
 );
 
+TRACE_EVENT(
+	ipa3_replenish_rx_page_recycle,
+
+	TP_PROTO(u32 i, struct page *p, bool is_tmp_alloc),
+
+	TP_ARGS(i, p, is_tmp_alloc),
+
+	TP_STRUCT__entry(
+		__field(u32, i)
+		__field(struct page *,	p)
+		__field(bool,		is_tmp_alloc)
+		__field(unsigned long,	pfn)
+	),
+
+	TP_fast_assign(
+		__entry->i = i;
+		__entry->p = p;
+		__entry->is_tmp_alloc = is_tmp_alloc;
+		__entry->pfn = page_to_pfn(p);
+	),
+
+	TP_printk("wan_cons type=%u: page=0x%pK pfn=0x%lx tmp=%s",
+		__entry->i, __entry->p, __entry->pfn,
+		__entry->is_tmp_alloc ? "true" : "false")
+);
+
+TRACE_EVENT(
+	handle_page_completion,
+
+	TP_PROTO(struct page *p, struct sk_buff *skb, u16 len,
+		 bool is_tmp_alloc, enum ipa_client_type client),
+
+	TP_ARGS(p, skb, len, is_tmp_alloc, client),
+
+	TP_STRUCT__entry(
+		__field(struct page *,		p)
+		__field(struct sk_buff *,	skb)
+		__field(u16,			len)
+		__field(bool,			is_tmp_alloc)
+		__field(unsigned long,		pfn)
+		__field(enum ipa_client_type,	client)
+	),
+
+	TP_fast_assign(
+		__entry->p = p;
+		__entry->skb = skb;
+		__entry->len = len;
+		__entry->is_tmp_alloc = is_tmp_alloc;
+		__entry->pfn = page_to_pfn(p);
+		__entry->client = client;
+	),
+
+	TP_printk("%s: page=0x%pK pfn=0x%lx skb=0x%pK len=%u tmp=%s",
+		(__entry->client == IPA_CLIENT_APPS_WAN_CONS) ? "WAN_CONS"
+							      : "WAN_COAL_CONS",
+		__entry->p, __entry->pfn, __entry->skb, __entry->len,
+		__entry->is_tmp_alloc ? "true" : "false")
+);
+
+TRACE_EVENT(
+	ipa3_rx_napi_chain,
+
+	TP_PROTO(struct sk_buff *first_skb, struct sk_buff *prev_skb,
+		 struct sk_buff *rx_skb),
+
+	TP_ARGS(first_skb, prev_skb, rx_skb),
+
+	TP_STRUCT__entry(
+		__field(struct sk_buff *,	first_skb)
+		__field(struct sk_buff *,	prev_skb)
+		__field(struct sk_buff *,	rx_skb)
+	),
+
+	TP_fast_assign(
+		__entry->first_skb = first_skb;
+		__entry->prev_skb = prev_skb;
+		__entry->rx_skb = rx_skb;
+	),
+
+	TP_printk("first_skb=0x%pK prev_skb=0x%pK rx_skb=0x%pK",
+		__entry->first_skb, __entry->prev_skb, __entry->rx_skb)
+);
+
 #endif /* _IPA_TRACE_H */
 
 /* This part must be outside protection */