From patchwork Wed Jun 20 12:11:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 139321 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp713120lji; Wed, 20 Jun 2018 05:13:35 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ0rg+bU270UZqjZpgnHbznvMWV8eToDPDQ/tVKnxKrJ4uCFZ2bfxuF6WjVpZQFgI5eCSrL X-Received: by 2002:a62:1282:: with SMTP id 2-v6mr3111124pfs.243.1529496815245; Wed, 20 Jun 2018 05:13:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529496815; cv=none; d=google.com; s=arc-20160816; b=HEWuCzZDXJVSYDj/ybpGuJghEmNK+kg6T3viiaxhGIzoauOpy8168fYzNPkYh9YyqN BOtMNoC8pGL0RTxPcPpo9rUDAps4M7CV38LUSXzJK43iTeuMAMgOauCMI5WVwEfulfYj jCRWD/vClCjqiidAQDGe7WdjNKq/026x9WQHkC3SJg/YvKg14yxSFIvDR7XGh9LwQiFQ KjLWE+fw4u07pnoh71N9DRYyCHu7bMvNwNzWWCTMCD5JCK7LvMH2ELg/siyP6DsTh2qf 4IpNE6ttfLZJq9AJchDnVmgq3CiEXPmHXzDsPIdMFgVtNGIKSBOucyKVXpD6Xyj24/GT yrbw== 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=mMiG6cM8VBvBAXZfGrxSfXokkjogyEYvlGb3JfwBdAo=; b=Txmc5B4nUY4H0NZnij4eB2Dov/5YR52keinF5I1iO7BjXwM0ZHsydRm6X4aJyKnrh/ nFAmYxzn6lwAGFpou0FwAeoRsb8g4iQ9Q52LVB+aYSqCPO3GPTocec8MkxX3+oUb24tA B/WR0j/ONxbrIUWQfrKbLTe+pjBp31VTlpPiE6LOIiuUQEdlWKQgSJnSSlQVzlZj1ByH qE0QtMiBrSqdGSvk0gxLxwQ6uoiTrcl8tWa1O6pENtiToxGzL/I6UQN7LEga8HuZxIBu Oy7fngVKh5sqUKY1WKnolV8GIoQePaizBI3avmOKbIGZaS7XRB0K4nHEglKgc8wOM9iw 9zUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=amUAOkXl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id r6-v6si1829821pgp.426.2018.06.20.05.13.34; Wed, 20 Jun 2018 05:13:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=amUAOkXl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1754186AbeFTMNc (ORCPT + 30 others); Wed, 20 Jun 2018 08:13:32 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:53856 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751337AbeFTMLu (ORCPT ); Wed, 20 Jun 2018 08:11:50 -0400 Received: by mail-wm0-f67.google.com with SMTP id x6-v6so5604190wmc.3 for ; Wed, 20 Jun 2018 05:11:50 -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=mMiG6cM8VBvBAXZfGrxSfXokkjogyEYvlGb3JfwBdAo=; b=amUAOkXlniCfXibXy+jGsZmSGD6ZETsVvMsqABtHU6TJaWv+cPaqVbZxo9klgmFDLO Cp/GmWzH3c9zDEhTrfpdQRwDYt1u3XG3ZEB7CDuFqjUnCvRrP+MJeajW24Rdrcln/DAP hNaTlvkEBBonTN9r0pWH0Wd5rhEEVIWlr1p98= 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=mMiG6cM8VBvBAXZfGrxSfXokkjogyEYvlGb3JfwBdAo=; b=r7InCvdRQrONNQgVHJ6X96CKTynW5H51a0uDAhBgiOCMmrIYv/87/XQEcxdtUsICRr WZDq09umcDx+5/MvtvamR3t7n1pbcVBg1lNLNZj5aOEDJehMAayT7tcvc50tYCPY8DdF B+X7JNaX9bYJPhnNMAakV4Dm4V05KxcUhZhhJaqB8/iXu1MC3ik53M2RHkVtOl2qoI5J E8yxUr3NPsI46qe0f9h7dU9oa3+kCdjiCK9j/TtpjrFQU9ZtVIT5qXDX0ncM/N37NJeI zrQroghvzVYXcF9ZqA/8lkG5F4hJM2Ut6lmh3b6qcjBIMYPk+w0U7oPqT0WbX4eRPkWU y/zA== X-Gm-Message-State: APt69E2f+NnJDMVqRP7PDxM01GIVKbqLgCPYzH25njhFJS0JLwdo0j5I 9PMQgCqgm7/U61qfWLlODEveKw== X-Received: by 2002:a1c:ea9b:: with SMTP id g27-v6mr1446987wmi.21.1529496709603; Wed, 20 Jun 2018 05:11:49 -0700 (PDT) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id e14-v6sm1656483wmh.17.2018.06.20.05.11.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Jun 2018 05:11:48 -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, 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, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, abailon@baylibre.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v5 3/8] interconnect: Add debugfs support Date: Wed, 20 Jun 2018 15:11:36 +0300 Message-Id: <20180620121141.15403-4-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180620121141.15403-1-georgi.djakov@linaro.org> References: <20180620121141.15403-1-georgi.djakov@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 e7f96fc6722e..dafc001ce758 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[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_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) { struct icc_node *node;