diff mbox series

pm: runtime: fix timer_expires on 32bits arch

Message ID 20200918165518.23246-1-grygorii.strashko@ti.com (mailing list archive)
State Mainlined, archived
Headers show
Series pm: runtime: fix timer_expires on 32bits arch | expand

Commit Message

Grygorii Strashko Sept. 18, 2020, 4:55 p.m. UTC
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(-)

Comments

Pavel Machek Sept. 18, 2020, 8:56 p.m. UTC | #1
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>
Vincent Guittot Sept. 21, 2020, 6:51 a.m. UTC | #2
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
>
Rafael J. Wysocki Sept. 21, 2020, 2:15 p.m. UTC | #3
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
> >
diff mbox series

Patch

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;