Received: by 10.223.185.111 with SMTP id b44csp761274wrg; Fri, 9 Mar 2018 13:13:29 -0800 (PST) X-Google-Smtp-Source: AG47ELtFPMxlp2pOzRfvUj+IPaJ+HBgW030KfhRIOFCqrk1O8dzcc+TfTL5GDGv2+JZfFLjTpDV1 X-Received: by 10.99.116.28 with SMTP id p28mr25569094pgc.306.1520630009160; Fri, 09 Mar 2018 13:13:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520630009; cv=none; d=google.com; s=arc-20160816; b=w0lpU+fJJXGgs0jRxETMcmtTVIFvjBkUoUAAJ689Gct7IJle3jWBv1trimN9O0FLxM L4tDZ4EZCJZQjWZD1a6h0vsD7WLKPIdCQWBZfAld9BffmakPT7hMok2AygVCfAOH8FQ6 /V3U4XaCCRaY0xGNTDWq7KS3zvmQBr3u2x17xnBbx7X82q+XS8jfmGb+iVOlJW/Szt9z ZnZQd8lsGCJvI4s2UhoE45Z4EaTimaQQ/07heT5AGbzvEcZ87uFx1+Fiv9R2r9YJD4Tv eY+UxGsfXkaOqgtViDWt0f0jWWbHBj8i3JbMS6M5t/1S1ljw+Oe9nhBRU8KVAK4HGEFo 6F2A== 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=7dJ61Js48E3Ds72/6TrlMw7o9MrSnzRN7XqpAPjyplI=; b=f90HxNsz82Srp7kDso9qU9Ng+/qLIXnK067zI64nv39311zYrUMYftFKtxp0y4uFFO PGCSgy0+cRLTxplzVN6MRp13pAmfZKTtLlu4b3FS4UxlI9WyGNlK8UJMG+3N0nYb4fCM HS3+LkQNSu8a/AAwrCbFVynyuFwSPRx1sLK2Hd/xe+Y9gAZMZ7d0fagIh/6TBc23JOBr m7SZhaDaZUUB+z37cSRDvqpbK158xgqa/RIjcomipWSmrie3l0mm9mtZma/I0TlgSPzM NSaW1z7SPn3f0D2xWSiEEj7IADy9uvSyJcUn96tpYgmeS2PozWbELusUKTTr0DjnfDxb RiYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ByBvWMEv; 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 b17si1493860pfd.155.2018.03.09.13.13.14; Fri, 09 Mar 2018 13:13:29 -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=ByBvWMEv; 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 S932627AbeCIVKL (ORCPT + 99 others); Fri, 9 Mar 2018 16:10:11 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:38997 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932288AbeCIVKH (ORCPT ); Fri, 9 Mar 2018 16:10:07 -0500 Received: by mail-wm0-f68.google.com with SMTP id i3so6152919wmi.4 for ; Fri, 09 Mar 2018 13:10:06 -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; bh=7dJ61Js48E3Ds72/6TrlMw7o9MrSnzRN7XqpAPjyplI=; b=ByBvWMEv6jkBaLBDCmQsqMpse+XK3F3FWzkpacS/p3TAg9YB38+NNKpojKHX/sQKwW GvC+KwEwGPLDwvkY88hmdghsZEI2wm1qKhhWpsNVnvPcjphFlwYjcReOnkPHz0za/JUT 2XboQ5s9IyP/CFSYM9KlkNaYWA5OLa+ep9VAs= 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=7dJ61Js48E3Ds72/6TrlMw7o9MrSnzRN7XqpAPjyplI=; b=dtQ0DVK1NuLP6mWMxJvZ71/y4osk6NdDVuJxw+aP9Lul1VMPTQSteT/hQ+tWnEFwJN cKNqHXQsIJVow+3NogTNGxMFxLkEhWX6C4GDc+Hl2EckaqjAd0+2qZTDMO4GyQIfyBIe ELx80UqcryC+x346Y2aD0stcd2KdlS6GLu31V2RxmyDMb5oNyWFV4fjKJvo6t57K3ZAZ g7Qqq2yqoHhXLw1LRJYovDovJdPCNIB+YYL7bwbY5fTmhT8g0VoOeu0sqQ8x6jGP1/KU bDEhz+Qu5as0nFkwaQidg8fHIOIFoCmDjKUhfrL+QioKG0ZQmOfQhrSNmAMZaWJBizyM CAYw== X-Gm-Message-State: AElRT7EJtALvfTxtivi2CGsEFxRtxDZFiWDlWoW1Xd09M5meNuwZIDra i5WIdx5KWcfYYhGls6cY1ByKfw== X-Received: by 10.28.109.78 with SMTP id i75mr179107wmc.61.1520629806021; Fri, 09 Mar 2018 13:10:06 -0800 (PST) Received: from mms-0441.qualcomm.mm-sol.com ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id g7sm1853118wrb.78.2018.03.09.13.10.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 13:10:05 -0800 (PST) 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, vincent.guittot@linaro.org, skannan@codeaurora.org, bjorn.andersson@linaro.org, amit.kucheria@linaro.org, seansw@qti.qualcomm.com, davidai@quicinc.com, 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 v4 3/7] interconnect: Add debugfs support Date: Fri, 9 Mar 2018 23:09:54 +0200 Message-Id: <20180309210958.16672-4-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180309210958.16672-1-georgi.djakov@linaro.org> References: <20180309210958.16672-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 | 70 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index 6306e258b9b9..a06f752a6aaa 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -6,6 +6,7 @@ * Author: Georgi Djakov */ +#include #include #include #include @@ -15,11 +16,13 @@ #include #include #include +#include static DEFINE_IDR(icc_idr); static LIST_HEAD(icc_provider_list); static DEFINE_MUTEX(icc_provider_list_mutex); static DEFINE_MUTEX(icc_path_mutex); +static struct dentry *icc_debugfs_dir; /** * struct icc_req - constraints that are attached to each node @@ -46,6 +49,73 @@ struct icc_path { struct icc_req reqs[0]; }; +#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_provider_list_mutex); + + list_for_each_entry(provider, &icc_provider_list, provider_list) { + struct icc_node *n; + + mutex_lock(&provider->lock); + list_for_each_entry(n, &provider->nodes, node_list) { + icc_summary_show_one(s, n); + } + mutex_unlock(&provider->lock); + } + + mutex_unlock(&icc_provider_list_mutex); + + 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) { struct icc_node *node;