* [PATCH v4 0/3] Move pm_runtime accounted time to raw nsec
@ 2018-12-20 14:16 Vincent Guittot
2018-12-20 14:16 ` [PATCH v4 1/3] PM/runtime: Add a new interface to get accounted time Vincent Guittot
0 siblings, 1 reply; 3+ messages in thread
From: Vincent Guittot @ 2018-12-20 14:16 UTC (permalink / raw)
To: linux-pm, linux-kernel, rjw, thara.gopinath, jani.nikula,
joonas.lahtinen, rodrigo.vivi, airlied, intel-gfx, dri-devel
Cc: ulf.hansson, Vincent Guittot
Move pm_runtime accounted time to raw nsec. The subject of the patchset
has changed as the 1st patch of the previous version has been queued by
Rafael.
Patch 1 adds a new pm_runtime interface to get accounted suspended time
Patch 2 moves drm/i915 driver on the new interface and removes access to
internal fields.
Patch 3 moves time accounting on raw ns. This patch initially used
ktime instead of raw ns but it was easier to move i915 driver on raw ns
than on ktime.
Changes since v3:
- Rebase on v4.20-rc7 without patch that has been queued by Rafael
- Simplify the new interface pm_runtime_suspended_time()
Changes since v2:
- remove patch1 that has been queued by rafael
- add new interface in pm_runtime to get accounted time
- reorder patchset to prevent compilation error
Changes since v1:
- updated commit message of patch 1
- Added patches 2 & 3 to move runtime_pm accounting on raw ns
Thara Gopinath (1):
PM/runtime:Replace jiffies based accounting with ktime based
accounting
Vincent Guittot (2):
PM/runtime: Add a new interface to get accounted time
drm/i915: Move on the new pm runtime interface
drivers/base/power/runtime.c | 27 ++++++++++++++++++++++-----
drivers/base/power/sysfs.c | 11 ++++++++---
drivers/gpu/drm/i915/i915_pmu.c | 16 ++++++----------
drivers/gpu/drm/i915/i915_pmu.h | 4 ++--
include/linux/pm.h | 6 +++---
include/linux/pm_runtime.h | 2 ++
6 files changed, 43 insertions(+), 23 deletions(-)
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v4 1/3] PM/runtime: Add a new interface to get accounted time
2018-12-20 14:16 [PATCH v4 0/3] Move pm_runtime accounted time to raw nsec Vincent Guittot
@ 2018-12-20 14:16 ` Vincent Guittot
2018-12-20 22:03 ` Ulf Hansson
0 siblings, 1 reply; 3+ messages in thread
From: Vincent Guittot @ 2018-12-20 14:16 UTC (permalink / raw)
To: linux-pm, linux-kernel, rjw, thara.gopinath, jani.nikula,
joonas.lahtinen, rodrigo.vivi, airlied, intel-gfx, dri-devel
Cc: ulf.hansson, Vincent Guittot
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.
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v4 1/3] PM/runtime: Add a new interface to get accounted time
2018-12-20 14:16 ` [PATCH v4 1/3] PM/runtime: Add a new interface to get accounted time Vincent Guittot
@ 2018-12-20 22:03 ` Ulf Hansson
0 siblings, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2018-12-20 22:03 UTC (permalink / raw)
To: Vincent Guittot
Cc: Linux PM, Linux Kernel Mailing List, Rafael J. Wysocki,
Thara Gopinath, jani.nikula, Joonas Lahtinen, rodrigo.vivi,
David Airlie,
Intel graphics driver community testing & development,
dri-devel
On Thu, 20 Dec 2018 at 15:16, Vincent Guittot
<vincent.guittot@linaro.org> wrote:
>
> 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.
>
> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Kind regards
Uffe
> ---
> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-20 22:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-20 14:16 [PATCH v4 0/3] Move pm_runtime accounted time to raw nsec Vincent Guittot
2018-12-20 14:16 ` [PATCH v4 1/3] PM/runtime: Add a new interface to get accounted time Vincent Guittot
2018-12-20 22:03 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).