linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pm: runtime: fix timer_expires on 32bits arch
@ 2020-09-18 16:55 Grygorii Strashko
  2020-09-18 20:56 ` Pavel Machek
  2020-09-21  6:51 ` Vincent Guittot
  0 siblings, 2 replies; 4+ messages in thread
From: Grygorii Strashko @ 2020-09-18 16:55 UTC (permalink / raw)
  To: Rafael J. Wysocki, linux-pm, Ulf Hansson, Vincent Guittot
  Cc: Len Brown, Pavel Machek, linux-kernel, Grygorii Strashko

The commit 8234f6734c5d ("PM-runtime: Switch autosuspend over to using
hrtimers") switched PM runtime autosuspend to use hrtimers and all related
time accounting in ns, but missed update the struct
dev_pm_info->timer_expires to u64. This causes timer_expires value to be
truncated on 32bits architectures when assignment is done from u64 values:

rpm_suspend()
|- dev->power.timer_expires = expires;

Hence, fix it by changing timer_expires type to u64.

Cc: Vincent Guittot <vincent.guittot@linaro.org>
Fixes: 8234f6734c5d ("PM-runtime: Switch autosuspend over to using hrtimers")
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 include/linux/pm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/pm.h b/include/linux/pm.h
index a30a4b54df52..47aca6bac1d6 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -590,7 +590,7 @@ struct dev_pm_info {
 #endif
 #ifdef CONFIG_PM
 	struct hrtimer		suspend_timer;
-	unsigned long		timer_expires;
+	u64			timer_expires;
 	struct work_struct	work;
 	wait_queue_head_t	wait_queue;
 	struct wake_irq		*wakeirq;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pm: runtime: fix timer_expires on 32bits arch
  2020-09-18 16:55 [PATCH] pm: runtime: fix timer_expires on 32bits arch Grygorii Strashko
@ 2020-09-18 20:56 ` Pavel Machek
  2020-09-21  6:51 ` Vincent Guittot
  1 sibling, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2020-09-18 20:56 UTC (permalink / raw)
  To: Grygorii Strashko
  Cc: Rafael J. Wysocki, linux-pm, Ulf Hansson, Vincent Guittot,
	Len Brown, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 920 bytes --]

On Fri 2020-09-18 19:55:18, Grygorii Strashko wrote:
> The commit 8234f6734c5d ("PM-runtime: Switch autosuspend over to using
> hrtimers") switched PM runtime autosuspend to use hrtimers and all related
> time accounting in ns, but missed update the struct
> dev_pm_info->timer_expires to u64. This causes timer_expires value to be
> truncated on 32bits architectures when assignment is done from u64 values:
> 
> rpm_suspend()
> |- dev->power.timer_expires = expires;
> 
> Hence, fix it by changing timer_expires type to u64.
> 
> Cc: Vincent Guittot <vincent.guittot@linaro.org>
> Fixes: 8234f6734c5d ("PM-runtime: Switch autosuspend over to using hrtimers")
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

Acked-by: Pavel Machek <pavel@ucw.cz>

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pm: runtime: fix timer_expires on 32bits arch
  2020-09-18 16:55 [PATCH] pm: runtime: fix timer_expires on 32bits arch Grygorii Strashko
  2020-09-18 20:56 ` Pavel Machek
@ 2020-09-21  6:51 ` Vincent Guittot
  2020-09-21 14:15   ` Rafael J. Wysocki
  1 sibling, 1 reply; 4+ messages in thread
From: Vincent Guittot @ 2020-09-21  6:51 UTC (permalink / raw)
  To: Grygorii Strashko
  Cc: Rafael J. Wysocki, open list:THERMAL, Ulf Hansson, Len Brown,
	Pavel Machek, linux-kernel

On Fri, 18 Sep 2020 at 18:55, Grygorii Strashko
<grygorii.strashko@ti.com> wrote:
>
> The commit 8234f6734c5d ("PM-runtime: Switch autosuspend over to using
> hrtimers") switched PM runtime autosuspend to use hrtimers and all related
> time accounting in ns, but missed update the struct
> dev_pm_info->timer_expires to u64. This causes timer_expires value to be
> truncated on 32bits architectures when assignment is done from u64 values:
>
> rpm_suspend()
> |- dev->power.timer_expires = expires;
>
> Hence, fix it by changing timer_expires type to u64.
>
> Cc: Vincent Guittot <vincent.guittot@linaro.org>
> Fixes: 8234f6734c5d ("PM-runtime: Switch autosuspend over to using hrtimers")
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

Acked-by: Vincent Guittot <vincent.guittot@linaro.org>

> ---
>  include/linux/pm.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/pm.h b/include/linux/pm.h
> index a30a4b54df52..47aca6bac1d6 100644
> --- a/include/linux/pm.h
> +++ b/include/linux/pm.h
> @@ -590,7 +590,7 @@ struct dev_pm_info {
>  #endif
>  #ifdef CONFIG_PM
>         struct hrtimer          suspend_timer;
> -       unsigned long           timer_expires;
> +       u64                     timer_expires;
>         struct work_struct      work;
>         wait_queue_head_t       wait_queue;
>         struct wake_irq         *wakeirq;
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pm: runtime: fix timer_expires on 32bits arch
  2020-09-21  6:51 ` Vincent Guittot
@ 2020-09-21 14:15   ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2020-09-21 14:15 UTC (permalink / raw)
  To: Vincent Guittot, Grygorii Strashko
  Cc: Rafael J. Wysocki, open list:THERMAL, Ulf Hansson, Len Brown,
	Pavel Machek, linux-kernel

On Mon, Sep 21, 2020 at 8:51 AM Vincent Guittot
<vincent.guittot@linaro.org> wrote:
>
> On Fri, 18 Sep 2020 at 18:55, Grygorii Strashko
> <grygorii.strashko@ti.com> wrote:
> >
> > The commit 8234f6734c5d ("PM-runtime: Switch autosuspend over to using
> > hrtimers") switched PM runtime autosuspend to use hrtimers and all related
> > time accounting in ns, but missed update the struct
> > dev_pm_info->timer_expires to u64. This causes timer_expires value to be
> > truncated on 32bits architectures when assignment is done from u64 values:
> >
> > rpm_suspend()
> > |- dev->power.timer_expires = expires;
> >
> > Hence, fix it by changing timer_expires type to u64.
> >
> > Cc: Vincent Guittot <vincent.guittot@linaro.org>
> > Fixes: 8234f6734c5d ("PM-runtime: Switch autosuspend over to using hrtimers")
> > Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
>
> Acked-by: Vincent Guittot <vincent.guittot@linaro.org>

Applied as 5.9-rc7 material with some edits in the subject and
changelog, thanks!

> > ---
> >  include/linux/pm.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/include/linux/pm.h b/include/linux/pm.h
> > index a30a4b54df52..47aca6bac1d6 100644
> > --- a/include/linux/pm.h
> > +++ b/include/linux/pm.h
> > @@ -590,7 +590,7 @@ struct dev_pm_info {
> >  #endif
> >  #ifdef CONFIG_PM
> >         struct hrtimer          suspend_timer;
> > -       unsigned long           timer_expires;
> > +       u64                     timer_expires;
> >         struct work_struct      work;
> >         wait_queue_head_t       wait_queue;
> >         struct wake_irq         *wakeirq;
> > --
> > 2.17.1
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-21 14:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18 16:55 [PATCH] pm: runtime: fix timer_expires on 32bits arch Grygorii Strashko
2020-09-18 20:56 ` Pavel Machek
2020-09-21  6:51 ` Vincent Guittot
2020-09-21 14:15   ` Rafael J. Wysocki

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).