Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pm-5.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
"These fix a PM-runtime framework regression introduced by the recent
switch-over of device autosuspend to hrtimers and a mistake in the
"poll idle state" code introduced by a recent change in it.

Specifics:

- Since ktime_get() turns out to be problematic for device
autosuspend in the PM-runtime framework, make it use
ktime_get_mono_fast_ns() instead (Vincent Guittot).

- Fix an initial value of a local variable in the "poll idle state"
code that makes it behave not exactly as expected when all idle
states except for the "polling" one are disabled (Doug Smythies)"

* tag 'pm-5.0-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
cpuidle: poll_state: Fix default time limit
PM-runtime: Fix deadlock with ktime_get()

+7 -7
+5 -5
drivers/base/power/runtime.c
··· 130 130 { 131 131 int autosuspend_delay; 132 132 u64 last_busy, expires = 0; 133 - u64 now = ktime_to_ns(ktime_get()); 133 + u64 now = ktime_get_mono_fast_ns(); 134 134 135 135 if (!dev->power.use_autosuspend) 136 136 goto out; ··· 909 909 * If 'expires' is after the current time, we've been called 910 910 * too early. 911 911 */ 912 - if (expires > 0 && expires < ktime_to_ns(ktime_get())) { 912 + if (expires > 0 && expires < ktime_get_mono_fast_ns()) { 913 913 dev->power.timer_expires = 0; 914 914 rpm_suspend(dev, dev->power.timer_autosuspends ? 915 915 (RPM_ASYNC | RPM_AUTO) : RPM_ASYNC); ··· 928 928 int pm_schedule_suspend(struct device *dev, unsigned int delay) 929 929 { 930 930 unsigned long flags; 931 - ktime_t expires; 931 + u64 expires; 932 932 int retval; 933 933 934 934 spin_lock_irqsave(&dev->power.lock, flags); ··· 945 945 /* Other scheduled or pending requests need to be canceled. */ 946 946 pm_runtime_cancel_pending(dev); 947 947 948 - expires = ktime_add(ktime_get(), ms_to_ktime(delay)); 949 - dev->power.timer_expires = ktime_to_ns(expires); 948 + expires = ktime_get_mono_fast_ns() + (u64)delay * NSEC_PER_MSEC; 949 + dev->power.timer_expires = expires; 950 950 dev->power.timer_autosuspends = 0; 951 951 hrtimer_start(&dev->power.suspend_timer, expires, HRTIMER_MODE_ABS); 952 952
+1 -1
drivers/cpuidle/poll_state.c
··· 21 21 local_irq_enable(); 22 22 if (!current_set_polling_and_test()) { 23 23 unsigned int loop_count = 0; 24 - u64 limit = TICK_USEC; 24 + u64 limit = TICK_NSEC; 25 25 int i; 26 26 27 27 for (i = 1; i < drv->state_count; i++) {
+1 -1
include/linux/pm_runtime.h
··· 105 105 106 106 static inline void pm_runtime_mark_last_busy(struct device *dev) 107 107 { 108 - WRITE_ONCE(dev->power.last_busy, ktime_to_ns(ktime_get())); 108 + WRITE_ONCE(dev->power.last_busy, ktime_get_mono_fast_ns()); 109 109 } 110 110 111 111 static inline bool pm_runtime_is_irq_safe(struct device *dev)