Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp690699imm; Mon, 9 Jul 2018 08:56:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpda+taxTHt853/3ZEy/kkRh/AdJbdvoFtaKMdv5kG87VScv88CM0iwlt4xeI/NBUCz2ucnL X-Received: by 2002:a17:902:1127:: with SMTP id d36-v6mr21343945pla.267.1531151771797; Mon, 09 Jul 2018 08:56:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531151771; cv=none; d=google.com; s=arc-20160816; b=ym0LF5PmFNm1BEJCUctrLZ7PCPCWnNDyYdhM63iQFskNG2AZcXz9KVIUK548lKL+g+ lsjxWcMWgmpSfMiMPbCNwvmmg+9oG70GtXXUEUQrr+ptCs6hSvp9V1BFtSVnDR9a7Cka BNknAP7+sDO0+111bCPQSQap9XbtrpFjwLTvie6BhssFI4hl9CcF0HXT513gUu7PpSOR crEh3o6h+cO3H3hbFvH3ejerQL4q5ZRJn9qN7m3qLkakn5ddEglp9TCEbOd78Kc1bDZC qeS8ITDoHFAJsRWUC/L5Iradan11KXcHBQyi2iyPYLGQJR8WDBJdfaDNM/QJUSN2rgyI I+tA== 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=2Z7eEmJHjemqKmc1XOzTB2TureY7MusYkWywxYsb/f0=; b=aCGfYK4V+MCpfrIWN3nzmw/aPg3F4ybIFKtVCp3yATeusTcy3cUvCmMYwkeKvB1pwD tc02UgpWeUGgS0MxOlU9KqLkd6NR9zpWUWegJhpy/DPMWPwhyvqp4v93AipX7VyOgtPO MPxKRVgbs5tR6IgGnwUWr7trkHUfzag6gzZU5XL35wyjKb7zooX7ZsNr6s4ymq7FPF6Y oXSFWJswbQYFnHIcRfbRDh2rWOe1lIM+5KTgk9+3HLfSS/r/bR3+8oI09otiUsEL8oX1 pMQ+H4ZkApi8Mb06e4v3WGQ/PpK+sGOW5qEhe+jGLOxypsGD+lx5pAeBoaCUo6UlYb3e xaPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="W2JsN3/X"; 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 t14-v6si118224plo.48.2018.07.09.08.55.57; Mon, 09 Jul 2018 08:56:11 -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="W2JsN3/X"; 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 S933702AbeGIPys (ORCPT + 99 others); Mon, 9 Jul 2018 11:54:48 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40756 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933781AbeGIPvO (ORCPT ); Mon, 9 Jul 2018 11:51:14 -0400 Received: by mail-wr1-f67.google.com with SMTP id t6-v6so11517310wrn.7 for ; Mon, 09 Jul 2018 08:51:13 -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=2Z7eEmJHjemqKmc1XOzTB2TureY7MusYkWywxYsb/f0=; b=W2JsN3/Xr8bzOUPlv1X3kEKSz3Q8YMxgHmNzUagwj8xyPIlaLzWZlP5m4+pOhlKenX XyO6Qy989rqcP0zQanblLVLXZ/ULxbwoWKinalR65dEuZyZfEda3BZB4hwngPj23zJhT PoE20Blg3Rsp92OgX9Ixq9WgTvyzCQhwHjoKg= 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=2Z7eEmJHjemqKmc1XOzTB2TureY7MusYkWywxYsb/f0=; b=IM7xi3lerWu8p1nTGdZLA3mNX67d3gCHqlHrW8N+aJ4QmCgVbg2p2VB03hrpryZf09 cWtuSHE+e5ev0G5RC7+bCbPJSUnXWuNV0kg+Cu6n4/cXLxTo5Rsmaz8GbsvoQv/xbku5 SSlW4Ovv9weAL0Nc+OmrODs3BJhEeAY3nJBO53yWx4dE7hjTu2k06n9h2tmFmqUWTTr9 lsqrnW14h1YidBfoW2/j0STVfoYJu1BPoU3wBqV3Sg/oeVlGuxFYDUD9auC9I0EOwAza 5EgIKCP7bI8Na3yZI5VsC+2oB+SgSNg7vUYoTV1xxb5Iui5vXakzwhgLjuXBbc5xBzp8 nsPw== X-Gm-Message-State: AOUpUlFyxAP/KhCW6rJ7T68g523oFrSWiE19oFcLsNWg64Kyo/hF3tgi nI8axllSJJj4b7p8e8Ji6aQAcw== X-Received: by 2002:adf:b243:: with SMTP id y3-v6mr6937864wra.90.1531151472892; Mon, 09 Jul 2018 08:51:12 -0700 (PDT) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id o21-v6sm16229202wmg.28.2018.07.09.08.51.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Jul 2018 08:51:12 -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, abailon@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, mka@chromium.org, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v6 3/8] interconnect: Add debugfs support Date: Mon, 9 Jul 2018 18:50:59 +0300 Message-Id: <20180709155104.25528-4-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180709155104.25528-1-georgi.djakov@linaro.org> References: <20180709155104.25528-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 63707c3c3d48..3f5001f51bb7 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[]; }; +#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) { return idr_find(&icc_idr, id);