Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1519362imu; Wed, 16 Jan 2019 21:57:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN5EgF9ufHJW3ss0AYUPH9xUKxX4c1hppX8E3NjN7/5ecbwHgGonjPAlkraS6aIyk/p2NN1j X-Received: by 2002:a17:902:f082:: with SMTP id go2mr13678610plb.115.1547704629336; Wed, 16 Jan 2019 21:57:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547704629; cv=none; d=google.com; s=arc-20160816; b=L2ZiSq5z4xUBxTBzLrLh8aUzjByxc2YXgg/adqzImisiW12oyAelOC1TWqs3J0fNb/ coBjQ7JD9QS//SVlvs/qsAaV/rlBUzXEm5tuJuciaZGDZMbpiRsxF8vHBe2VSvjfLHQy TRD38DWP5ZaAkU9cIYCSIGBYtPhW685WrLQpAxiYvf2oWWMdYeNZdz+YGNhNlaWgFl/B vt7OEwR3MyBuIdMQncdo7OBI+V0CIyZfvWmTDzQSBddmNFQu1Vai21qFl9ZtBzqPOOnw jJEMYrJE1/0vlC9haxmTspbAD4TGdAsy4HKxdx/nZGxPjAceR85kydkt9y7Sk6enBTEq Mp7g== 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=Dv+pY3mbEG8oP8SFilyrA7S//jhmEn3muBmKLb21XKY=; b=dKC2dB/sbsJP86MPQxGWc/f2kHtqX9gjNF75w3lahGqEuOHnKc8Vnu8sfMHRh9Sa7R yu3hP5SJou2AtNQIL6o/oEm6p8j4aIEtT9J7F5N7J5nmw24Sj25PBi0XvUNhVYhoTxRn PbjSh2emHPvtDqB3GK1UqGJMcsKxRwBwnGvupHpPOtgcZHxCgxAzc8vHwKCkfTrhionR KfJEZtK91Z60B5xjW4iTqs/c4NPz3zH7HwA/uLZcbxQkvE2k5U2icHkCBE3Z5lBRawS0 Tu/krbFGMuMpNamWh8fs+KSjU5yzzAJopKCWtDXOgG3HoLWa+vNy92XQW0KxDyVijHng YvSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=V10Xf+8K; 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 j11si762727plb.253.2019.01.16.21.56.52; Wed, 16 Jan 2019 21:57:09 -0800 (PST) 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=V10Xf+8K; 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 S2405223AbfAPQLU (ORCPT + 99 others); Wed, 16 Jan 2019 11:11:20 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:55590 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405202AbfAPQLR (ORCPT ); Wed, 16 Jan 2019 11:11:17 -0500 Received: by mail-wm1-f66.google.com with SMTP id y139so2553938wmc.5 for ; Wed, 16 Jan 2019 08:11:16 -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=Dv+pY3mbEG8oP8SFilyrA7S//jhmEn3muBmKLb21XKY=; b=V10Xf+8KYu71ENB3vcyeUopKffaiT51jsBZls2odIK7kw5Y8dIv56eEAIIzjrybAG9 vOgyOzqCglBya7XcA5m26ckA+YRM8MIN8UR9CLyKXGpXBh5uk+7p6kHk9YnaSWxWkhgL lJQBJasKTLzQilSE9BGczPMWfLMcj/TDvjvnM= 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=Dv+pY3mbEG8oP8SFilyrA7S//jhmEn3muBmKLb21XKY=; b=QdPKII8sruX+xE+s6SRX0KO35k9cfx/AdlVFY7fP1p5+eBHAUcZJW+Evn6oD1FSCvg JFmRjRo4lQrowzZAv+SIt5LoIRK3Two7d5QjucFQwJDCL4Gl1K0p/fXx5IKRBQBolStK CylzArWtj6cnS01RB4R601k/FmgAYYH06iUHK66F25C7I+oorXE7UEXn8ow+ZqJMXYZb s6xgEZJ1/7MUDDYRx0UqumMgNlERxA8fOl2LV2uyrK3Be7+klnW4sNQm3JbHG66+gt1D Iyy5/BexbqPiwDKv4Oa5LINepSG6Iy4hzUMDocu/gNsn2iyhpzsR1+XOiCBRcsLFyCSo 3h1A== X-Gm-Message-State: AJcUuke7wHnLC6d4TaBvK3/Vkvu9sn4KnZim/yZ/KUlVF00/p0iHTnFM /yAiymx7EOVg/g6zk2nnfHloNg== X-Received: by 2002:a1c:a8d2:: with SMTP id r201mr7887736wme.81.1547655076200; Wed, 16 Jan 2019 08:11:16 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id a17sm78193407wrs.58.2019.01.16.08.11.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Jan 2019 08:11:15 -0800 (PST) From: Georgi Djakov To: gregkh@linuxfoundation.org Cc: andy.gross@linaro.org, olof@lixom.net, arnd@arndb.de, 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, dianders@chromium.org, abailon@baylibre.com, maxime.ripard@bootlin.com, thierry.reding@gmail.com, ksitaraman@nvidia.com, sanjayc@nvidia.com, henryc.chen@mediatek.com, linux-pm@vger.kernel.org, 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, linux-mediatek@lists.infradead.org, georgi.djakov@linaro.org Subject: [PATCH v13 4/8] interconnect: Add debugfs support Date: Wed, 16 Jan 2019 18:10:59 +0200 Message-Id: <20190116161103.6937-5-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190116161103.6937-1-georgi.djakov@linaro.org> References: <20190116161103.6937-1-georgi.djakov@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. Reviewed-by: Evan Green Signed-off-by: Georgi Djakov --- drivers/interconnect/core.c | 70 +++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index a8c2bd35197f..8091d998549a 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -6,6 +6,7 @@ * Author: Georgi Djakov */ +#include #include #include #include @@ -21,6 +22,7 @@ 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 +50,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); @@ -711,6 +766,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 "); MODULE_DESCRIPTION("Interconnect Driver Core"); MODULE_LICENSE("GPL v2");