From patchwork Sat Dec 8 17:02:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 153235 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1801574ljp; Sat, 8 Dec 2018 09:02:36 -0800 (PST) X-Google-Smtp-Source: AFSGD/VMP8pOfXGFr+Ps66JxcwdOZxLGhqH8th/d8edTtm90xuDM8aNx3shCYRL7gnkps3A0jwSH X-Received: by 2002:a62:8dd9:: with SMTP id p86mr6340220pfk.143.1544288556175; Sat, 08 Dec 2018 09:02:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544288556; cv=none; d=google.com; s=arc-20160816; b=KZGqjmnEcziHIdTUEf6xj/sMuEZnTC/5t08A9zjXybbo79evMeKfoOC4hqwSwvUsxF Tvy3rJSbjpx/v8KQBd9g47T1n1zBjCGjvbJs4L8J1efsgaDozTW973N5ZjbPMtH9pSKy fELCP7/NIVUn06yhkUGvbtJHFEJcIKs226evy3FU+PtWgWdM+dYveE0xLBFwViMo8A2Q SPeY93mi1WjCnIv7GesvWLZMz8Y3JIum1/R0VHASXFp6ZjM8eyNPMPotX+veDwipSdY7 b6EBd1HHk3QwqnpYMVHWazMPXdu/rw6iXE/9nxzd9uFJsWyggjiZ1Ie9V+k+BlfZPbXt dBrw== 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=C9WXnWBuhV6priAyhwQEr5olumbkswiCcUF+DIQmTjY=; b=Vl4h7lkYNnER7Q3QkVV2OuEstKTSHpxXYrAEBRt1cBoxwhmt35ZzLL0CQetmMuRgb4 PCtDODXhIkjuiFXPky3TjWtfti4WtmljywkHgRUeGp+u72kGdnQK/kENJyGmickqegEk opyVJPH0kN0cheheI3In1DbeI5FNbeW0UO8d+e7aGvtGe8oPaBVS0a9+2SkjU+LbaOBv BcLZWHtdypm0v8pq6ErMcaf8s+bCQcP86UAnYGPtSxEVTS4xYirPbXcA/YGl/1L81QP3 Vfm7YSH2q2i8LmKXhNobBTS1p60Z8DcICLq7KnapxUpKa5GdczZIXrxoT9dqsI22JkUF rVWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NCvtVu9M; 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 w11si5572262plz.327.2018.12.08.09.02.35; Sat, 08 Dec 2018 09:02:36 -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=NCvtVu9M; 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 S1726277AbeLHRCd (ORCPT + 31 others); Sat, 8 Dec 2018 12:02:33 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33152 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726239AbeLHRCa (ORCPT ); Sat, 8 Dec 2018 12:02:30 -0500 Received: by mail-wm1-f65.google.com with SMTP id r24so3453527wmh.0 for ; Sat, 08 Dec 2018 09:02:28 -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=C9WXnWBuhV6priAyhwQEr5olumbkswiCcUF+DIQmTjY=; b=NCvtVu9M6ziHrmVHuiuSufksAuT8GyMS29AwqsfHsRrjMV0mCdU8B6tPBre1d9LPI2 5A0/Nn6W6ASYyBqS1Hh1Vjyl8jqo2O3a4mRcJtRAD5ryiFckIdWRrDLQGFJDFc4MurCm uiiMWK5pk0hCaOEvR5EMnf4yCAjAWJqA4fl/g= 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=C9WXnWBuhV6priAyhwQEr5olumbkswiCcUF+DIQmTjY=; b=KaF9FaTEi3XuBicaV7ZtTpv3wLVI7MZWY6UT2M4fnv/u38b1EpMTWxwgJ9S2ZHDolI s3fs/ugQi+FJbSwokx8VeXSvesw5LT4wfmn4cfLEXhUImLfuabfYAcCzJg5by+R7OBlS vBGeZ/pvR42JWWYPIzPfW8dLGtVaWU4WlwerqLrff6c0mC5MNMmXQ8j2XsBloUgc4vpv U56BD6jAgV6QEXAM/3Y5g8imId80gxBsQK610tLR2Po0L1kTDxJUMEOzlvKUwxe23auq ygtQhMLXcDfp9ldQE/S5tLGYcmppEy6jJy81BmttO/YkpwQ34p2AoFkMb+KSyBAOg/Ko ACOQ== X-Gm-Message-State: AA+aEWbla3zgm6s5UucV+Sfa3r7jXUz5qAU3ZwH/vmj9Wd8DS1u3IWGW I6Ge9hL9pPWy1ChXisFWWNVjOA== X-Received: by 2002:a1c:f112:: with SMTP id p18mr5206530wmh.83.1544288547644; Sat, 08 Dec 2018 09:02:27 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id l20sm17411344wrb.93.2018.12.08.09.02.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 08 Dec 2018 09:02:26 -0800 (PST) From: Georgi Djakov To: gregkh@linuxfoundation.org, andy.gross@linaro.org, olof@lixom.net, arnd@arndb.de, linux-pm@vger.kernel.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, dianders@chromium.org, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, abailon@baylibre.com, maxime.ripard@bootlin.com, 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 v12 4/7] interconnect: Add debugfs support Date: Sat, 8 Dec 2018 19:02:13 +0200 Message-Id: <20181208170216.32555-5-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181208170216.32555-1-georgi.djakov@linaro.org> References: <20181208170216.32555-1-georgi.djakov@linaro.org> MIME-Version: 1.0 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 | 71 +++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index d1854dfb1bed..5a98192e92ad 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); @@ -711,6 +767,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");