From patchwork Mon Jul 9 15:50:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 141451 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2822175ljj; Mon, 9 Jul 2018 08:51:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfQLxDdNJDlYJQqfbrZ/NTbcbIHeGbskr9fQjh6L/P7zYMwBgvU6G5k/mo0BcP/5fCTe5ba X-Received: by 2002:a65:460e:: with SMTP id v14-v6mr18916420pgq.177.1531151480420; Mon, 09 Jul 2018 08:51:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531151480; cv=none; d=google.com; s=arc-20160816; b=LQTiA3TAWIUIDRegIdwlrLaPyq3XNGaUtcGYvVAAzIsTCIqCaThVvRxgyTtw4lKHSO /g383Lr/mZwERePnGoA7yimfZ9XBJzJOhdb05VW8SJ0ZX0fkIF7YjPqL5SlYUWtfgQ5K friLLLUxJqwZdKybvyV/qxN0u1MzqNXc0nmJRFGRfPcFfTD4HEFkjcir06YwN2cuk5yi pXtox8glC/GwU2RN2L058vtTNB/A/ECDm9p9zNv4pSBCoB8E59fLjFpRsEIXKwKQoBEQ V+DSyRElHZyVsWbfTLBFhZ13Pnwy1ZcFBNN3hxER4W7CeCsMBySRRfyX3rWk7fzzKPJr kBXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=2Z7eEmJHjemqKmc1XOzTB2TureY7MusYkWywxYsb/f0=; b=aVJcGqZzt1LG8uo2QJbE2rSefmhtKO40aT4GGwiEh6oYDC+reajwl86k44oIsLCeXe 5QpnPLHI99QDWE6swX45nfOiGJnRdyp/igWvUnu4gQKN2OtOkUXEF5uk+Xa1e2kvy+WF JUXgr0dZa2B6/WOYZoyadViEgI/FBvZkG3GFgoP0N6LRCayGlJChqh4yR4m20jnaKhHz 4/fY9CtANtelYh+C9qvO8pSfuM8+7TTEEROk4G5sGT+ufLoWj1OVYbIimXC/XuwuCdYd NkCC3Jbysz4xhOJ5BXJq+r0p1ZLI3CI//WG7vdn2UOQTOlWDu1hn67eCHFQMarcI112t GY0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="W2JsN3/X"; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 i18-v6si13977932pgn.433.2018.07.09.08.51.20; Mon, 09 Jul 2018 08:51:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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="W2JsN3/X"; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S933319AbeGIPvQ (ORCPT + 10 others); Mon, 9 Jul 2018 11:51:16 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42586 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933788AbeGIPvO (ORCPT ); Mon, 9 Jul 2018 11:51:14 -0400 Received: by mail-wr1-f67.google.com with SMTP id p1-v6so11508753wrs.9 for ; Mon, 09 Jul 2018 08:51:13 -0700 (PDT) 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; bh=2Z7eEmJHjemqKmc1XOzTB2TureY7MusYkWywxYsb/f0=; b=W2JsN3/Xr8bzOUPlv1X3kEKSz3Q8YMxgHmNzUagwj8xyPIlaLzWZlP5m4+pOhlKenX XyO6Qy989rqcP0zQanblLVLXZ/ULxbwoWKinalR65dEuZyZfEda3BZB4hwngPj23zJhT PoE20Blg3Rsp92OgX9Ixq9WgTvyzCQhwHjoKg= 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; bh=2Z7eEmJHjemqKmc1XOzTB2TureY7MusYkWywxYsb/f0=; b=HdiRhwdLN5WLhmNZDZYCm4QG4vsccpChoEVejI3CUW8WDgusJA6QWoFRNpxtijJMfz R8brnyHyyvWHTQ9NhadbggMDEJdHP5RgYEIpXUBBEpI/SLtp0B2Q2sSU5rXix/+Z5qxI TxvlS45Rx0NcC/ZDLlyKIoYwTYjUrGFhSyupSMckj1qiSOU/WBWm4ursmSLg0BaaLr59 I2KXsH8SQ/04ToH2Tox/jPdg3CecdbrqCAskbE4fxfHOuvzShbG153kvekPYuPSze/YT 0hDjTkFI//V7kff8a2LAzMuFlro+50RIp5iEFxS7EfVD0iO7LJQET2z9z/jLU4wa3tg5 DDuQ== X-Gm-Message-State: AOUpUlEEKxJ41lhegJfWBQL7nK4kX+59s5MZuLrrLO+xLDIevg0Lv1wI dy95iPHrYV2YljATP3nA/kng7uDrsmA= X-Received: by 2002:adf:b243:: with SMTP id y3-v6mr6937864wra.90.1531151472892; Mon, 09 Jul 2018 08:51:12 -0700 (PDT) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id o21-v6sm16229202wmg.28.2018.07.09.08.51.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Jul 2018 08:51:12 -0700 (PDT) From: Georgi Djakov To: linux-pm@vger.kernel.org, gregkh@linuxfoundation.org Cc: rjw@rjwysocki.net, robh+dt@kernel.org, mturquette@baylibre.com, khilman@baylibre.com, abailon@baylibre.com, vincent.guittot@linaro.org, skannan@codeaurora.org, bjorn.andersson@linaro.org, amit.kucheria@linaro.org, seansw@qti.qualcomm.com, daidavid1@codeaurora.org, evgreen@chromium.org, mka@chromium.org, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v6 3/8] interconnect: Add debugfs support Date: Mon, 9 Jul 2018 18:50:59 +0300 Message-Id: <20180709155104.25528-4-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180709155104.25528-1-georgi.djakov@linaro.org> References: <20180709155104.25528-1-georgi.djakov@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add a functionality to provide information about the current constraints per each node and provider. Signed-off-by: Georgi Djakov --- drivers/interconnect/core.c | 78 +++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index 63707c3c3d48..3f5001f51bb7 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -6,6 +6,7 @@ * Author: Georgi Djakov */ +#include #include #include #include @@ -15,10 +16,12 @@ #include #include #include +#include static DEFINE_IDR(icc_idr); static LIST_HEAD(icc_provider_list); static DEFINE_MUTEX(icc_lock); +static struct dentry *icc_debugfs_dir; /** * struct icc_req - constraints that are attached to each node @@ -47,6 +50,81 @@ struct icc_path { struct icc_req reqs[]; }; +#ifdef CONFIG_DEBUG_FS + +static void icc_summary_show_one(struct seq_file *s, struct icc_node *n) +{ + if (!n) + return; + + seq_printf(s, "%-30s %12d %12d\n", + n->name, n->avg_bw, n->peak_bw); +} + +static int icc_summary_show(struct seq_file *s, void *data) +{ + struct icc_provider *provider; + + seq_puts(s, " node avg peak\n"); + seq_puts(s, "--------------------------------------------------------\n"); + + mutex_lock(&icc_lock); + + list_for_each_entry(provider, &icc_provider_list, provider_list) { + struct icc_node *n; + + list_for_each_entry(n, &provider->nodes, node_list) { + struct icc_req *r; + + icc_summary_show_one(s, n); + hlist_for_each_entry(r, &n->req_list, req_node) { + if (!r->dev) + continue; + + seq_printf(s, " %-26s %12d %12d\n", + dev_name(r->dev), r->avg_bw, + r->peak_bw); + } + } + } + + mutex_unlock(&icc_lock); + + return 0; +} + +static int icc_summary_open(struct inode *inode, struct file *file) +{ + return single_open(file, icc_summary_show, inode->i_private); +} + +static const struct file_operations icc_summary_fops = { + .open = icc_summary_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int __init icc_debugfs_init(void) +{ + struct dentry *file; + + icc_debugfs_dir = debugfs_create_dir("interconnect", NULL); + if (!icc_debugfs_dir) { + pr_err("interconnect: error creating debugfs directory\n"); + return -ENODEV; + } + + file = debugfs_create_file("interconnect_summary", 0444, + icc_debugfs_dir, NULL, &icc_summary_fops); + if (!file) + return -ENODEV; + + return 0; +} +late_initcall(icc_debugfs_init); +#endif + static struct icc_node *node_find(const int id) { return idr_find(&icc_idr, id);