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: 152152 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp83020ljp; Tue, 27 Nov 2018 10:04:43 -0800 (PST) X-Google-Smtp-Source: AFSGD/XBwDMgkcvttKFkC02Ll48sLSWj0bo5ppK3mTPLlLK5AkZls8zkk3ZIIovQUFvhD/VPtfqQ X-Received: by 2002:a63:1c61:: with SMTP id c33mr29357800pgm.354.1543341883021; Tue, 27 Nov 2018 10:04:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543341883; cv=none; d=google.com; s=arc-20160816; b=ejIlW+TgJFXXRwcOmTmKbnEHhKQxp9tMzkLiMW2JNP7+Q75aO8K8bzAIJRqcYS8qzO ZrX4C/RcC5xuYMns8xSkx1VuR3n4u+GNiVy7lgQk24UpFL9mUyBkre5IZfw3/ZfaygtA Tz4bIJCL3lca+mp7VI/hNZAZ4WWp7spjmCBDseq2tRtg3Vbglafyt9qF93zjdFFDOovv cnxTASm0bqRy06BdlzS4rsW1Cn3RTuKCm/XQJhAsxmDmte1i8gpJf7bWTUNoAnDKCNk+ Glvxw/Bjb0i0cDXDsdQlJV3MxSyk+icBR2SMNNM+DTHa9NmBhBBFBm3IPQKw+pv+WOAD HM8g== 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=UkMXTuwZqeV/O07hI4I9fDkAqqzo6frS5YB6zw60kWU=; b=IvcLAj7LjqPQnGHipFLLGDbQGq0Se2h+uGcQLzoP8FPzh/TMlQAU3IHJfIVkHLOEEp Dk2R1WhCodnpoPREzDCigGyHkgp/Kvf1ffwjgXLjVy9dFx0bRWsiG/j8WZAl968flSWu dqKdh0XaWn++0gvKOfSSY8TD849CtJrj0mUTeY4x+CiXD337AoCvEaZCvH5ZkVt7LcqO irMnXj0EHVMH8JfxOvcG5OY0edFLkXe+EOP1RNwvZ7VdgY2qy8IDmspVRzM2hv7xUr78 RMeoit09m4SVdw0Wn5W2U/s/3YGgdS5NbNqZjBbJHjmzzOP2q7hZOZADsf9Kptn6CzoQ VsdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hpw42Jmy; 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 v61-v6si4562187plb.191.2018.11.27.10.04.26; Tue, 27 Nov 2018 10:04:43 -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=hpw42Jmy; 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 S1732038AbeK1FCn (ORCPT + 32 others); Wed, 28 Nov 2018 00:02:43 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:56153 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728888AbeK1FCn (ORCPT ); Wed, 28 Nov 2018 00:02:43 -0500 Received: by mail-wm1-f68.google.com with SMTP id y139so22691370wmc.5 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=byxEH+whzgqz0NlS6NZ66UIBqDLc+OaGRdNap8bTSB1Rz6FA22EWdDJbb12Q8x/IqN i9CGT8dY9bKHK0H7OE9vWd7e89ArMNNY9LgE1C7hoi9nxZqaoxhWAONeML2VY37SNd0c IYg39pafhvq4AxwTKVtbJcyCS7Wwly108lVlEoostvURo+3RA5m/D/VzQ3ZISsJFUM6F kVfxgf3iJf8WXXN5o8JxKrwOeZ37Q4J2IBFMMoYmczRVHLbChqq2lSWdLFu7q2gq/0Vt nc9G/bT/F7oIUyAy2xUqWs1swLHLJib/9q0sUhPFE571cU9V5ireim41q/F5V03X7WOp J/cQ== X-Gm-Message-State: AA+aEWatiyQiwUi/AlizocrOXd/9YgL5kMzjDnBmVO8IlWQs4+GsxC2V QOANG/qmB18HsGuKC4kXRAXUMD4xMZghVw== 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-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 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