From: Lina Iyer <ilina@codeaurora.org>
To: rjw@rjwysocki.net, ulf.hansson@linaro.org, linux-pm@vger.kernel.org
Cc: linux-arm-msm@vger.kernel.org, Lina Iyer <ilina@codeaurora.org>
Subject: [PATCH RFC] PM / Domains: enable domain idle state accounting
Date: Thu, 24 Sep 2020 20:42:00 -0600 [thread overview]
Message-ID: <20200925024200.6429-1-ilina@codeaurora.org> (raw)
To enable better debug of PM domains, let's keep a track of the success
and failures in entering each domain idle state.
This statistics is exported in debugfs when reading the idle_states
node, associated with each PM domain.
Signed-off-by: Lina Iyer <ilina@codeaurora.org>
---
This patch depends-on: https://lkml.org/lkml/2020/9/24/465
---
drivers/base/power/domain.c | 7 +++++--
include/linux/pm_domain.h | 2 ++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index f001ac6326fb..ba3355f935da 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -564,6 +564,7 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
genpd->status = GENPD_STATE_OFF;
genpd_update_accounting(genpd);
+ genpd->states[genpd->state_idx].usage++;
list_for_each_entry(link, &genpd->child_links, child_node) {
genpd_sd_counter_dec(link->parent);
@@ -574,6 +575,7 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
return 0;
busy:
+ genpd->states[genpd->state_idx].failed++;
if (nr_calls)
__raw_notifier_call_chain(&genpd->power_notifiers,
GENPD_STATE_ON, NULL,
@@ -3053,7 +3055,7 @@ static int idle_states_show(struct seq_file *s, void *data)
if (ret)
return -ERESTARTSYS;
- seq_puts(s, "State Time Spent(ms)\n");
+ seq_puts(s, "State Time Spent(ms) Usage Failed\n");
for (i = 0; i < genpd->state_count; i++) {
ktime_t delta = 0;
@@ -3065,7 +3067,8 @@ static int idle_states_show(struct seq_file *s, void *data)
msecs = ktime_to_ms(
ktime_add(genpd->states[i].idle_time, delta));
- seq_printf(s, "S%-13i %lld\n", i, msecs);
+ seq_printf(s, "S%-13i %-14lld %-14llu %llu\n", i, msecs,
+ genpd->states[i].usage, genpd->states[i].failed);
}
genpd_unlock(genpd);
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 3b2b561ce846..c30994ec0cec 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -82,6 +82,8 @@ struct genpd_power_state {
s64 power_off_latency_ns;
s64 power_on_latency_ns;
s64 residency_ns;
+ u64 usage;
+ u64 failed;
struct fwnode_handle *fwnode;
ktime_t idle_time;
void *data;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
next reply other threads:[~2020-09-25 2:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-25 2:42 Lina Iyer [this message]
2020-09-25 15:29 ` [PATCH RFC] PM / Domains: enable domain idle state accounting Rafael J. Wysocki
2020-09-25 15:41 ` Lina Iyer
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=20200925024200.6429-1-ilina@codeaurora.org \
--to=ilina@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=ulf.hansson@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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox