From patchwork Tue Nov 27 18:03:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 10701273 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6037314BD for ; Tue, 27 Nov 2018 18:04:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 544E12C789 for ; Tue, 27 Nov 2018 18:04:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 480CF2C7AB; Tue, 27 Nov 2018 18:04:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEA9A2C794 for ; Tue, 27 Nov 2018 18:04:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727181AbeK1FCn (ORCPT ); Wed, 28 Nov 2018 00:02:43 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:52831 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728898AbeK1FCn (ORCPT ); Wed, 28 Nov 2018 00:02:43 -0500 Received: by mail-wm1-f67.google.com with SMTP id r11-v6so22705688wmb.2 for ; Tue, 27 Nov 2018 10:04:00 -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=UkMXTuwZqeV/O07hI4I9fDkAqqzo6frS5YB6zw60kWU=; b=hpw42Jmy5OGTUCFkcIx8yaAzh3EfjJpwAwi2673rsIabw4tpC4PNQSWtWsaQTQu9et 031oQYBXlzjHPJ3Xu5ZphC/KCSYFHx6qF6NIFivkAgvysp8/0wxA7W3x2T2FRvYva2VO 1QMq6TN+nBnfDiMVu+T15SwCXUEQ9+XJ7SDpw= 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=UkMXTuwZqeV/O07hI4I9fDkAqqzo6frS5YB6zw60kWU=; b=B0UEmzGGnc0jMNwfdKVaHsX4348VJTErMzbthObpPGrDF8m5Zg0tvPV+ytrI7PIgSr 7Ww5ivxq1DXRA3Rlj65qqUuEusBQFX5qExVxVcbYBJaXAlK+4lAiaCgHcQxtK0/daIwu xWK6Uf+pqXehHFk8UX1XdiJXShw/Ciwl9bH2vRzndltUfOwzptNR/8IpT9r8cvYO3UM1 epCok18kJZbr6L0sRWalGIS6pq2cpjzsM9wW+Qn97l2vnYm5IxroCdp7EhDMm/WkdpRA xEwHAt2+0QrVwo9ajo3mMfc6FcYfpo6yN/g3A3mYhlWad1ZztnV2DUJFNkLztJOz3n/j c+/A== X-Gm-Message-State: AA+aEWZRrYlbmEKLnCFr2BGoMQCtY18X93L+knRSrJTnCmjdK5Tu25Td NuBUPZMbkABMQDwN9JKMOkvEEA== X-Google-Smtp-Source: AFSGD/WhwSa29qmb49jysP+xkYrMZwX0rSBHdoX7I1WTK2SvTFQ0tGiFPicVVltbM//m7ykux/ojfw== X-Received: by 2002:a1c:96ce:: with SMTP id y197mr10456598wmd.36.1543341839228; Tue, 27 Nov 2018 10:03:59 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id a17sm6459921wrs.58.2018.11.27.10.03.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Nov 2018 10:03:58 -0800 (PST) From: Georgi Djakov To: linux-pm@vger.kernel.org Cc: gregkh@linuxfoundation.org, 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, maxime.ripard@bootlin.com, arnd@arndb.de, thierry.reding@gmail.com, ksitaraman@nvidia.com, sanjayc@nvidia.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v10 4/7] interconnect: Add debugfs support Date: Tue, 27 Nov 2018 20:03:46 +0200 Message-Id: <20181127180349.29997-5-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181127180349.29997-1-georgi.djakov@linaro.org> References: <20181127180349.29997-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 X-Virus-Scanned: ClamAV using ClamSMTP Add a functionality to provide information about the current constraints per each node and provider. Signed-off-by: Georgi Djakov Reviewed-by: Evan Green --- drivers/interconnect/core.c | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index ebc42ef9fa46..efe39e8934cc 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -6,6 +6,7 @@ * Author: Georgi Djakov */ +#include #include #include #include @@ -17,10 +18,12 @@ #include #include #include +#include static DEFINE_IDR(icc_idr); static LIST_HEAD(icc_providers); static DEFINE_MUTEX(icc_lock); +static struct dentry *icc_debugfs_dir; /** * struct icc_req - constraints that are attached to each node @@ -48,6 +51,59 @@ struct icc_path { struct icc_req reqs[]; }; +static void icc_summary_show_one(struct seq_file *s, struct icc_node *n) +{ + if (!n) + return; + + seq_printf(s, "%-30s %12u %12u\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_providers, 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 %12u %12u\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 struct icc_node *node_find(const int id) { return idr_find(&icc_idr, id); @@ -720,6 +776,21 @@ int icc_provider_del(struct icc_provider *provider) } EXPORT_SYMBOL_GPL(icc_provider_del); +static int __init icc_init(void) +{ + icc_debugfs_dir = debugfs_create_dir("interconnect", NULL); + debugfs_create_file("interconnect_summary", 0444, + icc_debugfs_dir, NULL, &icc_summary_fops); + return 0; +} + +static void __exit icc_exit(void) +{ + debugfs_remove_recursive(icc_debugfs_dir); +} +module_init(icc_init); +module_exit(icc_exit); + MODULE_AUTHOR("Georgi Djakov