Linux-ARM-MSM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v3] PM / Domains: enable domain idle state accounting
@ 2020-10-15 20:47 Lina Iyer
  2020-10-16 15:55 ` Rafael J. Wysocki
  0 siblings, 1 reply; 7+ messages in thread
From: Lina Iyer @ 2020-10-15 20:47 UTC (permalink / raw)
  To: rjw, ulf.hansson, linux-pm; +Cc: linux-arm-msm, Lina Iyer

To enable better debug of PM domains, let's keep a track of the success
and rejections 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>
---
Changes in v3:
	- Rebased on top of mainline
---
 drivers/base/power/domain.c | 10 +++++++---
 include/linux/pm_domain.h   |  2 ++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 2cb5e04cf86c..20ecc1a7113c 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -559,12 +559,15 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
 		 * happen very often).
 		 */
 		ret = _genpd_power_off(genpd, true);
-		if (ret)
+		if (ret) {
+			genpd->states[genpd->state_idx].rejected++;
 			return ret;
+		}
 	}
 
 	genpd->status = GPD_STATE_POWER_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);
@@ -2932,7 +2935,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;
@@ -2944,7 +2947,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);
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index ee11502a575b..1d9a8de6b7ac 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 rejected;
 	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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] PM / Domains: enable domain idle state accounting
  2020-10-15 20:47 [PATCH v3] PM / Domains: enable domain idle state accounting Lina Iyer
@ 2020-10-16 15:55 ` Rafael J. Wysocki
  2020-10-16 16:07   ` Lina Iyer
  0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2020-10-16 15:55 UTC (permalink / raw)
  To: Lina Iyer; +Cc: Rafael J. Wysocki, Ulf Hansson, Linux PM, linux-arm-msm

On Thu, Oct 15, 2020 at 10:47 PM Lina Iyer <ilina@codeaurora.org> wrote:
>
> To enable better debug of PM domains, let's keep a track of the success
> and rejections 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>
> ---
> Changes in v3:
>         - Rebased on top of mainline

I still needed to rebase it to apply it to my tree, so please double
check the result in the bleeding-edge branch.

Thanks!

> ---
>  drivers/base/power/domain.c | 10 +++++++---
>  include/linux/pm_domain.h   |  2 ++
>  2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 2cb5e04cf86c..20ecc1a7113c 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -559,12 +559,15 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
>                  * happen very often).
>                  */
>                 ret = _genpd_power_off(genpd, true);
> -               if (ret)
> +               if (ret) {
> +                       genpd->states[genpd->state_idx].rejected++;
>                         return ret;
> +               }
>         }
>
>         genpd->status = GPD_STATE_POWER_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);
> @@ -2932,7 +2935,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;
> @@ -2944,7 +2947,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);
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index ee11502a575b..1d9a8de6b7ac 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 rejected;
>         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
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] PM / Domains: enable domain idle state accounting
  2020-10-16 15:55 ` Rafael J. Wysocki
@ 2020-10-16 16:07   ` Lina Iyer
  2020-10-16 16:13     ` Rafael J. Wysocki
  0 siblings, 1 reply; 7+ messages in thread
From: Lina Iyer @ 2020-10-16 16:07 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Rafael J. Wysocki, Ulf Hansson, Linux PM, linux-arm-msm

On Fri, Oct 16 2020 at 09:55 -0600, Rafael J. Wysocki wrote:
>On Thu, Oct 15, 2020 at 10:47 PM Lina Iyer <ilina@codeaurora.org> wrote:
>>
>> To enable better debug of PM domains, let's keep a track of the success
>> and rejections 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>
>> ---
>> Changes in v3:
>>         - Rebased on top of mainline
>
>I still needed to rebase it to apply it to my tree, so please double
>check the result in the bleeding-edge branch.
>
Okay, will rebase on that branch and post shortly.
Thanks Rafael.

>Thanks!
>
>> ---
>>  drivers/base/power/domain.c | 10 +++++++---
>>  include/linux/pm_domain.h   |  2 ++
>>  2 files changed, 9 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
>> index 2cb5e04cf86c..20ecc1a7113c 100644
>> --- a/drivers/base/power/domain.c
>> +++ b/drivers/base/power/domain.c
>> @@ -559,12 +559,15 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
>>                  * happen very often).
>>                  */
>>                 ret = _genpd_power_off(genpd, true);
>> -               if (ret)
>> +               if (ret) {
>> +                       genpd->states[genpd->state_idx].rejected++;
>>                         return ret;
>> +               }
>>         }
>>
>>         genpd->status = GPD_STATE_POWER_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);
>> @@ -2932,7 +2935,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;
>> @@ -2944,7 +2947,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);
>> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
>> index ee11502a575b..1d9a8de6b7ac 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 rejected;
>>         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
>>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] PM / Domains: enable domain idle state accounting
  2020-10-16 16:07   ` Lina Iyer
@ 2020-10-16 16:13     ` Rafael J. Wysocki
  2020-10-16 16:21       ` Lina Iyer
  0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2020-10-16 16:13 UTC (permalink / raw)
  To: Lina Iyer
  Cc: Rafael J. Wysocki, Rafael J. Wysocki, Ulf Hansson, Linux PM,
	linux-arm-msm

On Fri, Oct 16, 2020 at 6:07 PM Lina Iyer <ilina@codeaurora.org> wrote:
>
> On Fri, Oct 16 2020 at 09:55 -0600, Rafael J. Wysocki wrote:
> >On Thu, Oct 15, 2020 at 10:47 PM Lina Iyer <ilina@codeaurora.org> wrote:
> >>
> >> To enable better debug of PM domains, let's keep a track of the success
> >> and rejections 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>
> >> ---
> >> Changes in v3:
> >>         - Rebased on top of mainline
> >
> >I still needed to rebase it to apply it to my tree, so please double
> >check the result in the bleeding-edge branch.
> >
> Okay, will rebase on that branch and post shortly.

No need, it's been applied already, just please check the result in
bleeding-edge.

Thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] PM / Domains: enable domain idle state accounting
  2020-10-16 16:13     ` Rafael J. Wysocki
@ 2020-10-16 16:21       ` Lina Iyer
  2020-10-16 16:32         ` Rafael J. Wysocki
  0 siblings, 1 reply; 7+ messages in thread
From: Lina Iyer @ 2020-10-16 16:21 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Rafael J. Wysocki, Ulf Hansson, Linux PM, linux-arm-msm

On Fri, Oct 16 2020 at 10:13 -0600, Rafael J. Wysocki wrote:
>On Fri, Oct 16, 2020 at 6:07 PM Lina Iyer <ilina@codeaurora.org> wrote:
>>
>> On Fri, Oct 16 2020 at 09:55 -0600, Rafael J. Wysocki wrote:
>> >On Thu, Oct 15, 2020 at 10:47 PM Lina Iyer <ilina@codeaurora.org> wrote:
>> >>
>> >> To enable better debug of PM domains, let's keep a track of the success
>> >> and rejections 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>
>> >> ---
>> >> Changes in v3:
>> >>         - Rebased on top of mainline
>> >
>> >I still needed to rebase it to apply it to my tree, so please double
>> >check the result in the bleeding-edge branch.
>> >
>> Okay, will rebase on that branch and post shortly.
>
>No need, it's been applied already, just please check the result in
>bleeding-edge.
>
I think I may have the wrong bleeding-edge branch. Is it not 
https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/log/?h=bleeding-edge

Apologize for the confusion. 

--Lina

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] PM / Domains: enable domain idle state accounting
  2020-10-16 16:21       ` Lina Iyer
@ 2020-10-16 16:32         ` Rafael J. Wysocki
  2020-10-16 16:43           ` Lina Iyer
  0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2020-10-16 16:32 UTC (permalink / raw)
  To: Lina Iyer
  Cc: Rafael J. Wysocki, Rafael J. Wysocki, Ulf Hansson, Linux PM,
	linux-arm-msm

On Fri, Oct 16, 2020 at 6:21 PM Lina Iyer <ilina@codeaurora.org> wrote:
>
> On Fri, Oct 16 2020 at 10:13 -0600, Rafael J. Wysocki wrote:
> >On Fri, Oct 16, 2020 at 6:07 PM Lina Iyer <ilina@codeaurora.org> wrote:
> >>
> >> On Fri, Oct 16 2020 at 09:55 -0600, Rafael J. Wysocki wrote:
> >> >On Thu, Oct 15, 2020 at 10:47 PM Lina Iyer <ilina@codeaurora.org> wrote:
> >> >>
> >> >> To enable better debug of PM domains, let's keep a track of the success
> >> >> and rejections 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>
> >> >> ---
> >> >> Changes in v3:
> >> >>         - Rebased on top of mainline
> >> >
> >> >I still needed to rebase it to apply it to my tree, so please double
> >> >check the result in the bleeding-edge branch.
> >> >
> >> Okay, will rebase on that branch and post shortly.
> >
> >No need, it's been applied already, just please check the result in
> >bleeding-edge.
> >
> I think I may have the wrong bleeding-edge branch. Is it not
> https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/log/?h=bleeding-edge
>
> Apologize for the confusion.

Yes, it is now. :-)

It was not pushed out before, sorry.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] PM / Domains: enable domain idle state accounting
  2020-10-16 16:32         ` Rafael J. Wysocki
@ 2020-10-16 16:43           ` Lina Iyer
  0 siblings, 0 replies; 7+ messages in thread
From: Lina Iyer @ 2020-10-16 16:43 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Rafael J. Wysocki, Ulf Hansson, Linux PM, linux-arm-msm

On Fri, Oct 16 2020 at 10:32 -0600, Rafael J. Wysocki wrote:
>On Fri, Oct 16, 2020 at 6:21 PM Lina Iyer <ilina@codeaurora.org> wrote:
>>
>> On Fri, Oct 16 2020 at 10:13 -0600, Rafael J. Wysocki wrote:
>> >On Fri, Oct 16, 2020 at 6:07 PM Lina Iyer <ilina@codeaurora.org> wrote:
>> >>
>> >> On Fri, Oct 16 2020 at 09:55 -0600, Rafael J. Wysocki wrote:
>> >> >On Thu, Oct 15, 2020 at 10:47 PM Lina Iyer <ilina@codeaurora.org> wrote:
>> >> >>
>> >> >> To enable better debug of PM domains, let's keep a track of the success
>> >> >> and rejections 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>
>> >> >> ---
>> >> >> Changes in v3:
>> >> >>         - Rebased on top of mainline
>> >> >
>> >> >I still needed to rebase it to apply it to my tree, so please double
>> >> >check the result in the bleeding-edge branch.
>> >> >
>> >> Okay, will rebase on that branch and post shortly.
>> >
>> >No need, it's been applied already, just please check the result in
>> >bleeding-edge.
>> >
>> I think I may have the wrong bleeding-edge branch. Is it not
>> https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/log/?h=bleeding-edge
>>
>> Apologize for the confusion.
>
>Yes, it is now. :-)
>
>It was not pushed out before, sorry.

Thanks, now I see it and looks good to me.

--Lina

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 20:47 [PATCH v3] PM / Domains: enable domain idle state accounting Lina Iyer
2020-10-16 15:55 ` Rafael J. Wysocki
2020-10-16 16:07   ` Lina Iyer
2020-10-16 16:13     ` Rafael J. Wysocki
2020-10-16 16:21       ` Lina Iyer
2020-10-16 16:32         ` Rafael J. Wysocki
2020-10-16 16:43           ` Lina Iyer

Linux-ARM-MSM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-msm/0 linux-arm-msm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-msm linux-arm-msm/ https://lore.kernel.org/linux-arm-msm \
		linux-arm-msm@vger.kernel.org
	public-inbox-index linux-arm-msm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-arm-msm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git