diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2019-07-01 06:44:25 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2019-07-02 18:13:24 -0400 |
commit | 501debd4aa5edc755037c39ea5a8fba23b41e580 (patch) | |
tree | 8769773b114142028a5b1044963921b3c4e33013 | |
parent | 2f02a7ecd512288c40bd72bdd4d87ab4f01c1615 (diff) |
PM: ACPI/PCI: Resume all devices during hibernation
Both the PCI bus type and the ACPI PM domain avoid resuming
runtime-suspended devices with DPM_FLAG_SMART_SUSPEND set during
hibernation (before creating the snapshot image of system memory),
but that turns out to be a mistake. It leads to functional issues
and adds complexity that's hard to justify.
For this reason, resume all runtime-suspended PCI devices and all
devices in the ACPI PM domains before creating a snapshot image of
system memory during hibernation.
Fixes: 05087360fd7a (ACPI / PM: Take SMART_SUSPEND driver flag into account)
Fixes: c4b65157aeef (PCI / PM: Take SMART_SUSPEND driver flag into account)
Link: https://lore.kernel.org/linux-acpi/917d4399-2e22-67b1-9d54-808561f9083f@uwyo.edu/T/#maf065fe6e4974f2a9d79f332ab99dfaba635f64c
Reported-by: Robert R. Howell <RHowell@uwyo.edu>
Tested-by: Robert R. Howell <RHowell@uwyo.edu>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r-- | drivers/acpi/device_pm.c | 13 | ||||
-rw-r--r-- | drivers/pci/pci-driver.c | 16 |
2 files changed, 15 insertions, 14 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index e54956ae93d3..44172eb18d6e 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c | |||
@@ -1112,13 +1112,14 @@ EXPORT_SYMBOL_GPL(acpi_subsys_resume_early); | |||
1112 | int acpi_subsys_freeze(struct device *dev) | 1112 | int acpi_subsys_freeze(struct device *dev) |
1113 | { | 1113 | { |
1114 | /* | 1114 | /* |
1115 | * This used to be done in acpi_subsys_prepare() for all devices and | 1115 | * Resume all runtime-suspended devices before creating a snapshot |
1116 | * some drivers may depend on it, so do it here. Ideally, however, | 1116 | * image of system memory, because the restore kernel generally cannot |
1117 | * runtime-suspended devices should not be touched during freeze/thaw | 1117 | * be expected to always handle them consistently and they need to be |
1118 | * transitions. | 1118 | * put into the runtime-active metastate during system resume anyway, |
1119 | * so it is better to ensure that the state saved in the image will be | ||
1120 | * always consistent with that. | ||
1119 | */ | 1121 | */ |
1120 | if (!dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND)) | 1122 | pm_runtime_resume(dev); |
1121 | pm_runtime_resume(dev); | ||
1122 | 1123 | ||
1123 | return pm_generic_freeze(dev); | 1124 | return pm_generic_freeze(dev); |
1124 | } | 1125 | } |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 5eadbc3d0969..ce54fa3ed94a 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -972,15 +972,15 @@ static int pci_pm_freeze(struct device *dev) | |||
972 | } | 972 | } |
973 | 973 | ||
974 | /* | 974 | /* |
975 | * This used to be done in pci_pm_prepare() for all devices and some | 975 | * Resume all runtime-suspended devices before creating a snapshot |
976 | * drivers may depend on it, so do it here. Ideally, runtime-suspended | 976 | * image of system memory, because the restore kernel generally cannot |
977 | * devices should not be touched during freeze/thaw transitions, | 977 | * be expected to always handle them consistently and they need to be |
978 | * however. | 978 | * put into the runtime-active metastate during system resume anyway, |
979 | * so it is better to ensure that the state saved in the image will be | ||
980 | * always consistent with that. | ||
979 | */ | 981 | */ |
980 | if (!dev_pm_smart_suspend_and_suspended(dev)) { | 982 | pm_runtime_resume(dev); |
981 | pm_runtime_resume(dev); | 983 | pci_dev->state_saved = false; |
982 | pci_dev->state_saved = false; | ||
983 | } | ||
984 | 984 | ||
985 | if (pm->freeze) { | 985 | if (pm->freeze) { |
986 | int error; | 986 | int error; |