From: Guenter Roeck <linux@roeck-us.net>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
rjw@rjwysocki.net, thara.gopinath@linaro.org,
jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com,
rodrigo.vivi@intel.com, airlied@linux.ie,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
ulf.hansson@linaro.org
Subject: Re: [PATCH v5 3/3] PM/runtime:Replace jiffies based accounting with ktime based accounting
Date: Fri, 18 Jan 2019 04:04:53 -0800 [thread overview]
Message-ID: <03a594f1-d6bb-2e29-aac7-034cd2d9af45@roeck-us.net> (raw)
In-Reply-To: <20190118104215.GA13168@linaro.org>
On 1/18/19 2:42 AM, Vincent Guittot wrote:
> Hi Guenter,
>
> Le Thursday 17 Jan 2019 à 14:16:28 (-0800), Guenter Roeck a écrit :
>> On Fri, Dec 21, 2018 at 11:33:56AM +0100, Vincent Guittot wrote:
>>> From: Thara Gopinath <thara.gopinath@linaro.org>
>>>
>>> This patch replaces jiffies based accounting for runtime_active_time
>>> and runtime_suspended_time with ktime base accounting. This makes the
>>> runtime debug counters inline with genpd and other pm subsytems which
>>> uses ktime based accounting.
>>>
>>> timekeeping is initialized before pm_runtime_init() so ktime_get() will
>>> be ready before first call. In fact, timekeeping_init() is called early
>>> in start_kernel() which is way before driver_init() (and that's when
>>> devices can start to be initialized) called from rest_init() via
>>> kernel_init_freeable() and do_basic_setup().
>>>
>> This is not (always) correct. My qemu "collie" boot test fails with this
>> patch applied. Reverting the patch fixes the problem. Bisect log attached.
>>
>
> Can you try the patch below ?
> ktime_get_mono_fast_ns() has the advantage of being init with dummy clock so
> it can be used at early_init.
>
Yes, that works.
Guenter
> ---
> drivers/base/power/runtime.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
> index ae1c728..118c7f6 100644
> --- a/drivers/base/power/runtime.c
> +++ b/drivers/base/power/runtime.c
> @@ -66,7 +66,7 @@ static int rpm_suspend(struct device *dev, int rpmflags);
> */
> void update_pm_runtime_accounting(struct device *dev)
> {
> - u64 now = ktime_to_ns(ktime_get());
> + u64 now = ktime_get_mono_fast_ns();
> u64 delta;
>
> delta = now - dev->power.accounting_timestamp;
> @@ -1507,7 +1507,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 = ktime_to_ns(ktime_get());
> + dev->power.accounting_timestamp = ktime_get_mono_fast_ns();
> INIT_WORK(&dev->power.work, pm_runtime_work);
>
> dev->power.timer_expires = 0;
>
next prev parent reply other threads:[~2019-01-18 12:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-21 10:33 [PATCH v5 0/3] Move pm_runtime accounted time to raw nsec Vincent Guittot
2018-12-21 10:33 ` [PATCH v5 1/3] PM/runtime: Add a new interface to get accounted time Vincent Guittot
2018-12-21 10:33 ` [PATCH v5 2/3] drm/i915: Move on the new pm runtime interface Vincent Guittot
2018-12-21 11:33 ` [Intel-gfx] " Tvrtko Ursulin
2018-12-21 13:26 ` Vincent Guittot
2018-12-31 12:32 ` Tvrtko Ursulin
2019-01-07 14:03 ` Vincent Guittot
2019-01-07 14:21 ` Rafael J. Wysocki
2019-01-16 11:59 ` Rafael J. Wysocki
2018-12-21 10:33 ` [PATCH v5 3/3] PM/runtime:Replace jiffies based accounting with ktime based accounting Vincent Guittot
2018-12-21 10:43 ` Ulf Hansson
2019-01-17 22:16 ` Guenter Roeck
2019-01-18 10:42 ` Vincent Guittot
2019-01-18 10:53 ` Vincent Guittot
2019-01-18 11:05 ` Rafael J. Wysocki
2019-01-18 12:08 ` Guenter Roeck
2019-01-21 15:17 ` Vincent Guittot
2019-01-21 15:24 ` Guenter Roeck
2019-01-21 22:52 ` Rafael J. Wysocki
2019-01-22 7:57 ` Vincent Guittot
2019-01-18 12:04 ` Guenter Roeck [this message]
2019-01-18 10:54 ` Rafael J. Wysocki
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=03a594f1-d6bb-2e29-aac7-034cd2d9af45@roeck-us.net \
--to=linux@roeck-us.net \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=rodrigo.vivi@intel.com \
--cc=thara.gopinath@linaro.org \
--cc=ulf.hansson@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®