From: Ulf Hansson <ulf.hansson@linaro.org>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Linux PM <linux-pm@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Thara Gopinath <thara.gopinath@linaro.org>,
Guenter Roeck <linux@roeck-us.net>
Subject: Re: [PATCH v6 1/2] PM-runtime: update accounting_timestamp only when enable
Date: Wed, 23 Jan 2019 09:13:47 +0100 [thread overview]
Message-ID: <CAPDyKFqeo1Yxso-iYF4Co-eRYXKDRmiFHi9i5wiZSCXGtgSdkQ@mail.gmail.com> (raw)
In-Reply-To: <1548167070-421-2-git-send-email-vincent.guittot@linaro.org>
On Tue, 22 Jan 2019 at 15:24, Vincent Guittot
<vincent.guittot@linaro.org> wrote:
>
> Initializing accounting_timestamp to something different from 0 during
> pm_runtime_init() doesn't make sense and put useless ordering constraint between
> timekeeping_init() and pm_runtime_init().
> PM runtime should start accounting time only when it is enable and discard
> the period when disabled.
> Set accounting_timestamp to now when enabling PM runtime.
Hmm, my first impression is that this sounds like a reasonable thing
to do. However, there are couple of more things to consider.
1) update_pm_runtime_accounting() is setting a new value of
dev->power.accounting_timestamp, no matter of whether runtime PM has
been enabled. That's seems wrong to me, at least from the perspective
of what we are trying to change here. So you probably needs to fix
that too.
2) I don't think you explicitly need to set
dev->power.accounting_timestamp to zero at pm_runtime_init(). Just
leave it uninitialized, as we are anyways going to initialize it
before we make use of it.
3) How will this change affect accounting while being system
suspended? As you know, the PM core disables and re-enables runtime PM
during a system suspend/resume sequence. It looks to me, that you
actually need to call update_pm_runtime_accounting() from
pm_runtime_enable|disable(), or something along those lines, as to get
the accounting correct, no?
>
> Suggested-by: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
> ---
> drivers/base/power/runtime.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
> index fb5e2b6..7df1d05 100644
> --- a/drivers/base/power/runtime.c
> +++ b/drivers/base/power/runtime.c
> @@ -1306,6 +1306,10 @@ void pm_runtime_enable(struct device *dev)
>
> spin_lock_irqsave(&dev->power.lock, flags);
>
> + /* About to enable runtime pm, set accounting_timestamp to now */
> + if (dev->power.disable_depth == 1)
> + dev->power.accounting_timestamp = jiffies;
> +
> if (dev->power.disable_depth > 0)
> dev->power.disable_depth--;
> else
> @@ -1506,7 +1510,7 @@ void pm_runtime_init(struct device *dev)
> dev->power.request_pending = false;
> dev->power.request = RPM_REQ_NONE;
> dev->power.deferred_resume = false;
> - dev->power.accounting_timestamp = jiffies;
> + dev->power.accounting_timestamp = 0;
> INIT_WORK(&dev->power.work, pm_runtime_work);
>
> dev->power.timer_expires = 0;
> --
> 2.7.4
>
next prev parent reply other threads:[~2019-01-23 8:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-22 14:24 [PATCH v6 0/3] Move pm_runtime accounted time to raw nsec Vincent Guittot
2019-01-22 14:24 ` [PATCH v6 1/2] PM-runtime: update accounting_timestamp only when enable Vincent Guittot
2019-01-22 15:13 ` Rafael J. Wysocki
2019-01-22 16:01 ` Vincent Guittot
2019-01-23 8:13 ` Ulf Hansson [this message]
2019-01-23 8:50 ` Vincent Guittot
2019-01-23 9:35 ` Ulf Hansson
2019-01-22 14:24 ` [PATCH 2/2] PM-runtime: Replace jiffies based accounting with ktime-based accounting Vincent Guittot
2019-01-22 14:27 ` Vincent Guittot
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=CAPDyKFqeo1Yxso-iYF4Co-eRYXKDRmiFHi9i5wiZSCXGtgSdkQ@mail.gmail.com \
--to=ulf.hansson@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=rjw@rjwysocki.net \
--cc=thara.gopinath@linaro.org \
--cc=vincent.guittot@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
all inboxes | Powered by JetHome®