mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vincent Guittot <vincent.guittot@linaro.org>
To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	rjw@rjwysocki.net, thara.gopinath@linaro.org, linux@roeck-us.net
Cc: ulf.hansson@linaro.org, Vincent Guittot <vincent.guittot@linaro.org>
Subject: [PATCH v6 1/2] PM-runtime: update accounting_timestamp only when enable
Date: Tue, 22 Jan 2019 15:24:29 +0100	[thread overview]
Message-ID: <1548167070-421-2-git-send-email-vincent.guittot@linaro.org> (raw)
In-Reply-To: <1548167070-421-1-git-send-email-vincent.guittot@linaro.org>

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.

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


  reply	other threads:[~2019-01-22 14:24 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 ` Vincent Guittot [this message]
2019-01-22 15:13   ` [PATCH v6 1/2] PM-runtime: update accounting_timestamp only when enable Rafael J. Wysocki
2019-01-22 16:01     ` Vincent Guittot
2019-01-23  8:13   ` Ulf Hansson
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=1548167070-421-2-git-send-email-vincent.guittot@linaro.org \
    --to=vincent.guittot@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=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 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®