From patchwork Fri Mar 9 21:09:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 131249 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1455503lja; Fri, 9 Mar 2018 13:10:12 -0800 (PST) X-Google-Smtp-Source: AG47ELvNL0fk34kh84HKUfvDDJjpdc1HQSBhaAAx0x2Pjz1OkDuE6vU3T98QBgGaMZuG7cIOTe1a X-Received: by 2002:a17:902:e65:: with SMTP id 92-v6mr28993143plw.268.1520629812722; Fri, 09 Mar 2018 13:10:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520629812; cv=none; d=google.com; s=arc-20160816; b=lCYSyvX6yaZ5AW0ox+fhmoKDdesQq4hGciR2XVDlt7hCa+bvaQT2DJRSHuvlTEJeq/ BuWIq/nTSJFBnoOsQ1xa5eAsakD6UjT2gEC9DA85NqE7PtzXATJ8y1YO7RoB/pE25m9y wtTONQ0vYnR8yozXrsb1jl1wFzX9wccqB8dMToYvR1CCzTFBE0fi/DZ2L8z4KSVB8Wjr Js4ugcpO7eRpEb+qhNxX25oQBjPNKWQdRD+ksNHZuxHPA5n5jfkm1sFIITRGc/cGzzoE 7QHdbvGo0faIUF9GhYljDDkW4AJQtfYHASzLACHr5ZSueY2p0wXbTwe8BXEROrFYrWEb h6hQ== 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=FjToud1To/Jn0KBnNNWoitZU5JVa+yb/E9xgoENcX2I=; b=Wv+Y/3HoE0Zt6vXW/+MZWWEnS5IX3A7tP5MdIqH+NYJ/4tT5JZDHsdUv0xxW8WHBrp 0bvDqfgTlxczEIKj8TNnPvX4FKU5P9f2pFvnHcQTbVDh4GQLe9RgZ/CmoD5l+oqUCX9l QJdvB0rgeSYZ4lkpe58Lb+WT1hvE2OUP7frzhOoZ1SPNLtP/8GDHbqcf0POD73pmmb2H Oef1VziG2cb2x257ekYa3bzVifxuquWu5esYhMB50e8fgNC87tFpgNt6GhpROYDb0vzr SN0pLmrKSLOIRd2i68wEkT2sjedMIe0BCxonqDENYwrz2DC1pWpXL7C3heTBROaoBCVu 3+8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ByBvWMEv; 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=fail (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 b7si1249058pgv.425.2018.03.09.13.10.12; Fri, 09 Mar 2018 13:10:12 -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=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ByBvWMEv; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932320AbeCIVKJ (ORCPT + 10 others); Fri, 9 Mar 2018 16:10:09 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:38232 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932580AbeCIVKH (ORCPT ); Fri, 9 Mar 2018 16:10:07 -0500 Received: by mail-wm0-f65.google.com with SMTP id z9so6158283wmb.3 for ; Fri, 09 Mar 2018 13:10:06 -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; bh=7dJ61Js48E3Ds72/6TrlMw7o9MrSnzRN7XqpAPjyplI=; b=ByBvWMEv6jkBaLBDCmQsqMpse+XK3F3FWzkpacS/p3TAg9YB38+NNKpojKHX/sQKwW GvC+KwEwGPLDwvkY88hmdghsZEI2wm1qKhhWpsNVnvPcjphFlwYjcReOnkPHz0za/JUT 2XboQ5s9IyP/CFSYM9KlkNaYWA5OLa+ep9VAs= 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=7dJ61Js48E3Ds72/6TrlMw7o9MrSnzRN7XqpAPjyplI=; b=YrJhU1KP1EzEmLv2FHJGsIUuRQqBZIWy5/D9OMAN7C1+x4C8bdwaKEEF4HdRJCoDv8 XrmVircoIWmYpPEaBHFYzZWZfdhxmnFggsFGgJTwFFniJjtMl6iabtXIDryNIFPcGbPD y0RL3NIRGcgVk7CZmw7iueaJam6uHhsukThdzws+JRoMMEqhECfRktrA2Cps1po+Jr8f ZgWRjJlG02O/LiI1+qhYysci/FH6m/MHUlac12jlj9z0ybftrlqpbz1RN/8RPhneXt5F GfjRt0IUsNFnjRmH5zK0515AnGHKzgVBQ+aaNFv0fL9Abrp6TAgCv8Mzcyzzy2MBJM9y axqg== X-Gm-Message-State: AElRT7E2VBbbg4tdEls07YXMc6MCiZwDpsTyxEqGBqPfgbmae7ZlTWpY bXToTK3p2SGxWFvZ8CngV5S41Q== X-Received: by 10.28.109.78 with SMTP id i75mr179107wmc.61.1520629806021; Fri, 09 Mar 2018 13:10:06 -0800 (PST) Received: from mms-0441.qualcomm.mm-sol.com ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id g7sm1853118wrb.78.2018.03.09.13.10.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 13:10:05 -0800 (PST) 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, vincent.guittot@linaro.org, skannan@codeaurora.org, bjorn.andersson@linaro.org, amit.kucheria@linaro.org, seansw@qti.qualcomm.com, davidai@quicinc.com, 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 v4 3/7] interconnect: Add debugfs support Date: Fri, 9 Mar 2018 23:09:54 +0200 Message-Id: <20180309210958.16672-4-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180309210958.16672-1-georgi.djakov@linaro.org> References: <20180309210958.16672-1-georgi.djakov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 | 70 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index 6306e258b9b9..a06f752a6aaa 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -6,6 +6,7 @@ * Author: Georgi Djakov */ +#include #include #include #include @@ -15,11 +16,13 @@ #include #include #include +#include static DEFINE_IDR(icc_idr); static LIST_HEAD(icc_provider_list); static DEFINE_MUTEX(icc_provider_list_mutex); static DEFINE_MUTEX(icc_path_mutex); +static struct dentry *icc_debugfs_dir; /** * struct icc_req - constraints that are attached to each node @@ -46,6 +49,73 @@ struct icc_path { struct icc_req reqs[0]; }; +#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_provider_list_mutex); + + list_for_each_entry(provider, &icc_provider_list, provider_list) { + struct icc_node *n; + + mutex_lock(&provider->lock); + list_for_each_entry(n, &provider->nodes, node_list) { + icc_summary_show_one(s, n); + } + mutex_unlock(&provider->lock); + } + + mutex_unlock(&icc_provider_list_mutex); + + 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) { struct icc_node *node;