aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-09 20:44:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-09 20:44:27 -0400
commite5e02de0665ef2477e7a018193051387c6fe0fbc (patch)
treea3e91543f4ea5294bd877a9a5890403a29cce742
parent3cfb2f7976a2f9cfe48eda4e6d7e4ce74fee09e3 (diff)
parentb2d5fb97d37fb35708a0811af74d9e76e44d421c (diff)
Merge tag 'pm+acpi-4.0-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management and ACPI fixes from Rafael Wysocki: "These are stable-candidate fixes of some recently reported issues in the cpufreq core, cpuidle core, the ACPI cpuidle driver and the hibernate core. Specifics: - Revert a 3.17 hibernate commit that was supposed to fix an issue related to e820 reserved regions, but broke resume from hibernation on Lenovo x230 (Rafael J Wysocki). - Prevent the ACPI cpuidle driver from overwriting the name and description of the C0 state set by the core when the list of C-states changes (Thomas Schlichter). - Remove the no longer needed state_count field from struct cpuidle_device which prevents the list of C-states shown by the sysfs interface from becoming incorrect when the current number of them is different from the number of C-states on boot (Bartlomiej Zolnierkiewicz). - The cpufreq core updates the policy object of the only online CPU during system resume to make it reflect the current hardware state, but it always assumes that CPU to be CPU0 which need not be the case, so fix the code to avoid that assumption (Viresh Kumar)" * tag 'pm+acpi-4.0-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: Revert "PM / hibernate: avoid unsafe pages in e820 reserved regions" cpuidle: ACPI: do not overwrite name and description of C0 cpuidle: remove state_count field from struct cpuidle_device cpufreq: Schedule work for the first-online CPU on resume
-rw-r--r--drivers/acpi/processor_idle.c2
-rw-r--r--drivers/cpufreq/cpufreq.c19
-rw-r--r--drivers/cpuidle/cpuidle.c3
-rw-r--r--drivers/cpuidle/sysfs.c5
-rw-r--r--include/linux/cpuidle.h1
-rw-r--r--kernel/power/snapshot.c21
6 files changed, 16 insertions, 35 deletions
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index c6bb9f1257c9..f98db0b50551 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -922,7 +922,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
922 return -EINVAL; 922 return -EINVAL;
923 923
924 drv->safe_state_index = -1; 924 drv->safe_state_index = -1;
925 for (i = 0; i < CPUIDLE_STATE_MAX; i++) { 925 for (i = CPUIDLE_DRIVER_STATE_START; i < CPUIDLE_STATE_MAX; i++) {
926 drv->states[i].name[0] = '\0'; 926 drv->states[i].name[0] = '\0';
927 drv->states[i].desc[0] = '\0'; 927 drv->states[i].desc[0] = '\0';
928 } 928 }
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 28e59a48b35f..8ae655c364f4 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1698,15 +1698,18 @@ void cpufreq_resume(void)
1698 || __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS)) 1698 || __cpufreq_governor(policy, CPUFREQ_GOV_LIMITS))
1699 pr_err("%s: Failed to start governor for policy: %p\n", 1699 pr_err("%s: Failed to start governor for policy: %p\n",
1700 __func__, policy); 1700 __func__, policy);
1701
1702 /*
1703 * schedule call cpufreq_update_policy() for boot CPU, i.e. last
1704 * policy in list. It will verify that the current freq is in
1705 * sync with what we believe it to be.
1706 */
1707 if (list_is_last(&policy->policy_list, &cpufreq_policy_list))
1708 schedule_work(&policy->update);
1709 } 1701 }
1702
1703 /*
1704 * schedule call cpufreq_update_policy() for first-online CPU, as that
1705 * wouldn't be hotplugged-out on suspend. It will verify that the
1706 * current freq is in sync with what we believe it to be.
1707 */
1708 policy = cpufreq_cpu_get_raw(cpumask_first(cpu_online_mask));
1709 if (WARN_ON(!policy))
1710 return;
1711
1712 schedule_work(&policy->update);
1710} 1713}
1711 1714
1712/** 1715/**
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 080bd2dbde4b..7a73a279e179 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -330,9 +330,6 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
330 if (!dev->registered) 330 if (!dev->registered)
331 return -EINVAL; 331 return -EINVAL;
332 332
333 if (!dev->state_count)
334 dev->state_count = drv->state_count;
335
336 ret = cpuidle_add_device_sysfs(dev); 333 ret = cpuidle_add_device_sysfs(dev);
337 if (ret) 334 if (ret)
338 return ret; 335 return ret;
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index 97c5903b4606..832a2c3f01ff 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -401,7 +401,7 @@ static int cpuidle_add_state_sysfs(struct cpuidle_device *device)
401 struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device); 401 struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device);
402 402
403 /* state statistics */ 403 /* state statistics */
404 for (i = 0; i < device->state_count; i++) { 404 for (i = 0; i < drv->state_count; i++) {
405 kobj = kzalloc(sizeof(struct cpuidle_state_kobj), GFP_KERNEL); 405 kobj = kzalloc(sizeof(struct cpuidle_state_kobj), GFP_KERNEL);
406 if (!kobj) 406 if (!kobj)
407 goto error_state; 407 goto error_state;
@@ -433,9 +433,10 @@ error_state:
433 */ 433 */
434static void cpuidle_remove_state_sysfs(struct cpuidle_device *device) 434static void cpuidle_remove_state_sysfs(struct cpuidle_device *device)
435{ 435{
436 struct cpuidle_driver *drv = cpuidle_get_cpu_driver(device);
436 int i; 437 int i;
437 438
438 for (i = 0; i < device->state_count; i++) 439 for (i = 0; i < drv->state_count; i++)
439 cpuidle_free_state_kobj(device, i); 440 cpuidle_free_state_kobj(device, i);
440} 441}
441 442
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index 306178d7309f..9c5e89254796 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -77,7 +77,6 @@ struct cpuidle_device {
77 unsigned int cpu; 77 unsigned int cpu;
78 78
79 int last_residency; 79 int last_residency;
80 int state_count;
81 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; 80 struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX];
82 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; 81 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
83 struct cpuidle_driver_kobj *kobj_driver; 82 struct cpuidle_driver_kobj *kobj_driver;
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index c24d5a23bf93..5235dd4e1e2f 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -955,25 +955,6 @@ static void mark_nosave_pages(struct memory_bitmap *bm)
955 } 955 }
956} 956}
957 957
958static bool is_nosave_page(unsigned long pfn)
959{
960 struct nosave_region *region;
961
962 list_for_each_entry(region, &nosave_regions, list) {
963 if (pfn >= region->start_pfn && pfn < region->end_pfn) {
964 pr_err("PM: %#010llx in e820 nosave region: "
965 "[mem %#010llx-%#010llx]\n",
966 (unsigned long long) pfn << PAGE_SHIFT,
967 (unsigned long long) region->start_pfn << PAGE_SHIFT,
968 ((unsigned long long) region->end_pfn << PAGE_SHIFT)
969 - 1);
970 return true;
971 }
972 }
973
974 return false;
975}
976
977/** 958/**
978 * create_basic_memory_bitmaps - create bitmaps needed for marking page 959 * create_basic_memory_bitmaps - create bitmaps needed for marking page
979 * frames that should not be saved and free page frames. The pointers 960 * frames that should not be saved and free page frames. The pointers
@@ -2042,7 +2023,7 @@ static int mark_unsafe_pages(struct memory_bitmap *bm)
2042 do { 2023 do {
2043 pfn = memory_bm_next_pfn(bm); 2024 pfn = memory_bm_next_pfn(bm);
2044 if (likely(pfn != BM_END_OF_MAP)) { 2025 if (likely(pfn != BM_END_OF_MAP)) {
2045 if (likely(pfn_valid(pfn)) && !is_nosave_page(pfn)) 2026 if (likely(pfn_valid(pfn)))
2046 swsusp_set_page_free(pfn_to_page(pfn)); 2027 swsusp_set_page_free(pfn_to_page(pfn));
2047 else 2028 else
2048 return -EFAULT; 2029 return -EFAULT;