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, 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 Cc: ulf.hansson@linaro.org, Vincent Guittot <vincent.guittot@linaro.org> Subject: [PATCH v5 1/3] PM/runtime: Add a new interface to get accounted time Date: Fri, 21 Dec 2018 11:33:54 +0100 [thread overview] Message-ID: <1545388436-7489-2-git-send-email-vincent.guittot@linaro.org> (raw) In-Reply-To: <1545388436-7489-1-git-send-email-vincent.guittot@linaro.org> Some drivers (like i915/drm) needs to get the accounted suspended time. pm_runtime_suspended_time() will return the suspended accounted time in ns unit. Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org> --- drivers/base/power/runtime.c | 16 ++++++++++++++++ include/linux/pm_runtime.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index beb85c3..e695544 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -86,6 +86,22 @@ static void __update_runtime_status(struct device *dev, enum rpm_status status) dev->power.runtime_status = status; } +u64 pm_runtime_suspended_time(struct device *dev) +{ + unsigned long flags, time; + + spin_lock_irqsave(&dev->power.lock, flags); + + update_pm_runtime_accounting(dev); + + time = dev->power.suspended_jiffies; + + spin_unlock_irqrestore(&dev->power.lock, flags); + + return jiffies_to_nsecs(time); +} +EXPORT_SYMBOL_GPL(pm_runtime_suspended_time); + /** * pm_runtime_deactivate_timer - Deactivate given device's suspend timer. * @dev: Device to handle. diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index f0fc470..d479707 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -113,6 +113,8 @@ static inline bool pm_runtime_is_irq_safe(struct device *dev) return dev->power.irq_safe; } +extern u64 pm_runtime_suspended_time(struct device *dev); + #else /* !CONFIG_PM */ static inline bool queue_pm_work(struct work_struct *work) { return false; } -- 2.7.4
WARNING: multiple messages have this Message-ID (diff)
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, 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 Cc: ulf.hansson@linaro.org, Vincent Guittot <vincent.guittot@linaro.org> Subject: [PATCH v5 1/3] PM/runtime: Add a new interface to get accounted time Date: Fri, 21 Dec 2018 11:33:54 +0100 [thread overview] Message-ID: <1545388436-7489-2-git-send-email-vincent.guittot@linaro.org> (raw) In-Reply-To: <1545388436-7489-1-git-send-email-vincent.guittot@linaro.org> Some drivers (like i915/drm) needs to get the accounted suspended time. pm_runtime_suspended_time() will return the suspended accounted time in ns unit. Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org> --- drivers/base/power/runtime.c | 16 ++++++++++++++++ include/linux/pm_runtime.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index beb85c3..e695544 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -86,6 +86,22 @@ static void __update_runtime_status(struct device *dev, enum rpm_status status) dev->power.runtime_status = status; } +u64 pm_runtime_suspended_time(struct device *dev) +{ + unsigned long flags, time; + + spin_lock_irqsave(&dev->power.lock, flags); + + update_pm_runtime_accounting(dev); + + time = dev->power.suspended_jiffies; + + spin_unlock_irqrestore(&dev->power.lock, flags); + + return jiffies_to_nsecs(time); +} +EXPORT_SYMBOL_GPL(pm_runtime_suspended_time); + /** * pm_runtime_deactivate_timer - Deactivate given device's suspend timer. * @dev: Device to handle. diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index f0fc470..d479707 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -113,6 +113,8 @@ static inline bool pm_runtime_is_irq_safe(struct device *dev) return dev->power.irq_safe; } +extern u64 pm_runtime_suspended_time(struct device *dev); + #else /* !CONFIG_PM */ static inline bool queue_pm_work(struct work_struct *work) { return false; } -- 2.7.4 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-12-21 10:34 UTC|newest] Thread overview: 45+ 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 ` Vincent Guittot 2018-12-21 10:33 ` Vincent Guittot [this message] 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 10:33 ` Vincent Guittot 2018-12-21 11:33 ` [Intel-gfx] " Tvrtko Ursulin 2018-12-21 13:26 ` Vincent Guittot 2018-12-21 13:26 ` Vincent Guittot 2018-12-31 12:32 ` Tvrtko Ursulin 2018-12-31 12:32 ` Tvrtko Ursulin 2019-01-07 14:03 ` Vincent Guittot 2019-01-07 14:03 ` Vincent Guittot 2019-01-07 14:21 ` Rafael J. Wysocki 2019-01-07 14:21 ` Rafael J. Wysocki 2019-01-16 11:59 ` 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:33 ` Vincent Guittot 2018-12-21 10:43 ` Ulf Hansson 2018-12-21 10:43 ` Ulf Hansson 2019-01-17 22:16 ` Guenter Roeck 2019-01-17 22:16 ` Guenter Roeck 2019-01-18 10:42 ` Vincent Guittot 2019-01-18 10:42 ` Vincent Guittot 2019-01-18 10:53 ` Vincent Guittot 2019-01-18 10:53 ` Vincent Guittot 2019-01-18 11:05 ` Rafael J. Wysocki 2019-01-18 11:05 ` Rafael J. Wysocki 2019-01-18 12:08 ` Guenter Roeck 2019-01-18 12:08 ` Guenter Roeck 2019-01-21 15:17 ` Vincent Guittot 2019-01-21 15:17 ` Vincent Guittot 2019-01-21 15:24 ` Guenter Roeck 2019-01-21 15:24 ` Guenter Roeck 2019-01-21 22:52 ` Rafael J. Wysocki 2019-01-21 22:52 ` Rafael J. Wysocki 2019-01-22 7:57 ` Vincent Guittot 2019-01-22 7:57 ` Vincent Guittot 2019-01-18 12:04 ` Guenter Roeck 2019-01-18 10:54 ` Rafael J. Wysocki 2018-12-21 10:45 ` ✗ Fi.CI.CHECKPATCH: warning for Move pm_runtime accounted time to raw nsec Patchwork 2018-12-21 11:32 ` ✓ Fi.CI.BAT: success " Patchwork 2018-12-21 20:16 ` ✓ Fi.CI.IGT: " Patchwork 2019-01-18 11:07 ` ✗ Fi.CI.BAT: failure for Move pm_runtime accounted time to raw nsec (rev2) Patchwork
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=1545388436-7489-2-git-send-email-vincent.guittot@linaro.org \ --to=vincent.guittot@linaro.org \ --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 \ /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: linkBe 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.