* [PATCH 0/3] pmdomain: core: Extend domain idle states debugfs support
@ 2026-01-19 14:31 Ulf Hansson
2026-01-19 14:31 ` [PATCH 1/3] pmdomain: core: Restructure domain idle states data for genpd in debugfs Ulf Hansson
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Ulf Hansson @ 2026-01-19 14:31 UTC (permalink / raw)
To: Ulf Hansson, Dhruva Gole, linux-pm
Cc: Rafael J . Wysocki, Kevin Hilman, linux-arm-kernel, linux-kernel
This small series moves around and extends the information that genpd shows for
the domain idle states in debugs.
Please help review and test!
Kind regards
Ulf Hansson
Ulf Hansson (3):
pmdomain: core: Restructure domain idle states data for genpd in
debugfs
pmdomain: core: Show latency/residency for domain idle states in
debugfs
pmdomain: core: Extend statistics for domain idle states with s2idle
data
drivers/pmdomain/core.c | 59 +++++++++++++++++++++++++++++++++------
include/linux/pm_domain.h | 1 +
2 files changed, 51 insertions(+), 9 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] pmdomain: core: Restructure domain idle states data for genpd in debugfs
2026-01-19 14:31 [PATCH 0/3] pmdomain: core: Extend domain idle states debugfs support Ulf Hansson
@ 2026-01-19 14:31 ` Ulf Hansson
2026-01-19 14:31 ` [PATCH 2/3] pmdomain: core: Show latency/residency for domain idle states " Ulf Hansson
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Ulf Hansson @ 2026-01-19 14:31 UTC (permalink / raw)
To: Ulf Hansson, Dhruva Gole, linux-pm
Cc: Rafael J . Wysocki, Kevin Hilman, linux-arm-kernel, linux-kernel
To prepare for additional information to be added for the domain idle
states in genpd's debugfs, let's make the existing information denser. To
allow that, let's move the static information of the domain idle states
into a separate debugfs file.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/pmdomain/core.c | 43 ++++++++++++++++++++++++++++++++---------
1 file changed, 34 insertions(+), 9 deletions(-)
diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
index bf82775f6a67..919dff2081d6 100644
--- a/drivers/pmdomain/core.c
+++ b/drivers/pmdomain/core.c
@@ -3772,11 +3772,11 @@ static int idle_states_show(struct seq_file *s, void *data)
if (ret)
return -ERESTARTSYS;
- seq_puts(s, "State Time Spent(ms) Usage Rejected Above Below\n");
+ seq_puts(s, "State Time(ms) Usage Rejected Above Below\n");
for (i = 0; i < genpd->state_count; i++) {
struct genpd_power_state *state = &genpd->states[i];
- char state_name[15];
+ char state_name[7];
idle_time += state->idle_time;
@@ -3788,14 +3788,36 @@ static int idle_states_show(struct seq_file *s, void *data)
}
}
- if (!state->name)
- snprintf(state_name, ARRAY_SIZE(state_name), "S%-13d", i);
-
+ snprintf(state_name, ARRAY_SIZE(state_name), "S%-5d", i);
do_div(idle_time, NSEC_PER_MSEC);
- seq_printf(s, "%-14s %-14llu %-10llu %-10llu %-10llu %llu\n",
- state->name ?: state_name, idle_time,
- state->usage, state->rejected, state->above,
- state->below);
+ seq_printf(s, "%-6s %-14llu %-10llu %-10llu %-10llu %llu\n",
+ state_name, idle_time, state->usage, state->rejected,
+ state->above, state->below);
+ }
+
+ genpd_unlock(genpd);
+ return ret;
+}
+
+static int idle_states_desc_show(struct seq_file *s, void *data)
+{
+ struct generic_pm_domain *genpd = s->private;
+ unsigned int i;
+ int ret = 0;
+
+ ret = genpd_lock_interruptible(genpd);
+ if (ret)
+ return -ERESTARTSYS;
+
+ seq_puts(s, "State Name\n");
+
+ for (i = 0; i < genpd->state_count; i++) {
+ struct genpd_power_state *state = &genpd->states[i];
+ char state_name[7];
+
+ snprintf(state_name, ARRAY_SIZE(state_name), "S%-5d", i);
+ seq_printf(s, "%-6s %s\n",
+ state_name, state->name ?: "N/A");
}
genpd_unlock(genpd);
@@ -3891,6 +3913,7 @@ DEFINE_SHOW_ATTRIBUTE(summary);
DEFINE_SHOW_ATTRIBUTE(status);
DEFINE_SHOW_ATTRIBUTE(sub_domains);
DEFINE_SHOW_ATTRIBUTE(idle_states);
+DEFINE_SHOW_ATTRIBUTE(idle_states_desc);
DEFINE_SHOW_ATTRIBUTE(active_time);
DEFINE_SHOW_ATTRIBUTE(total_idle_time);
DEFINE_SHOW_ATTRIBUTE(devices);
@@ -3911,6 +3934,8 @@ static void genpd_debug_add(struct generic_pm_domain *genpd)
d, genpd, &sub_domains_fops);
debugfs_create_file("idle_states", 0444,
d, genpd, &idle_states_fops);
+ debugfs_create_file("idle_states_desc", 0444,
+ d, genpd, &idle_states_desc_fops);
debugfs_create_file("active_time", 0444,
d, genpd, &active_time_fops);
debugfs_create_file("total_idle_time", 0444,
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] pmdomain: core: Show latency/residency for domain idle states in debugfs
2026-01-19 14:31 [PATCH 0/3] pmdomain: core: Extend domain idle states debugfs support Ulf Hansson
2026-01-19 14:31 ` [PATCH 1/3] pmdomain: core: Restructure domain idle states data for genpd in debugfs Ulf Hansson
@ 2026-01-19 14:31 ` Ulf Hansson
2026-01-27 13:56 ` Dhruva Gole
2026-01-19 14:31 ` [PATCH 3/3] pmdomain: core: Extend statistics for domain idle states with s2idle data Ulf Hansson
` (2 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Ulf Hansson @ 2026-01-19 14:31 UTC (permalink / raw)
To: Ulf Hansson, Dhruva Gole, linux-pm
Cc: Rafael J . Wysocki, Kevin Hilman, linux-arm-kernel, linux-kernel
Similar to how cpuidle provides the values for latency and residency for
CPU's idle states through sysfs, let's make the corresponding data for PM
domain's idle states available for user space, via genpd's debugfs support.
Suggested-by: Dhruva Gole <d-gole@ti.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/pmdomain/core.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
index 919dff2081d6..bf512ff0857d 100644
--- a/drivers/pmdomain/core.c
+++ b/drivers/pmdomain/core.c
@@ -3809,15 +3809,24 @@ static int idle_states_desc_show(struct seq_file *s, void *data)
if (ret)
return -ERESTARTSYS;
- seq_puts(s, "State Name\n");
+ seq_puts(s, "State Latency(us) Residency(us) Name\n");
for (i = 0; i < genpd->state_count; i++) {
struct genpd_power_state *state = &genpd->states[i];
+ u64 latency, residency;
char state_name[7];
+ latency = state->power_off_latency_ns +
+ state->power_on_latency_ns;
+ do_div(latency, NSEC_PER_USEC);
+
+ residency = state->residency_ns;
+ do_div(residency, NSEC_PER_USEC);
+
snprintf(state_name, ARRAY_SIZE(state_name), "S%-5d", i);
- seq_printf(s, "%-6s %s\n",
- state_name, state->name ?: "N/A");
+ seq_printf(s, "%-6s %-12llu %-14llu %s\n",
+ state_name, latency, residency,
+ state->name ?: "N/A");
}
genpd_unlock(genpd);
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] pmdomain: core: Extend statistics for domain idle states with s2idle data
2026-01-19 14:31 [PATCH 0/3] pmdomain: core: Extend domain idle states debugfs support Ulf Hansson
2026-01-19 14:31 ` [PATCH 1/3] pmdomain: core: Restructure domain idle states data for genpd in debugfs Ulf Hansson
2026-01-19 14:31 ` [PATCH 2/3] pmdomain: core: Show latency/residency for domain idle states " Ulf Hansson
@ 2026-01-19 14:31 ` Ulf Hansson
2026-01-27 13:54 ` Dhruva Gole
2026-01-27 14:27 ` [PATCH 0/3] pmdomain: core: Extend domain idle states debugfs support Ulf Hansson
2026-01-27 21:25 ` Kevin Hilman
4 siblings, 1 reply; 8+ messages in thread
From: Ulf Hansson @ 2026-01-19 14:31 UTC (permalink / raw)
To: Ulf Hansson, Dhruva Gole, linux-pm
Cc: Rafael J . Wysocki, Kevin Hilman, linux-arm-kernel, linux-kernel
To allow user space to monitor the selection of the domain idle state
during s2idle for a CPU PM domain, let's extend the debugfs support in
genpd with this information.
Suggested-by: Dhruva Gole <d-gole@ti.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/pmdomain/core.c | 13 ++++++++++---
include/linux/pm_domain.h | 1 +
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
index bf512ff0857d..bb04cb7ccdcd 100644
--- a/drivers/pmdomain/core.c
+++ b/drivers/pmdomain/core.c
@@ -1438,6 +1438,13 @@ static void genpd_sync_power_off(struct generic_pm_domain *genpd, bool use_lock,
return;
} else {
genpd->states[genpd->state_idx].usage++;
+
+ /*
+ * The ->system_power_down_ok() callback is currently used only
+ * for s2idle. Use it to know when to update the usage counter.
+ */
+ if (genpd->gov && genpd->gov->system_power_down_ok)
+ genpd->states[genpd->state_idx].usage_s2idle++;
}
genpd->status = GENPD_STATE_OFF;
@@ -3772,7 +3779,7 @@ static int idle_states_show(struct seq_file *s, void *data)
if (ret)
return -ERESTARTSYS;
- seq_puts(s, "State Time(ms) Usage Rejected Above Below\n");
+ seq_puts(s, "State Time(ms) Usage Rejected Above Below S2idle\n");
for (i = 0; i < genpd->state_count; i++) {
struct genpd_power_state *state = &genpd->states[i];
@@ -3790,9 +3797,9 @@ static int idle_states_show(struct seq_file *s, void *data)
snprintf(state_name, ARRAY_SIZE(state_name), "S%-5d", i);
do_div(idle_time, NSEC_PER_MSEC);
- seq_printf(s, "%-6s %-14llu %-10llu %-10llu %-10llu %llu\n",
+ seq_printf(s, "%-6s %-14llu %-10llu %-10llu %-10llu %-10llu %llu\n",
state_name, idle_time, state->usage, state->rejected,
- state->above, state->below);
+ state->above, state->below, state->usage_s2idle);
}
genpd_unlock(genpd);
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 93ba0143ca47..f6f6d494f728 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -183,6 +183,7 @@ struct genpd_power_state {
u64 rejected;
u64 above;
u64 below;
+ u64 usage_s2idle;
struct fwnode_handle *fwnode;
u64 idle_time;
void *data;
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] pmdomain: core: Extend statistics for domain idle states with s2idle data
2026-01-19 14:31 ` [PATCH 3/3] pmdomain: core: Extend statistics for domain idle states with s2idle data Ulf Hansson
@ 2026-01-27 13:54 ` Dhruva Gole
0 siblings, 0 replies; 8+ messages in thread
From: Dhruva Gole @ 2026-01-27 13:54 UTC (permalink / raw)
To: Ulf Hansson
Cc: linux-pm, Rafael J . Wysocki, Kevin Hilman, linux-arm-kernel,
linux-kernel
On Jan 19, 2026 at 15:31:15 +0100, Ulf Hansson wrote:
> To allow user space to monitor the selection of the domain idle state
> during s2idle for a CPU PM domain, let's extend the debugfs support in
> genpd with this information.
>
> Suggested-by: Dhruva Gole <d-gole@ti.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
> drivers/pmdomain/core.c | 13 ++++++++++---
> include/linux/pm_domain.h | 1 +
> 2 files changed, 11 insertions(+), 3 deletions(-)
This will be quite helpful, thanks alot Ulf!
Reviewed-by: Dhruva Gole <d-gole@ti.com>
>
> diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
> index bf512ff0857d..bb04cb7ccdcd 100644
> --- a/drivers/pmdomain/core.c
> +++ b/drivers/pmdomain/core.c
> @@ -1438,6 +1438,13 @@ static void genpd_sync_power_off(struct generic_pm_domain *genpd, bool use_lock,
> return;
> } else {
> genpd->states[genpd->state_idx].usage++;
> +
> + /*
> + * The ->system_power_down_ok() callback is currently used only
> + * for s2idle. Use it to know when to update the usage counter.
> + */
> + if (genpd->gov && genpd->gov->system_power_down_ok)
> + genpd->states[genpd->state_idx].usage_s2idle++;
> }
>
> genpd->status = GENPD_STATE_OFF;
> @@ -3772,7 +3779,7 @@ static int idle_states_show(struct seq_file *s, void *data)
> if (ret)
> return -ERESTARTSYS;
>
> - seq_puts(s, "State Time(ms) Usage Rejected Above Below\n");
> + seq_puts(s, "State Time(ms) Usage Rejected Above Below S2idle\n");
>
> for (i = 0; i < genpd->state_count; i++) {
> struct genpd_power_state *state = &genpd->states[i];
> @@ -3790,9 +3797,9 @@ static int idle_states_show(struct seq_file *s, void *data)
>
> snprintf(state_name, ARRAY_SIZE(state_name), "S%-5d", i);
> do_div(idle_time, NSEC_PER_MSEC);
> - seq_printf(s, "%-6s %-14llu %-10llu %-10llu %-10llu %llu\n",
> + seq_printf(s, "%-6s %-14llu %-10llu %-10llu %-10llu %-10llu %llu\n",
> state_name, idle_time, state->usage, state->rejected,
> - state->above, state->below);
> + state->above, state->below, state->usage_s2idle);
> }
>
> genpd_unlock(genpd);
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index 93ba0143ca47..f6f6d494f728 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -183,6 +183,7 @@ struct genpd_power_state {
> u64 rejected;
> u64 above;
> u64 below;
> + u64 usage_s2idle;
> struct fwnode_handle *fwnode;
> u64 idle_time;
> void *data;
> --
> 2.43.0
>
--
Best regards,
Dhruva Gole
Texas Instruments Incorporated
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] pmdomain: core: Show latency/residency for domain idle states in debugfs
2026-01-19 14:31 ` [PATCH 2/3] pmdomain: core: Show latency/residency for domain idle states " Ulf Hansson
@ 2026-01-27 13:56 ` Dhruva Gole
0 siblings, 0 replies; 8+ messages in thread
From: Dhruva Gole @ 2026-01-27 13:56 UTC (permalink / raw)
To: Ulf Hansson
Cc: linux-pm, Rafael J . Wysocki, Kevin Hilman, linux-arm-kernel,
linux-kernel
On Jan 19, 2026 at 15:31:14 +0100, Ulf Hansson wrote:
> Similar to how cpuidle provides the values for latency and residency for
> CPU's idle states through sysfs, let's make the corresponding data for PM
> domain's idle states available for user space, via genpd's debugfs support.
>
> Suggested-by: Dhruva Gole <d-gole@ti.com>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
> drivers/pmdomain/core.c | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
> index 919dff2081d6..bf512ff0857d 100644
> --- a/drivers/pmdomain/core.c
> +++ b/drivers/pmdomain/core.c
> @@ -3809,15 +3809,24 @@ static int idle_states_desc_show(struct seq_file *s, void *data)
> if (ret)
> return -ERESTARTSYS;
>
> - seq_puts(s, "State Name\n");
> + seq_puts(s, "State Latency(us) Residency(us) Name\n");
>
> for (i = 0; i < genpd->state_count; i++) {
> struct genpd_power_state *state = &genpd->states[i];
> + u64 latency, residency;
> char state_name[7];
>
> + latency = state->power_off_latency_ns +
> + state->power_on_latency_ns;
> + do_div(latency, NSEC_PER_USEC);
> +
> + residency = state->residency_ns;
> + do_div(residency, NSEC_PER_USEC);
> +
> snprintf(state_name, ARRAY_SIZE(state_name), "S%-5d", i);
> - seq_printf(s, "%-6s %s\n",
> - state_name, state->name ?: "N/A");
> + seq_printf(s, "%-6s %-12llu %-14llu %s\n",
> + state_name, latency, residency,
> + state->name ?: "N/A");
Much needed indeed, thanks!!
Reviewed-by: Dhruva Gole <d-gole@ti.com>
--
Best regards,
Dhruva Gole
Texas Instruments Incorporated
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] pmdomain: core: Extend domain idle states debugfs support
2026-01-19 14:31 [PATCH 0/3] pmdomain: core: Extend domain idle states debugfs support Ulf Hansson
` (2 preceding siblings ...)
2026-01-19 14:31 ` [PATCH 3/3] pmdomain: core: Extend statistics for domain idle states with s2idle data Ulf Hansson
@ 2026-01-27 14:27 ` Ulf Hansson
2026-01-27 21:25 ` Kevin Hilman
4 siblings, 0 replies; 8+ messages in thread
From: Ulf Hansson @ 2026-01-27 14:27 UTC (permalink / raw)
To: Ulf Hansson, Dhruva Gole, linux-pm
Cc: Rafael J . Wysocki, Kevin Hilman, linux-arm-kernel, linux-kernel
On Mon, 19 Jan 2026 at 15:31, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> This small series moves around and extends the information that genpd shows for
> the domain idle states in debugs.
>
> Please help review and test!
>
> Kind regards
> Ulf Hansson
>
> Ulf Hansson (3):
> pmdomain: core: Restructure domain idle states data for genpd in
> debugfs
> pmdomain: core: Show latency/residency for domain idle states in
> debugfs
> pmdomain: core: Extend statistics for domain idle states with s2idle
> data
>
> drivers/pmdomain/core.c | 59 +++++++++++++++++++++++++++++++++------
> include/linux/pm_domain.h | 1 +
> 2 files changed, 51 insertions(+), 9 deletions(-)
>
> --
> 2.43.0
>
FYI, the series has been applied for next!
Kind regards
Uffe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] pmdomain: core: Extend domain idle states debugfs support
2026-01-19 14:31 [PATCH 0/3] pmdomain: core: Extend domain idle states debugfs support Ulf Hansson
` (3 preceding siblings ...)
2026-01-27 14:27 ` [PATCH 0/3] pmdomain: core: Extend domain idle states debugfs support Ulf Hansson
@ 2026-01-27 21:25 ` Kevin Hilman
4 siblings, 0 replies; 8+ messages in thread
From: Kevin Hilman @ 2026-01-27 21:25 UTC (permalink / raw)
To: Ulf Hansson, Ulf Hansson, Dhruva Gole, linux-pm
Cc: Rafael J . Wysocki, linux-arm-kernel, linux-kernel
Ulf Hansson <ulf.hansson@linaro.org> writes:
> This small series moves around and extends the information that genpd shows for
> the domain idle states in debugs.
>
> Please help review and test!
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-01-27 21:25 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-19 14:31 [PATCH 0/3] pmdomain: core: Extend domain idle states debugfs support Ulf Hansson
2026-01-19 14:31 ` [PATCH 1/3] pmdomain: core: Restructure domain idle states data for genpd in debugfs Ulf Hansson
2026-01-19 14:31 ` [PATCH 2/3] pmdomain: core: Show latency/residency for domain idle states " Ulf Hansson
2026-01-27 13:56 ` Dhruva Gole
2026-01-19 14:31 ` [PATCH 3/3] pmdomain: core: Extend statistics for domain idle states with s2idle data Ulf Hansson
2026-01-27 13:54 ` Dhruva Gole
2026-01-27 14:27 ` [PATCH 0/3] pmdomain: core: Extend domain idle states debugfs support Ulf Hansson
2026-01-27 21:25 ` Kevin Hilman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox