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-4.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
"These fix two PCI power management regressions from the 4.13 cycle and
one cpufreq schedutil governor bug introduced during the 4.12 cycle,
drop a stale comment from the schedutil code and fix two mistakes in
docs.

Specifics:

- Restore device_may_wakeup() check in pci_enable_wake() removed
inadvertently during the 4.13 cycle to prevent systems from drawing
excessive power when suspended or off, among other things (Rafael
Wysocki).

- Fix pci_dev_run_wake() to properly handle devices that only can
signal PME# when in the D3cold power state (Kai Heng Feng).

- Fix the schedutil cpufreq governor to avoid using UINT_MAX as the
new CPU frequency in some cases due to a missing check (Rafael
Wysocki).

- Remove a stale comment regarding worker kthreads from the schedutil
cpufreq governor (Juri Lelli).

- Fix a copy-paste mistake in the intel_pstate driver documentation
(Juri Lelli).

- Fix a typo in the system sleep states documentation (Jonathan
Neuschäfer)"

* tag 'pm-4.17-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
PCI / PM: Check device_may_wakeup() in pci_enable_wake()
PCI / PM: Always check PME wakeup capability for runtime wakeup support
cpufreq: schedutil: Avoid using invalid next_freq
cpufreq: schedutil: remove stale comment
PM: docs: intel_pstate: fix Active Mode w/o HWP paragraph
PM: docs: sleep-states: Fix a typo ("includig")

+31 -26
+1 -1
Documentation/admin-guide/pm/intel_pstate.rst
··· 145 145 146 146 In this mode ``intel_pstate`` registers utilization update callbacks with the 147 147 CPU scheduler in order to run a P-state selection algorithm, either 148 - ``powersave`` or ``performance``, depending on the ``scaling_cur_freq`` policy 148 + ``powersave`` or ``performance``, depending on the ``scaling_governor`` policy 149 149 setting in ``sysfs``. The current CPU frequency information to be made 150 150 available from the ``scaling_cur_freq`` policy attribute in ``sysfs`` is 151 151 periodically updated by those utilization update callbacks too.
+1 -1
Documentation/admin-guide/pm/sleep-states.rst
··· 15 15 ================================== 16 16 17 17 Depending on its configuration and the capabilities of the platform it runs on, 18 - the Linux kernel can support up to four system sleep states, includig 18 + the Linux kernel can support up to four system sleep states, including 19 19 hibernation and up to three variants of system suspend. The sleep states that 20 20 can be supported by the kernel are listed below. 21 21
+27 -10
drivers/pci/pci.c
··· 1910 1910 EXPORT_SYMBOL(pci_pme_active); 1911 1911 1912 1912 /** 1913 - * pci_enable_wake - enable PCI device as wakeup event source 1913 + * __pci_enable_wake - enable PCI device as wakeup event source 1914 1914 * @dev: PCI device affected 1915 1915 * @state: PCI state from which device will issue wakeup events 1916 1916 * @enable: True to enable event generation; false to disable ··· 1928 1928 * Error code depending on the platform is returned if both the platform and 1929 1929 * the native mechanism fail to enable the generation of wake-up events 1930 1930 */ 1931 - int pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable) 1931 + static int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable) 1932 1932 { 1933 1933 int ret = 0; 1934 1934 ··· 1969 1969 1970 1970 return ret; 1971 1971 } 1972 + 1973 + /** 1974 + * pci_enable_wake - change wakeup settings for a PCI device 1975 + * @pci_dev: Target device 1976 + * @state: PCI state from which device will issue wakeup events 1977 + * @enable: Whether or not to enable event generation 1978 + * 1979 + * If @enable is set, check device_may_wakeup() for the device before calling 1980 + * __pci_enable_wake() for it. 1981 + */ 1982 + int pci_enable_wake(struct pci_dev *pci_dev, pci_power_t state, bool enable) 1983 + { 1984 + if (enable && !device_may_wakeup(&pci_dev->dev)) 1985 + return -EINVAL; 1986 + 1987 + return __pci_enable_wake(pci_dev, state, enable); 1988 + } 1972 1989 EXPORT_SYMBOL(pci_enable_wake); 1973 1990 1974 1991 /** ··· 1998 1981 * should not be called twice in a row to enable wake-up due to PCI PM vs ACPI 1999 1982 * ordering constraints. 2000 1983 * 2001 - * This function only returns error code if the device is not capable of 2002 - * generating PME# from both D3_hot and D3_cold, and the platform is unable to 2003 - * enable wake-up power for it. 1984 + * This function only returns error code if the device is not allowed to wake 1985 + * up the system from sleep or it is not capable of generating PME# from both 1986 + * D3_hot and D3_cold and the platform is unable to enable wake-up power for it. 2004 1987 */ 2005 1988 int pci_wake_from_d3(struct pci_dev *dev, bool enable) 2006 1989 { ··· 2131 2114 2132 2115 dev->runtime_d3cold = target_state == PCI_D3cold; 2133 2116 2134 - pci_enable_wake(dev, target_state, pci_dev_run_wake(dev)); 2117 + __pci_enable_wake(dev, target_state, pci_dev_run_wake(dev)); 2135 2118 2136 2119 error = pci_set_power_state(dev, target_state); 2137 2120 ··· 2155 2138 { 2156 2139 struct pci_bus *bus = dev->bus; 2157 2140 2158 - if (device_can_wakeup(&dev->dev)) 2159 - return true; 2160 - 2161 2141 if (!dev->pme_support) 2162 2142 return false; 2163 2143 2164 2144 /* PME-capable in principle, but not from the target power state */ 2165 - if (!pci_pme_capable(dev, pci_target_state(dev, false))) 2145 + if (!pci_pme_capable(dev, pci_target_state(dev, true))) 2166 2146 return false; 2147 + 2148 + if (device_can_wakeup(&dev->dev)) 2149 + return true; 2167 2150 2168 2151 while (bus->parent) { 2169 2152 struct pci_dev *bridge = bus->self;
+2 -14
kernel/sched/cpufreq_schedutil.c
··· 305 305 * Do not reduce the frequency if the CPU has not been idle 306 306 * recently, as the reduction is likely to be premature then. 307 307 */ 308 - if (busy && next_f < sg_policy->next_freq) { 308 + if (busy && next_f < sg_policy->next_freq && 309 + sg_policy->next_freq != UINT_MAX) { 309 310 next_f = sg_policy->next_freq; 310 311 311 312 /* Reset cached freq as next_freq has changed */ ··· 397 396 398 397 sg_policy = container_of(irq_work, struct sugov_policy, irq_work); 399 398 400 - /* 401 - * For RT tasks, the schedutil governor shoots the frequency to maximum. 402 - * Special care must be taken to ensure that this kthread doesn't result 403 - * in the same behavior. 404 - * 405 - * This is (mostly) guaranteed by the work_in_progress flag. The flag is 406 - * updated only at the end of the sugov_work() function and before that 407 - * the schedutil governor rejects all other frequency scaling requests. 408 - * 409 - * There is a very rare case though, where the RT thread yields right 410 - * after the work_in_progress flag is cleared. The effects of that are 411 - * neglected for now. 412 - */ 413 399 kthread_queue_work(&sg_policy->worker, &sg_policy->work); 414 400 } 415 401