Power management fixes for 3.5-rc5

* Fix for a bug in async suspend error code path causing parents to wait
   forever for their children in case of a suspend error from Mandeep Singh
   Baines (-stable metarial).
 
 * Fix for a suspend regression related to earlier changes in the ACPI
   cpuidle driver from Deepthi Dharwar.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.18 (GNU/Linux)
 
 iQIcBAABAgAGBQJP7hyOAAoJEKhOf7ml8uNs00IP/iOjS+oV+fuz6w76axgj2uye
 Jb5nnmV4xDd00F8vL3OUGUJBnHT1uM1lOs8I97ebGmTP5R8gGJLDg+8M5oIgJwkN
 kO04w/vAbOoP6+jiLHyJ9eQ1PVTW/UL23LOg6Ik4VHmqwcJVGNRUzYnR1p7gaReH
 Q9ZZf5+qw72ZWx8rTsxpUnc1dZZqJh9v3cKG+9uhFMLteiuzpw/xSbwkdob1zQyr
 NrR5r6/eEwOrkqiUWSWjRC0EsUiXazkYQPkKXEfHQUqpqbS1uMwj9EwcCOW5s+rD
 zlyZRQ0cVod1jlDJCiM7juEsUhfbsB/QmiRDC6Ln7dhfale5wuMMHoTZTu6pIeb4
 /TGYrL7LKrd8zoHBcimeMwXu9ragpF37jX1AvDLL7zQNVvWLT/qsHfl/FUzxMyaq
 H5ouEfXwQ2G3cLSHWjbQYsNnLvoyONYsSkXP9asc/L+H7Mv9ujOG256ItG/9wNC+
 8f/azSPS0a4GMrgkMwivGDzyt8iKLBUBQUFsSt9p6A/PiIZdXHFOIm/JzGIFCkVZ
 vHjmWihhn7osC0rMY2Pnvm1urzjJBh2uKygkrFFwDG8J1Yg53ggVVahvZef7Inma
 6ONxUEqKANHF/yRUtTJye9yxz6ITAdCrK87ioNF7//UNh2dgHxKsXeiDb1sP0bgv
 qricvgZ27o9gqASxBIbQ
 =a9hl
 -----END PGP SIGNATURE-----

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

Pull power management fixes from Rafael J. Wysocki:

 * Fix for a bug in async suspend error code path causing parents to
   wait forever for their children in case of a suspend error from
   Mandeep Singh Baines (-stable metarial).

 * Fix for a suspend regression related to earlier changes in the ACPI
   cpuidle driver from Deepthi Dharwar.

* tag 'pm-for-3.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  PM / ACPI: Fix suspend/resume regression caused by cpuidle cleanup.
  PM / Sleep: Prevent waiting forever on asynchronous suspend after abort
This commit is contained in:
Linus Torvalds 2012-06-29 19:05:41 -07:00
commit 02529ba26f
2 changed files with 34 additions and 4 deletions

View File

@ -224,6 +224,7 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr,
/*
* Suspend / resume control
*/
static int acpi_idle_suspend;
static u32 saved_bm_rld;
static void acpi_idle_bm_rld_save(void)
@ -242,13 +243,21 @@ static void acpi_idle_bm_rld_restore(void)
int acpi_processor_suspend(struct acpi_device * device, pm_message_t state)
{
if (acpi_idle_suspend == 1)
return 0;
acpi_idle_bm_rld_save();
acpi_idle_suspend = 1;
return 0;
}
int acpi_processor_resume(struct acpi_device * device)
{
if (acpi_idle_suspend == 0)
return 0;
acpi_idle_bm_rld_restore();
acpi_idle_suspend = 0;
return 0;
}
@ -754,6 +763,12 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
local_irq_disable();
if (acpi_idle_suspend) {
local_irq_enable();
cpu_relax();
return -EBUSY;
}
lapic_timer_state_broadcast(pr, cx, 1);
kt1 = ktime_get_real();
acpi_idle_do_entry(cx);
@ -823,6 +838,12 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
local_irq_disable();
if (acpi_idle_suspend) {
local_irq_enable();
cpu_relax();
return -EBUSY;
}
if (cx->entry_method != ACPI_CSTATE_FFH) {
current_thread_info()->status &= ~TS_POLLING;
/*
@ -907,14 +928,21 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
drv, drv->safe_state_index);
} else {
local_irq_disable();
acpi_safe_halt();
if (!acpi_idle_suspend)
acpi_safe_halt();
local_irq_enable();
return -EINVAL;
return -EBUSY;
}
}
local_irq_disable();
if (acpi_idle_suspend) {
local_irq_enable();
cpu_relax();
return -EBUSY;
}
if (cx->entry_method != ACPI_CSTATE_FFH) {
current_thread_info()->status &= ~TS_POLLING;
/*

View File

@ -1031,7 +1031,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
dpm_wait_for_children(dev, async);
if (async_error)
return 0;
goto Complete;
pm_runtime_get_noresume(dev);
if (pm_runtime_barrier(dev) && device_may_wakeup(dev))
@ -1040,7 +1040,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
if (pm_wakeup_pending()) {
pm_runtime_put_sync(dev);
async_error = -EBUSY;
return 0;
goto Complete;
}
device_lock(dev);
@ -1097,6 +1097,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
}
device_unlock(dev);
Complete:
complete_all(&dev->power.completion);
if (error) {