summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLina Iyer <ilina@codeaurora.org>2020-10-15 23:47:22 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2020-10-16 18:53:22 +0300
commitc6a113b52302adcfadda63af81dc05f7a669fbc8 (patch)
treec696c33f38bfb7145162c2cc211e77467eefdd76 /drivers
parent505a70b783debaa84c7ebafa44a69a9401db4499 (diff)
downloadlinux-c6a113b52302adcfadda63af81dc05f7a669fbc8.tar.xz
PM: domains: enable domain idle state accounting
To enable better debug of PM domains, keep a track of successful and failing attempts to enter each domain idle state. This statistics are exported in debugfs when reading the idle_states node associated with each PM domain. Signed-off-by: Lina Iyer <ilina@codeaurora.org> [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/power/domain.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index bc4243943940..859cdb207010 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -591,11 +591,14 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
return -EBUSY;
ret = _genpd_power_off(genpd, true);
- if (ret)
+ if (ret) {
+ genpd->states[genpd->state_idx].rejected++;
return ret;
+ }
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);
@@ -3061,7 +3064,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 Rejected\n");
for (i = 0; i < genpd->state_count; i++) {
ktime_t delta = 0;
@@ -3073,7 +3076,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].rejected);
}
genpd_unlock(genpd);