diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-14 16:12:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-08-14 16:12:24 -0400 |
commit | b018fc9800557bd14a40d69501e19c340eb2c521 (patch) | |
tree | 541109645e83725699d2b091a1c6c4816fdc6649 /kernel/power | |
parent | c07b3682cd12a017f976ec63bbd4758dc4c5100e (diff) | |
parent | 7425ecd5e3e8c9d84f399a102282a23a90a19278 (diff) |
Merge tag 'pm-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management updates from Rafael Wysocki:
"These add a new framework for CPU idle time injection, to be used by
all of the idle injection code in the kernel in the future, fix some
issues and add a number of relatively small extensions in multiple
places.
Specifics:
- Add a new framework for CPU idle time injection (Daniel Lezcano).
- Add AVS support to the armada-37xx cpufreq driver (Gregory
CLEMENT).
- Add support for current CPU frequency reporting to the ACPI CPPC
cpufreq driver (George Cherian).
- Rework the cooling device registration in the imx6q/thermal driver
(Bastian Stender).
- Make the pcc-cpufreq driver refuse to work with dynamic scaling
governors on systems with many CPUs to avoid scalability issues
with it (Rafael Wysocki).
- Fix the intel_pstate driver to report different maximum CPU
frequencies on systems where they really are different and to
ignore the turbo active ratio if hardware-managend P-states (HWP)
are in use; make it use the match_string() helper (Xie Yisheng,
Srinivas Pandruvada).
- Fix a minor deferred probe issue in the qcom-kryo cpufreq driver
(Niklas Cassel).
- Add a tracepoint for the tracking of frequency limits changes (from
Andriod) to the cpufreq core (Ruchi Kandoi).
- Fix a circular lock dependency between CPU hotplug and sysfs
locking in the cpufreq core reported by lockdep (Waiman Long).
- Avoid excessive error reports on driver registration failures in
the ARM cpuidle driver (Sudeep Holla).
- Add a new device links flag to the driver core to make links go
away automatically on supplier driver removal (Vivek Gautam).
- Eliminate potential race condition between system-wide power
management transitions and system shutdown (Pingfan Liu).
- Add a quirk to save NVS memory on system suspend for the ASUS 1025C
laptop (Willy Tarreau).
- Make more systems use suspend-to-idle (instead of ACPI S3) by
default (Tristian Celestin).
- Get rid of stack VLA usage in the low-level hibernation code on
64-bit x86 (Kees Cook).
- Fix error handling in the hibernation core and mark an expected
fall-through switch in it (Chengguang Xu, Gustavo Silva).
- Extend the generic power domains (genpd) framework to support
attaching a device to a power domain by name (Ulf Hansson).
- Fix device reference counting and user limits initialization in the
devfreq core (Arvind Yadav, Matthias Kaehlcke).
- Fix a few issues in the rk3399_dmc devfreq driver and improve its
documentation (Enric Balletbo i Serra, Lin Huang, Nick Milner).
- Drop a redundant error message from the exynos-ppmu devfreq driver
(Markus Elfring)"
* tag 'pm-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (35 commits)
PM / reboot: Eliminate race between reboot and suspend
PM / hibernate: Mark expected switch fall-through
cpufreq: intel_pstate: Ignore turbo active ratio in HWP
cpufreq: Fix a circular lock dependency problem
cpu/hotplug: Add a cpus_read_trylock() function
x86/power/hibernate_64: Remove VLA usage
cpufreq: trace frequency limits change
cpufreq: intel_pstate: Show different max frequency with turbo 3 and HWP
cpufreq: pcc-cpufreq: Disable dynamic scaling on many-CPU systems
cpufreq: qcom-kryo: Silently error out on EPROBE_DEFER
cpufreq / CPPC: Add cpuinfo_cur_freq support for CPPC
cpufreq: armada-37xx: Add AVS support
dt-bindings: marvell: Add documentation for the Armada 3700 AVS binding
PM / devfreq: rk3399_dmc: Fix duplicated opp table on reload.
PM / devfreq: Init user limits from OPP limits, not viceversa
PM / devfreq: rk3399_dmc: fix spelling mistakes.
PM / devfreq: rk3399_dmc: do not print error when get supply and clk defer.
dt-bindings: devfreq: rk3399_dmc: move interrupts to be optional.
PM / devfreq: rk3399_dmc: remove wait for dcf irq event.
dt-bindings: clock: add rk3399 DDR3 standard speed bins.
...
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/hibernate.c | 16 | ||||
-rw-r--r-- | kernel/power/main.c | 12 | ||||
-rw-r--r-- | kernel/power/suspend.c | 4 | ||||
-rw-r--r-- | kernel/power/swap.c | 4 | ||||
-rw-r--r-- | kernel/power/user.c | 4 |
5 files changed, 21 insertions, 19 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index 9c85c7822383..abef759de7c8 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -338,7 +338,7 @@ static int create_image(int platform_mode) | |||
338 | * hibernation_snapshot - Quiesce devices and create a hibernation image. | 338 | * hibernation_snapshot - Quiesce devices and create a hibernation image. |
339 | * @platform_mode: If set, use platform driver to prepare for the transition. | 339 | * @platform_mode: If set, use platform driver to prepare for the transition. |
340 | * | 340 | * |
341 | * This routine must be called with pm_mutex held. | 341 | * This routine must be called with system_transition_mutex held. |
342 | */ | 342 | */ |
343 | int hibernation_snapshot(int platform_mode) | 343 | int hibernation_snapshot(int platform_mode) |
344 | { | 344 | { |
@@ -500,8 +500,9 @@ static int resume_target_kernel(bool platform_mode) | |||
500 | * hibernation_restore - Quiesce devices and restore from a hibernation image. | 500 | * hibernation_restore - Quiesce devices and restore from a hibernation image. |
501 | * @platform_mode: If set, use platform driver to prepare for the transition. | 501 | * @platform_mode: If set, use platform driver to prepare for the transition. |
502 | * | 502 | * |
503 | * This routine must be called with pm_mutex held. If it is successful, control | 503 | * This routine must be called with system_transition_mutex held. If it is |
504 | * reappears in the restored target kernel in hibernation_snapshot(). | 504 | * successful, control reappears in the restored target kernel in |
505 | * hibernation_snapshot(). | ||
505 | */ | 506 | */ |
506 | int hibernation_restore(int platform_mode) | 507 | int hibernation_restore(int platform_mode) |
507 | { | 508 | { |
@@ -638,6 +639,7 @@ static void power_down(void) | |||
638 | break; | 639 | break; |
639 | case HIBERNATION_PLATFORM: | 640 | case HIBERNATION_PLATFORM: |
640 | hibernation_platform_enter(); | 641 | hibernation_platform_enter(); |
642 | /* Fall through */ | ||
641 | case HIBERNATION_SHUTDOWN: | 643 | case HIBERNATION_SHUTDOWN: |
642 | if (pm_power_off) | 644 | if (pm_power_off) |
643 | kernel_power_off(); | 645 | kernel_power_off(); |
@@ -805,13 +807,13 @@ static int software_resume(void) | |||
805 | * name_to_dev_t() below takes a sysfs buffer mutex when sysfs | 807 | * name_to_dev_t() below takes a sysfs buffer mutex when sysfs |
806 | * is configured into the kernel. Since the regular hibernate | 808 | * is configured into the kernel. Since the regular hibernate |
807 | * trigger path is via sysfs which takes a buffer mutex before | 809 | * trigger path is via sysfs which takes a buffer mutex before |
808 | * calling hibernate functions (which take pm_mutex) this can | 810 | * calling hibernate functions (which take system_transition_mutex) |
809 | * cause lockdep to complain about a possible ABBA deadlock | 811 | * this can cause lockdep to complain about a possible ABBA deadlock |
810 | * which cannot happen since we're in the boot code here and | 812 | * which cannot happen since we're in the boot code here and |
811 | * sysfs can't be invoked yet. Therefore, we use a subclass | 813 | * sysfs can't be invoked yet. Therefore, we use a subclass |
812 | * here to avoid lockdep complaining. | 814 | * here to avoid lockdep complaining. |
813 | */ | 815 | */ |
814 | mutex_lock_nested(&pm_mutex, SINGLE_DEPTH_NESTING); | 816 | mutex_lock_nested(&system_transition_mutex, SINGLE_DEPTH_NESTING); |
815 | 817 | ||
816 | if (swsusp_resume_device) | 818 | if (swsusp_resume_device) |
817 | goto Check_image; | 819 | goto Check_image; |
@@ -899,7 +901,7 @@ static int software_resume(void) | |||
899 | atomic_inc(&snapshot_device_available); | 901 | atomic_inc(&snapshot_device_available); |
900 | /* For success case, the suspend path will release the lock */ | 902 | /* For success case, the suspend path will release the lock */ |
901 | Unlock: | 903 | Unlock: |
902 | mutex_unlock(&pm_mutex); | 904 | mutex_unlock(&system_transition_mutex); |
903 | pm_pr_dbg("Hibernation image not present or could not be loaded.\n"); | 905 | pm_pr_dbg("Hibernation image not present or could not be loaded.\n"); |
904 | return error; | 906 | return error; |
905 | Close_Finish: | 907 | Close_Finish: |
diff --git a/kernel/power/main.c b/kernel/power/main.c index d9706da10930..35b50823d83b 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -15,17 +15,16 @@ | |||
15 | #include <linux/workqueue.h> | 15 | #include <linux/workqueue.h> |
16 | #include <linux/debugfs.h> | 16 | #include <linux/debugfs.h> |
17 | #include <linux/seq_file.h> | 17 | #include <linux/seq_file.h> |
18 | #include <linux/suspend.h> | ||
18 | 19 | ||
19 | #include "power.h" | 20 | #include "power.h" |
20 | 21 | ||
21 | DEFINE_MUTEX(pm_mutex); | ||
22 | |||
23 | #ifdef CONFIG_PM_SLEEP | 22 | #ifdef CONFIG_PM_SLEEP |
24 | 23 | ||
25 | void lock_system_sleep(void) | 24 | void lock_system_sleep(void) |
26 | { | 25 | { |
27 | current->flags |= PF_FREEZER_SKIP; | 26 | current->flags |= PF_FREEZER_SKIP; |
28 | mutex_lock(&pm_mutex); | 27 | mutex_lock(&system_transition_mutex); |
29 | } | 28 | } |
30 | EXPORT_SYMBOL_GPL(lock_system_sleep); | 29 | EXPORT_SYMBOL_GPL(lock_system_sleep); |
31 | 30 | ||
@@ -37,8 +36,9 @@ void unlock_system_sleep(void) | |||
37 | * | 36 | * |
38 | * Reason: | 37 | * Reason: |
39 | * Fundamentally, we just don't need it, because freezing condition | 38 | * Fundamentally, we just don't need it, because freezing condition |
40 | * doesn't come into effect until we release the pm_mutex lock, | 39 | * doesn't come into effect until we release the |
41 | * since the freezer always works with pm_mutex held. | 40 | * system_transition_mutex lock, since the freezer always works with |
41 | * system_transition_mutex held. | ||
42 | * | 42 | * |
43 | * More importantly, in the case of hibernation, | 43 | * More importantly, in the case of hibernation, |
44 | * unlock_system_sleep() gets called in snapshot_read() and | 44 | * unlock_system_sleep() gets called in snapshot_read() and |
@@ -47,7 +47,7 @@ void unlock_system_sleep(void) | |||
47 | * enter the refrigerator, thus causing hibernation to lockup. | 47 | * enter the refrigerator, thus causing hibernation to lockup. |
48 | */ | 48 | */ |
49 | current->flags &= ~PF_FREEZER_SKIP; | 49 | current->flags &= ~PF_FREEZER_SKIP; |
50 | mutex_unlock(&pm_mutex); | 50 | mutex_unlock(&system_transition_mutex); |
51 | } | 51 | } |
52 | EXPORT_SYMBOL_GPL(unlock_system_sleep); | 52 | EXPORT_SYMBOL_GPL(unlock_system_sleep); |
53 | 53 | ||
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 70178f6ffdc4..5342f6fc022e 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
@@ -556,7 +556,7 @@ static int enter_state(suspend_state_t state) | |||
556 | } else if (!valid_state(state)) { | 556 | } else if (!valid_state(state)) { |
557 | return -EINVAL; | 557 | return -EINVAL; |
558 | } | 558 | } |
559 | if (!mutex_trylock(&pm_mutex)) | 559 | if (!mutex_trylock(&system_transition_mutex)) |
560 | return -EBUSY; | 560 | return -EBUSY; |
561 | 561 | ||
562 | if (state == PM_SUSPEND_TO_IDLE) | 562 | if (state == PM_SUSPEND_TO_IDLE) |
@@ -590,7 +590,7 @@ static int enter_state(suspend_state_t state) | |||
590 | pm_pr_dbg("Finishing wakeup.\n"); | 590 | pm_pr_dbg("Finishing wakeup.\n"); |
591 | suspend_finish(); | 591 | suspend_finish(); |
592 | Unlock: | 592 | Unlock: |
593 | mutex_unlock(&pm_mutex); | 593 | mutex_unlock(&system_transition_mutex); |
594 | return error; | 594 | return error; |
595 | } | 595 | } |
596 | 596 | ||
diff --git a/kernel/power/swap.c b/kernel/power/swap.c index c2bcf97d24c8..d7f6c1a288d3 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c | |||
@@ -923,7 +923,7 @@ int swsusp_write(unsigned int flags) | |||
923 | } | 923 | } |
924 | memset(&snapshot, 0, sizeof(struct snapshot_handle)); | 924 | memset(&snapshot, 0, sizeof(struct snapshot_handle)); |
925 | error = snapshot_read_next(&snapshot); | 925 | error = snapshot_read_next(&snapshot); |
926 | if (error < PAGE_SIZE) { | 926 | if (error < (int)PAGE_SIZE) { |
927 | if (error >= 0) | 927 | if (error >= 0) |
928 | error = -EFAULT; | 928 | error = -EFAULT; |
929 | 929 | ||
@@ -1483,7 +1483,7 @@ int swsusp_read(unsigned int *flags_p) | |||
1483 | 1483 | ||
1484 | memset(&snapshot, 0, sizeof(struct snapshot_handle)); | 1484 | memset(&snapshot, 0, sizeof(struct snapshot_handle)); |
1485 | error = snapshot_write_next(&snapshot); | 1485 | error = snapshot_write_next(&snapshot); |
1486 | if (error < PAGE_SIZE) | 1486 | if (error < (int)PAGE_SIZE) |
1487 | return error < 0 ? error : -EFAULT; | 1487 | return error < 0 ? error : -EFAULT; |
1488 | header = (struct swsusp_info *)data_of(snapshot); | 1488 | header = (struct swsusp_info *)data_of(snapshot); |
1489 | error = get_swap_reader(&handle, flags_p); | 1489 | error = get_swap_reader(&handle, flags_p); |
diff --git a/kernel/power/user.c b/kernel/power/user.c index abd225550271..2d8b60a3c86b 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -216,7 +216,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, | |||
216 | if (!capable(CAP_SYS_ADMIN)) | 216 | if (!capable(CAP_SYS_ADMIN)) |
217 | return -EPERM; | 217 | return -EPERM; |
218 | 218 | ||
219 | if (!mutex_trylock(&pm_mutex)) | 219 | if (!mutex_trylock(&system_transition_mutex)) |
220 | return -EBUSY; | 220 | return -EBUSY; |
221 | 221 | ||
222 | lock_device_hotplug(); | 222 | lock_device_hotplug(); |
@@ -394,7 +394,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, | |||
394 | } | 394 | } |
395 | 395 | ||
396 | unlock_device_hotplug(); | 396 | unlock_device_hotplug(); |
397 | mutex_unlock(&pm_mutex); | 397 | mutex_unlock(&system_transition_mutex); |
398 | 398 | ||
399 | return error; | 399 | return error; |
400 | } | 400 | } |