All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thara Gopinath <thara.gopinath@linaro.org>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	Kevin Hilman <khilman@baylibre.com>
Subject: Re: [PATCH 1/2] PM / Domains: Add time accounting to various genpd states.
Date: Wed, 14 Jun 2017 17:01:37 -0400	[thread overview]
Message-ID: <5941A431.1090901@linaro.org> (raw)
In-Reply-To: <CAPDyKFpVnvCv5P8xXBmnabgzvhLAFDVKn1bSM4MysXAzReMsjA@mail.gmail.com>

On 06/14/2017 05:18 AM, Ulf Hansson wrote:
> On 13 June 2017 at 22:17, Thara Gopinath <thara.gopinath@linaro.org> wrote:
>> On 06/07/2017 09:28 AM, Ulf Hansson wrote:
>> Hello Ulf,
>>
>>> On 26 May 2017 at 01:51, Thara Gopinath <thara.gopinath@linaro.org> wrote:
>>>> This patch adds support to calculate the time spent by the generic
>>>> power domains in on and various idle states.
>>>>
>>>> Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>
>>>> ---
>>>>  drivers/base/power/domain.c | 24 ++++++++++++++++++++++++
>>>>  include/linux/pm_domain.h   |  4 ++++
>>>>  2 files changed, 28 insertions(+)
>>>>
>>>> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
>>>> index da49a83..e733796 100644
>>>> --- a/drivers/base/power/domain.c
>>>> +++ b/drivers/base/power/domain.c
>>>> @@ -207,6 +207,25 @@ static void genpd_sd_counter_inc(struct generic_pm_domain *genpd)
>>>>         smp_mb__after_atomic();
>>>>  }
>>>>
>>>> +static void genpd_update_accounting(struct generic_pm_domain *genpd)
>>>
>>> I suggest we have all this within #ifdef CONFIG_DEBUG_FS and add a
>>> stub for !CONFIG_DEBUG_FS.
>>>
>>>> +{
>>>> +       ktime_t delta, now;
>>>> +
>>>> +       now = ktime_get();
>>>> +       delta = ktime_sub(now, genpd->accounting_time);
>>>> +
>>>> +       if (genpd->status == GPD_STATE_ACTIVE) {
>>>> +               genpd->on_time = ktime_add(genpd->on_time, delta);
>>>> +       } else {
>>>> +               int state_idx = genpd->state_idx;
>>>> +
>>>> +               genpd->states[state_idx].active_time =
>>>
>>> "active_time" seems to be a misleading, can we rename it to "idle_time" instead?
>>>
>>>> +                       ktime_add(genpd->states[state_idx].active_time, delta);
>>>> +               genpd->off_time = ktime_add(genpd->off_time, delta);
>>>
>>> Isn't the off_time the summary of the states' genpd->states[i].active_time?
>>>
>>> Then we could do that computation quite easily at the point when
>>> producing the debugfs output instead.
>>>
>>>> +       }
>>>> +       genpd->accounting_time = now;
>>>> +}
>>>> +
>>>>  static int _genpd_power_on(struct generic_pm_domain *genpd, bool timed)
>>>>  {
>>>>         unsigned int state_idx = genpd->state_idx;
>>>> @@ -358,6 +377,7 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
>>>>                         return ret;
>>>>         }
>>>>
>>>> +       genpd_update_accounting(genpd);
>>>
>>> It find it a bit odd to update accounting just before changing the
>>> status. Can we re-work this and update accounting right afterwards
>>> instead? At least to me, that makes this easier to understand.
>>
>> The accounting is being updated for the previous state and not the
>> current state. For eg if the domain has been previously off and just
>> turned on, the time spent in off state is updated. So it
>> upadte_accounting has to be before changing the status.
>> Sorry I did not mention this earlier as I just realized this as
>> I was reworking the patches.
>>
> 
> Yes, I understand.
> 
> However, of course changing this also means that you need to change
> how genpd_update_accounting works. That's was my main point, sorry if
> that wasn't clear.
Ok. Sorry for all the confusion. It is possible to rework
genpd_update_accounting. I sent out the V2 yesterday. I will wait for a
couple of more days for any other review comments on V2 before sending
the re-worked patch set.

Regards
Thara

> 
> Kind regards
> Uffe
> 


-- 
Regards
Thara

  reply	other threads:[~2017-06-14 21:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-25 23:51 [PATCH 0/2] PM / Domains: Expand generic power domain debugfs Thara Gopinath
2017-05-25 23:51 ` [PATCH 1/2] PM / Domains: Add time accounting to various genpd states Thara Gopinath
2017-06-07 13:28   ` Ulf Hansson
2017-06-12 18:51     ` Thara Gopinath
2017-06-13  8:11       ` Ulf Hansson
2017-06-13 12:44         ` Thara Gopinath
2017-06-13 20:17     ` Thara Gopinath
2017-06-14  9:18       ` Ulf Hansson
2017-06-14 21:01         ` Thara Gopinath [this message]
2017-05-25 23:51 ` [PATCH 2/2] PM / Domains: Extend generic power domain debugfs Thara Gopinath
2017-05-29 15:12   ` Geert Uytterhoeven
2017-06-07 19:15     ` Thara Gopinath
2017-06-07 13:51   ` Ulf Hansson
2017-06-12 18:51     ` Thara Gopinath

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=5941A431.1090901@linaro.org \
    --to=thara.gopinath@linaro.org \
    --cc=khilman@baylibre.com \
    --cc=linux-pm@vger.kernel.org \
    --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 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.