From: Georgi Djakov <georgi.djakov@linaro.org> 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 [thread overview] Message-ID: <20180309210958.16672-4-georgi.djakov@linaro.org> (raw) In-Reply-To: <20180309210958.16672-1-georgi.djakov@linaro.org> Add a functionality to provide information about the current constraints per each node and provider. Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> --- 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 <georgi.djakov@linaro.org> */ +#include <linux/debugfs.h> #include <linux/device.h> #include <linux/idr.h> #include <linux/init.h> @@ -15,11 +16,13 @@ #include <linux/module.h> #include <linux/mutex.h> #include <linux/slab.h> +#include <linux/uaccess.h> 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;
WARNING: multiple messages have this Message-ID (diff)
From: georgi.djakov@linaro.org (Georgi Djakov) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 3/7] interconnect: Add debugfs support Date: Fri, 9 Mar 2018 23:09:54 +0200 [thread overview] Message-ID: <20180309210958.16672-4-georgi.djakov@linaro.org> (raw) In-Reply-To: <20180309210958.16672-1-georgi.djakov@linaro.org> Add a functionality to provide information about the current constraints per each node and provider. Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org> --- 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 <georgi.djakov@linaro.org> */ +#include <linux/debugfs.h> #include <linux/device.h> #include <linux/idr.h> #include <linux/init.h> @@ -15,11 +16,13 @@ #include <linux/module.h> #include <linux/mutex.h> #include <linux/slab.h> +#include <linux/uaccess.h> 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;
next prev parent reply other threads:[~2018-03-09 21:09 UTC|newest] Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-03-09 21:09 [PATCH v4 0/7] Introduce on-chip interconnect API Georgi Djakov 2018-03-09 21:09 ` Georgi Djakov 2018-03-09 21:09 ` [PATCH v4 1/7] interconnect: Add generic " Georgi Djakov 2018-03-09 21:09 ` Georgi Djakov 2018-03-09 21:09 ` Georgi Djakov 2018-04-06 17:38 ` Matthias Kaehlcke 2018-04-06 17:38 ` Matthias Kaehlcke 2018-04-12 13:06 ` Georgi Djakov 2018-04-12 13:06 ` Georgi Djakov 2018-05-11 21:30 ` Evan Green 2018-05-11 21:30 ` Evan Green 2018-06-06 14:59 ` Georgi Djakov 2018-06-06 14:59 ` Georgi Djakov 2018-06-06 18:09 ` Georgi Djakov 2018-06-06 18:09 ` Georgi Djakov 2018-06-07 1:06 ` Evan Green 2018-06-07 1:06 ` Evan Green 2018-06-07 1:06 ` Evan Green 2018-05-25 8:26 ` Amit Kucheria 2018-05-25 8:26 ` Amit Kucheria 2018-06-06 15:08 ` Georgi Djakov 2018-06-06 15:08 ` Georgi Djakov 2018-06-08 15:57 ` Alexandre Bailon 2018-06-08 15:57 ` Alexandre Bailon 2018-06-09 19:15 ` Georgi Djakov 2018-06-09 19:15 ` Georgi Djakov 2018-03-09 21:09 ` [PATCH v4 2/7] dt-bindings: Introduce interconnect provider bindings Georgi Djakov 2018-03-09 21:09 ` Georgi Djakov 2018-03-18 22:50 ` Bjorn Andersson 2018-03-18 22:50 ` Bjorn Andersson 2018-03-19 9:34 ` Georgi Djakov 2018-03-19 9:34 ` Georgi Djakov 2018-04-12 13:15 ` Neil Armstrong 2018-04-12 13:15 ` Neil Armstrong 2018-06-06 15:23 ` Georgi Djakov 2018-06-06 15:23 ` Georgi Djakov 2018-03-09 21:09 ` Georgi Djakov [this message] 2018-03-09 21:09 ` [PATCH v4 3/7] interconnect: Add debugfs support Georgi Djakov 2018-03-09 21:09 ` [PATCH v4 4/7] interconnect: qcom: Add RPM communication Georgi Djakov 2018-03-09 21:09 ` Georgi Djakov 2018-05-11 21:30 ` Evan Green 2018-05-11 21:30 ` Evan Green 2018-06-06 15:00 ` Georgi Djakov 2018-06-06 15:00 ` Georgi Djakov 2018-03-09 21:09 ` [PATCH v4 5/7] interconnect: qcom: Add msm8916 interconnect provider driver Georgi Djakov 2018-03-09 21:09 ` Georgi Djakov 2018-04-05 22:58 ` Matthias Kaehlcke 2018-04-05 22:58 ` Matthias Kaehlcke 2018-04-12 13:09 ` Georgi Djakov 2018-04-12 13:09 ` Georgi Djakov 2018-05-11 21:29 ` Evan Green 2018-05-11 21:29 ` Evan Green 2018-06-06 15:03 ` Georgi Djakov 2018-06-06 15:03 ` Georgi Djakov 2018-05-25 8:27 ` Amit Kucheria 2018-05-25 8:27 ` Amit Kucheria 2018-06-06 15:14 ` Georgi Djakov 2018-06-06 15:14 ` Georgi Djakov 2018-03-09 21:09 ` [PATCH v4 6/7] dt-bindings: Introduce interconnect consumers bindings Georgi Djakov 2018-03-09 21:09 ` Georgi Djakov 2018-03-18 22:49 ` Bjorn Andersson 2018-03-18 22:49 ` Bjorn Andersson 2018-03-19 9:41 ` Georgi Djakov 2018-03-19 9:41 ` Georgi Djakov 2018-03-09 21:09 ` [PATCH v4 7/7] interconnect: Allow endpoints translation via DT Georgi Djakov 2018-03-09 21:09 ` Georgi Djakov 2018-05-11 21:29 ` Evan Green 2018-05-11 21:29 ` Evan Green
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180309210958.16672-4-georgi.djakov@linaro.org \ --to=georgi.djakov@linaro.org \ --cc=amit.kucheria@linaro.org \ --cc=bjorn.andersson@linaro.org \ --cc=davidai@quicinc.com \ --cc=gregkh@linuxfoundation.org \ --cc=khilman@baylibre.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-arm-msm@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pm@vger.kernel.org \ --cc=lorenzo.pieralisi@arm.com \ --cc=mark.rutland@arm.com \ --cc=mturquette@baylibre.com \ --cc=rjw@rjwysocki.net \ --cc=robh+dt@kernel.org \ --cc=seansw@qti.qualcomm.com \ --cc=skannan@codeaurora.org \ --cc=vincent.guittot@linaro.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.