Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3700962pxb; Mon, 9 Nov 2020 19:38:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0LAL7/OIj2sbWhOSLW/cQZz31/J0cU67iI3h/SbIShsOUY3u8SOTSOmaWErc0WIEEUDRk X-Received: by 2002:a17:906:68d8:: with SMTP id y24mr19052298ejr.438.1604979534099; Mon, 09 Nov 2020 19:38:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604979534; cv=none; d=google.com; s=arc-20160816; b=lG/7Nu72UE0RH/p6n4AQ+ljJOZFe3DTB+CB8huPlj09ssEAdTomRvaRs6GeUffynsq lqqNk2EZbFMfsYfuopEFYMrhFUhzGilA/QfV0iad0JM/mofKd1uUVpk/JBAF83kIX4AX lJ9VRISKS2P6BS2zzrpEMAhwctJU7iZlttY96WIpxl/BiwpjAJX2+a29U4ocpyHyRIjC fFlA/VGJMBtjCnxDm58wfPlw93+VCJqgyi/kjDXEjAhBAxOQ0iRgfoC4neK907m8T9Qi V2bchHFpNQ+CMeYGXvgV06Uz0vkja/sXYsX/Gssop4Nu1Maop8WLqFXQtQxdjTv/zU81 3b6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fxbnx6fB8pa6ONyNTh9qdaa1sggi/dJNjnt3v+Nrh9I=; b=mKprzAuxkfTawj9DMiYtKJ252Fwo92jIgt4+Sj6g2n+f3jPFfgh7KVcaJKtcdXNpQR 3saS0ZC8N9sPJt/m6lBO5nxiL2wvsDYEaCgDdqaK1l6wUT2K2wlGloHJUze+/fxz1Nuf j6rtgYOlK7oNpzkJ1j3IaKBxUvR70aRCH4AunhGKSubLY26mdzAuqLoBBtCTUMd2kFvM HfzJziURrWWyFSTsgpPkOnEtPy9C89bNm4hA+1avUGlnm18tRwzi+Gf9Er3ZtPoUFlCy 5Aq+O1oYyGUmKbW5ihtSzNCLX7hxc286YLJPL5V+ZqI8cJ2FxWkPVoeHiLAzq9zX1uZG tzPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iI1Ti+tw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u26si5549646ejc.249.2020.11.09.19.38.31; Mon, 09 Nov 2020 19:38:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iI1Ti+tw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730684AbgKJDfu (ORCPT + 99 others); Mon, 9 Nov 2020 22:35:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729452AbgKJDft (ORCPT ); Mon, 9 Nov 2020 22:35:49 -0500 Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD5C3C0613CF for ; Mon, 9 Nov 2020 19:35:49 -0800 (PST) Received: by mail-ot1-x343.google.com with SMTP id i18so11234221ots.0 for ; Mon, 09 Nov 2020 19:35:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=fxbnx6fB8pa6ONyNTh9qdaa1sggi/dJNjnt3v+Nrh9I=; b=iI1Ti+twWOnzmRmblWhhRYQrQVRuajNGU7U+jAf9UL4xcfCvt7JI1oRQMLuNfUMBxX cwhgTiaLWlGsGJbIP0R0XhJI2bQc8TtOvL81YnqTigq7WHm+pahMnJxFm5hhVD2KnmG4 rKa/eVw2u7K06UGyOuMWtJgmOyLjbcjNCrw0Td2s6RQ+IrAL5q4e/Cdz45LkihRmZm3S RBsWaLwvsQ1d/ldUCOxUC+U3WQwIprAcXcHVPT4+RgSpZGTs3fCJLYhlWldmo3jCyaYU L4ne78CZHHMD9DT1AGyAs4dfi+bXWY/0/i9uahiqp7ePe5/xadO8AD7R9Rdh3HYwYopp s1zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=fxbnx6fB8pa6ONyNTh9qdaa1sggi/dJNjnt3v+Nrh9I=; b=eyReHUdDGOvjw5ITRfAmRJpvTGfMTcAjMcFyZWUg0RClC5JbQooDDNWQg8gUQbILS0 FjGhkWKf2m/VlN1Z0VSIu6rOTFVmMTDQclWhYxhiqKyESLISmLaI9LYLuteCpy182/yI Iq+VbX5C7KIacKutd+e59DsOGd5qWv0a4xm6Ed/GqXNPdttyVxNCsdkKa5cwDtV8/wpz 05AHwRMG/KfiL0HEvR98NJR+KvOuYe6POC+EZFZlUORdgbg55mY4rxdxbusOz1uPjt70 ywt5tFEByc/t7IxGCFQ2z/aK6JYqBYGW4aJD9raPYJv5199WjYgXDPhquqptyuIUAag0 uRBg== X-Gm-Message-State: AOAM532em7aMs8HHN3YXflUrhQdxSHdRXf0pEwCarGgc4cjld2HqETmY CukzBn3Z+GmSvoVGBI7Qxpo+GQ== X-Received: by 2002:a9d:6e82:: with SMTP id a2mr12551695otr.274.1604979349232; Mon, 09 Nov 2020 19:35:49 -0800 (PST) Received: from builder.lan (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id x25sm2923469oie.17.2020.11.09.19.35.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Nov 2020 19:35:48 -0800 (PST) Date: Mon, 9 Nov 2020 21:35:47 -0600 From: Bjorn Andersson To: Rishabh Bhatnagar Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, tsoni@codeaurora.org, psodagud@codeaurora.org, sidgup@codeaurora.org Subject: Re: [PATCH 1/2] soc: qcom: Add tracepoints to mdt loader Message-ID: <20201110033547.GD332990@builder.lan> References: <1604971241-29000-1-git-send-email-rishabhb@codeaurora.org> <1604971241-29000-2-git-send-email-rishabhb@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1604971241-29000-2-git-send-email-rishabhb@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 09 Nov 19:20 CST 2020, Rishabh Bhatnagar wrote: > Add trace events to the mdt loader driver. These events > can help us trace the region where we are loading the > segments and the time it takes to initialize the image > and setup the memory region. > > Signed-off-by: Rishabh Bhatnagar > --- > drivers/soc/qcom/mdt_loader.c | 8 ++++++ > include/trace/events/mdt_loader.h | 57 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 65 insertions(+) > create mode 100644 include/trace/events/mdt_loader.h > > diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c > index 24cd193..df69e23 100644 > --- a/drivers/soc/qcom/mdt_loader.c > +++ b/drivers/soc/qcom/mdt_loader.c > @@ -17,6 +17,9 @@ > #include > #include > > +#define CREATE_TRACE_POINTS > +#include > + > static bool mdt_phdr_valid(const struct elf32_phdr *phdr) > { > if (phdr->p_type != PT_LOAD) > @@ -169,6 +172,7 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, > goto out; > } > > + trace_memory_setup("pas_init_image", fw_name); I think it would be favourable if you pushed this into the PAS functions in the scm driver instead. > ret = qcom_scm_pas_init_image(pas_id, metadata, metadata_len); > > kfree(metadata); > @@ -196,8 +200,10 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, > > if (relocate) { > if (pas_init) { > + trace_memory_setup("pas_mem_setup", fw_name); > ret = qcom_scm_pas_mem_setup(pas_id, mem_phys, > max_addr - min_addr); > + > if (ret) { > dev_err(dev, "unable to setup relocation\n"); > goto out; > @@ -232,6 +238,8 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, > > ptr = mem_region + offset; > > + trace_regions(ptr, phdr->p_filesz, i); "regions" is a very generic name for a trace event, perhaps trace_qcom_mdt_load_segment() ? I think it would be quite useful with a trace event indicating which firmware mdt file (and what .bXX files) we're trying to load. PS. ptr is a virtual address, there's no point in tracing this - we're interested in "mem_reloc + offset". Regards, Bjorn > + > if (phdr->p_filesz && phdr->p_offset < fw->size) { > /* Firmware is large enough to be non-split */ > if (phdr->p_offset + phdr->p_filesz > fw->size) { > diff --git a/include/trace/events/mdt_loader.h b/include/trace/events/mdt_loader.h > new file mode 100644 > index 0000000..6299f65 > --- /dev/null > +++ b/include/trace/events/mdt_loader.h > @@ -0,0 +1,57 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +/* > + * Copyright (c) 2020, The Linux Foundation. All rights reserved. > + */ > + > +#undef TRACE_SYSTEM > +#define TRACE_SYSTEM mdt_loader > + > +#if !defined(_TRACE_MDT_LOADER_H) || defined(TRACE_HEADER_MULTI_READ) > +#define _TRACE_MDT_LOADER_H > + > +#include > +#include > + > +TRACE_EVENT(memory_setup, > + > + TP_PROTO(const char *event, char *fw_name), > + > + TP_ARGS(event, fw_name), > + > + TP_STRUCT__entry( > + __string(event, event) > + __string(fw_name, fw_name) > + ), > + > + TP_fast_assign( > + __assign_str(event, event); > + __assign_str(fw_name, fw_name); > + ), > + > + TP_printk("doing %s for %s", __get_str(event), __get_str(fw_name)) > +); > + > +TRACE_EVENT(regions, > + > + TP_PROTO(void *region_start, size_t region_size, int i), > + > + TP_ARGS(region_start, region_size, i), > + > + TP_STRUCT__entry( > + __field(void *, region_start) > + __field(size_t, region_size) > + __field(int, index) > + ), > + > + TP_fast_assign( > + __entry->region_start = region_start; > + __entry->region_size = region_size; > + __entry->index = i; > + ), > + > + TP_printk("segment %d: region start=%pK size=%zx", __entry->index, > + __entry->region_start, __entry->region_size) > +); > + > +#endif > +#include > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project >