From patchwork Thu Nov 28 14:18:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 180436 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp206193ile; Thu, 28 Nov 2019 06:18:28 -0800 (PST) X-Google-Smtp-Source: APXvYqzwRW782xdmDTsG3STmX6Ayw+hxbXxEgVJsOxfOr3R7CyZvx+/aEbfaJOgOHB4I1lpQgnGT X-Received: by 2002:a17:906:cca:: with SMTP id l10mr54893120ejh.161.1574950708423; Thu, 28 Nov 2019 06:18:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574950708; cv=none; d=google.com; s=arc-20160816; b=WkDbH3vuI0Zvkah9NkcjFNx+3ieMu4GlL9BHTYqneIVGRjJc8DvtihKQ4RGKqINTyJ OWjzLv5PCgj7A7nluSpa5h0pNhla6+Z2BmxJ88JjdVhUWk7qfICMJ51rW8MCaqUUayof eTbD4RgX9ArITtHtn9VBJeqAa4hQFu3qE5qeWUEbNFfpC44nAQJdqE4+kE/sHXVjGSFJ L+51SiQW9KQEZ8vdgYc7TlmVon+X32PPGtVTbFVRFhEzrw7XPnoTSCngegdcIm/PS9Cr 8vKoTcY93of8q1+WuIoTsPHmKXfyVhGHT9ebGjjACOKJmjDjf0SlA6A7jCGZVVP7CYJW XH5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JT/cyXM4c3hlhS/42ul0Bg6b/PSo9qW/fW/jL/8JN5I=; b=j3pFc27BecCJLVBAuCnniciRyPQyfQy/zNEuxmMeHz3k2axs8Ync/6cdx/0SjnL8Jo ylWH/32+bHnKfdXENrr+t9FOoc+9SSrMPUirACz2i7L14roWnKuN2enGX74DB3qS0QkE tZ4ueKqb+wQMg2rAmWXjA4sjzn6FWPYt5gp90isIDOQbXo16jfAfviyUJz3xm/5XjRez B5uefxxlyyQM3bbOBhvra/G9QP24OgV1Pc+hUSt3xi3rcJ1Kf0+UVDln5dn7j2IfD/2K /43MnNmEDycitgfoYBpkpGzJeu2bvpT+GpkXbF4OEhToDSnGuNALuOXnBXwz8Xbm25bt zNhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aBW4RYhY; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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. [209.132.180.67]) by mx.google.com with ESMTP id j38si17194118eda.384.2019.11.28.06.18.28; Thu, 28 Nov 2019 06:18:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aBW4RYhY; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1726722AbfK1OS1 (ORCPT + 15 others); Thu, 28 Nov 2019 09:18:27 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42145 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726227AbfK1OS0 (ORCPT ); Thu, 28 Nov 2019 09:18:26 -0500 Received: by mail-wr1-f67.google.com with SMTP id a15so31329214wrf.9 for ; Thu, 28 Nov 2019 06:18:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JT/cyXM4c3hlhS/42ul0Bg6b/PSo9qW/fW/jL/8JN5I=; b=aBW4RYhYozIkFwfWySiGzURoUK9gm0MvN+lR/Cel+fVCRq9AHk7CUDGMkIS89R3axU A2hDkR2Y3fkuG60BOe5DzK1Qnv2jNQ8ziyx8MRBjX1NicgfFIYbmUHlI3UKoeIJDyCxC Mw6q4RgeIqt0DHN03YALF2tnD/hYDDaHNccs1LgxIcY2KztA8IrK0meBV3r7KofbQuSi wnpUPgz9f2WYd1mjOa/1oDAAXEyOnmYIWkOD9BhkI2tl9ZjovrH2oAFhpHsHOuTVvkvZ YebdzA76BVW5RqTmgJ7qaTsII7a2hzcqc8t3cgTy7YYOzqw2oL9LtO9CwmEZ8ZDy4FLC gsMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JT/cyXM4c3hlhS/42ul0Bg6b/PSo9qW/fW/jL/8JN5I=; b=JYIeNyfaWi998I8HHCiKtkKSCavniAUL73kWEihQ6k3Cf9vheeOvuqO0qgJUAZeUc3 b4sCqtulhJdG2N1sMjMhp1PRggEAJfq23bUFWWUBdDI3sQYnj11sWfNvF3uPL1omLnKM oA+47PJRRQu0bbfRbPQVvy+yttYP1CLP7cuRzyfQXQNtLZk7uNeUxIkMK6nSsGfEgCeg uaYYiMryCzJ0rwxYPaPk3j8ioZflLoMziaVgxDxHUecCoz9IYr7jRICqRNtDSb2EkqG0 uSbyUMO3rB/PGlwr9m+gp89MUGfIbKj52OU600pFxN2I8PWOmi/bR9zzgAYDkCVB6mfP Jrrg== X-Gm-Message-State: APjAAAWlNIGdj5ZszPJ0NzgUZzMyxkedA11ECtUwEV7lkNS7HAgLnkpW UFJlbTD6VW6+Q6dakY3ykuRXAQ== X-Received: by 2002:a5d:6652:: with SMTP id f18mr6935257wrw.246.1574950704416; Thu, 28 Nov 2019 06:18:24 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id f6sm23947092wrr.15.2019.11.28.06.18.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Nov 2019 06:18:23 -0800 (PST) From: Georgi Djakov To: linux-pm@vger.kernel.org Cc: rostedt@goodmis.org, mingo@redhat.com, bjorn.andersson@linaro.org, vincent.guittot@linaro.org, daidavid1@codeaurora.org, okukatla@codeaurora.org, evgreen@chromium.org, mka@chromium.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v4 3/3] interconnect: Add basic tracepoints Date: Thu, 28 Nov 2019 16:18:18 +0200 Message-Id: <20191128141818.32168-4-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191128141818.32168-1-georgi.djakov@linaro.org> References: <20191128141818.32168-1-georgi.djakov@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The tracepoints can help with understanding the system behavior of a given interconnect path when the consumer drivers change their bandwidth demands. This might be interesting when we want to monitor the requested interconnect bandwidth for each client driver. The paths may share the same nodes and this will help to understand "who and when is requesting what". All this is useful for subsystem drivers developers and may also provide hints when optimizing the power and performance profile of the system. Reviewed-by: Steven Rostedt (VMware) Signed-off-by: Georgi Djakov --- drivers/interconnect/Makefile | 1 + drivers/interconnect/core.c | 7 +++ drivers/interconnect/trace.h | 88 +++++++++++++++++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 drivers/interconnect/trace.h Reviewed-by: Bjorn Andersson diff --git a/drivers/interconnect/Makefile b/drivers/interconnect/Makefile index 28f2ab0824d5..725029ae7a2c 100644 --- a/drivers/interconnect/Makefile +++ b/drivers/interconnect/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 +CFLAGS_core.o := -I$(src) icc-core-objs := core.o obj-$(CONFIG_INTERCONNECT) += icc-core.o diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index c9e16bc1331e..0e4852feb395 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -21,6 +21,9 @@ #include "internal.h" +#define CREATE_TRACE_POINTS +#include "trace.h" + static DEFINE_IDR(icc_idr); static LIST_HEAD(icc_providers); static DEFINE_MUTEX(icc_lock); @@ -435,6 +438,8 @@ int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw) /* aggregate requests for this node */ aggregate_requests(node); + + trace_icc_set_bw(path, node, i, avg_bw, peak_bw); } ret = apply_constraints(path); @@ -453,6 +458,8 @@ int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw) mutex_unlock(&icc_lock); + trace_icc_set_bw_end(path, ret); + return ret; } EXPORT_SYMBOL_GPL(icc_set_bw); diff --git a/drivers/interconnect/trace.h b/drivers/interconnect/trace.h new file mode 100644 index 000000000000..3d668ff566bf --- /dev/null +++ b/drivers/interconnect/trace.h @@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Interconnect framework tracepoints + * Copyright (c) 2019, Linaro Ltd. + * Author: Georgi Djakov + */ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM interconnect + +#if !defined(_TRACE_INTERCONNECT_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_INTERCONNECT_H + +#include +#include + +TRACE_EVENT(icc_set_bw, + + TP_PROTO(struct icc_path *p, struct icc_node *n, int i, + u32 avg_bw, u32 peak_bw), + + TP_ARGS(p, n, i, avg_bw, peak_bw), + + TP_STRUCT__entry( + __string(path_name, p->name) + __string(dev, dev_name(p->reqs[i].dev)) + __string(node_name, n->name) + __field(u32, avg_bw) + __field(u32, peak_bw) + __field(u32, node_avg_bw) + __field(u32, node_peak_bw) + ), + + TP_fast_assign( + __assign_str(path_name, p->name); + __assign_str(dev, dev_name(p->reqs[i].dev)); + __assign_str(node_name, n->name); + __entry->avg_bw = avg_bw; + __entry->peak_bw = peak_bw; + __entry->node_avg_bw = n->avg_bw; + __entry->node_peak_bw = n->peak_bw; + ), + + TP_printk("path=%s dev=%s node=%s avg_bw=%u peak_bw=%u agg_avg=%u agg_peak=%u", + __get_str(path_name), + __get_str(dev), + __get_str(node_name), + __entry->avg_bw, + __entry->peak_bw, + __entry->node_avg_bw, + __entry->node_peak_bw) +); + +TRACE_EVENT(icc_set_bw_end, + + TP_PROTO(struct icc_path *p, int ret), + + TP_ARGS(p, ret), + + TP_STRUCT__entry( + __string(path_name, p->name) + __string(dev, dev_name(p->reqs[0].dev)) + __field(int, ret) + ), + + TP_fast_assign( + __assign_str(path_name, p->name); + __assign_str(dev, dev_name(p->reqs[0].dev)); + __entry->ret = ret; + ), + + TP_printk("path=%s dev=%s ret=%d", + __get_str(path_name), + __get_str(dev), + __entry->ret) +); + +#endif /* _TRACE_INTERCONNECT_H */ + +/* This part must be outside protection */ + +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH . + +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_FILE trace + +#include