Skip to contentSkip to conversation

pm: runtime: fix timer_expires on 32bits arch

PATCH Applied Grygorii Strashko 4 participants 4 messages Sep 18, 2020 – Sep 21, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pm: runtime: fix timer_expires on 32bits arch

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 <[email protected]>
Fixes 8234f6734c5d ("PM-runtime: Switch autosuspend over to using hrtimers")
---
 include/linux/pm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/pm.h +1 -1
index a30a4b54df52..47aca6bac1d6 100644
@@ -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;
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · 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:

Quoted 8 lines

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

Hence, fix it by changing timer_expires type to u64.

Cc Vincent Guittot <[email protected]>
Fixes 8234f6734c5d ("PM-runtime: Switch autosuspend over to using hrtimers")
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Acked-by on v1 1/1
#2 lore raw
In reply to Grygorii Strashko
Quoted 7 lines · 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:

Quoted 8 lines

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

Hence, fix it by changing timer_expires type to u64.

Cc Vincent Guittot <[email protected]>
Fixes 8234f6734c5d ("PM-runtime: Switch autosuspend over to using hrtimers")
Quoted 20 lines
---
 include/linux/pm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/pm.h +1 -2
index a30a4b54df52..47aca6bac1d6 100644
@@ -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

maintainer Applied
#3 lore raw
Quoted 13 lines · Vincent Guittot
Quoted 10 lines · 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;

Quoted 7 lines
Quoted 5 lines

Hence, fix it by changing timer_expires type to u64.

Cc Vincent Guittot <[email protected]>
Fixes 8234f6734c5d ("PM-runtime: Switch autosuspend over to using hrtimers")

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

Quoted 20 lines
Quoted 20 lines
---
 include/linux/pm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/pm.h +1 -2
index a30a4b54df52..47aca6bac1d6 100644
@@ -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