Merge tag 'pm-5.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 18 Oct 2019 15:34:04 +0000 (08:34 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 18 Oct 2019 15:34:04 +0000 (08:34 -0700)
Pull power management fixes from Rafael Wysocki:
 "These include a fix for a recent regression in the ACPI CPU
performance scaling code, a PCI device power management fix,
a system shutdown fix related to cpufreq, a removal of an ACPI
suspend-to-idle blacklist entry and a build warning fix.

Specifics:

   - Fix possible NULL pointer dereference in the ACPI processor scaling
     initialization code introduced by a recent cpufreq update (Rafael
     Wysocki).

   - Fix possible deadlock due to suspending cpufreq too late during
     system shutdown (Rafael Wysocki).

   - Make the PCI device system resume code path be more consistent with
     its PM-runtime counterpart to fix an issue with missing delay on
     transitions from D3cold to D0 during system resume from
     suspend-to-idle on some systems (Rafael Wysocki).

   - Drop Dell XPS13 9360 from the LPS0 Idle _DSM blacklist to make it
     use suspend-to-idle by default (Mario Limonciello).

   - Fix build warning in the core system suspend support code (Ben
     Dooks)"

* tag 'pm-5.4-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI: processor: Avoid NULL pointer dereferences at init time
  PCI: PM: Fix pci_power_up()
  PM: sleep: include <linux/pm_runtime.h> for pm_wq
  cpufreq: Avoid cpufreq_suspend() deadlock on system shutdown
  ACPI: PM: Drop Dell XPS13 9360 from LPS0 Idle _DSM blacklist

drivers/acpi/processor_perflib.c
drivers/acpi/processor_thermal.c
drivers/acpi/sleep.c
drivers/base/core.c
drivers/cpufreq/cpufreq.c
drivers/pci/pci.c
kernel/power/main.c

index 2261713d1aec08ffe2f006ff8fd69c165b32a6de..930a49fa4dfc5aec8d2847f3d5802ab2eb0956a1 100644 (file)
@@ -162,21 +162,23 @@ void acpi_processor_ppc_init(int cpu)
        struct acpi_processor *pr = per_cpu(processors, cpu);
        int ret;
 
+       if (!pr)
+               return;
+
        ret = dev_pm_qos_add_request(get_cpu_device(cpu),
                                     &pr->perflib_req, DEV_PM_QOS_MAX_FREQUENCY,
                                     INT_MAX);
-       if (ret < 0) {
+       if (ret < 0)
                pr_err("Failed to add freq constraint for CPU%d (%d)\n", cpu,
                       ret);
-               return;
-       }
 }
 
 void acpi_processor_ppc_exit(int cpu)
 {
        struct acpi_processor *pr = per_cpu(processors, cpu);
 
-       dev_pm_qos_remove_request(&pr->perflib_req);
+       if (pr)
+               dev_pm_qos_remove_request(&pr->perflib_req);
 }
 
 static int acpi_processor_get_performance_control(struct acpi_processor *pr)
index ec2638f1df4faea14e10a0682887bdce2d3e91e1..8227c7dd75b17dac5f5e21daf0d98370c1c86bea 100644 (file)
@@ -130,21 +130,23 @@ void acpi_thermal_cpufreq_init(int cpu)
        struct acpi_processor *pr = per_cpu(processors, cpu);
        int ret;
 
+       if (!pr)
+               return;
+
        ret = dev_pm_qos_add_request(get_cpu_device(cpu),
                                     &pr->thermal_req, DEV_PM_QOS_MAX_FREQUENCY,
                                     INT_MAX);
-       if (ret < 0) {
+       if (ret < 0)
                pr_err("Failed to add freq constraint for CPU%d (%d)\n", cpu,
                       ret);
-               return;
-       }
 }
 
 void acpi_thermal_cpufreq_exit(int cpu)
 {
        struct acpi_processor *pr = per_cpu(processors, cpu);
 
-       dev_pm_qos_remove_request(&pr->thermal_req);
+       if (pr)
+               dev_pm_qos_remove_request(&pr->thermal_req);
 }
 #else                          /* ! CONFIG_CPU_FREQ */
 static int cpufreq_get_max_state(unsigned int cpu)
index 9fa77d72ef27f52369a23f9ed99788705661bc3a..2af937a8b1c5c8b5b621f6e75f7206feab9fe996 100644 (file)
@@ -361,19 +361,6 @@ static const struct dmi_system_id acpisleep_dmi_table[] __initconst = {
                DMI_MATCH(DMI_PRODUCT_NAME, "80E3"),
                },
        },
-       /*
-        * https://bugzilla.kernel.org/show_bug.cgi?id=196907
-        * Some Dell XPS13 9360 cannot do suspend-to-idle using the Low Power
-        * S0 Idle firmware interface.
-        */
-       {
-       .callback = init_default_s3,
-       .ident = "Dell XPS13 9360",
-       .matches = {
-               DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
-               DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9360"),
-               },
-       },
        /*
         * ThinkPad X1 Tablet(2016) cannot do suspend-to-idle using
         * the Low Power S0 Idle firmware interface (see
index 2db62d98e39505b3466275d41bbb2c5a2cc9017e..7bd9cd366d41193638c858076755eec4ab1c67e6 100644 (file)
@@ -9,6 +9,7 @@
  */
 
 #include <linux/acpi.h>
+#include <linux/cpufreq.h>
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/fwnode.h>
@@ -3179,6 +3180,8 @@ void device_shutdown(void)
        wait_for_device_probe();
        device_block_probing();
 
+       cpufreq_suspend();
+
        spin_lock(&devices_kset->list_lock);
        /*
         * Walk the devices list backward, shutting down each in turn.
index c52d6fa32aac8125abfeadbac8ffe5d7e9cb5ff2..bffc11b872474e1f251d9e67580d6a36cd979aa4 100644 (file)
@@ -2737,14 +2737,6 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)
 }
 EXPORT_SYMBOL_GPL(cpufreq_unregister_driver);
 
-/*
- * Stop cpufreq at shutdown to make sure it isn't holding any locks
- * or mutexes when secondary CPUs are halted.
- */
-static struct syscore_ops cpufreq_syscore_ops = {
-       .shutdown = cpufreq_suspend,
-};
-
 struct kobject *cpufreq_global_kobject;
 EXPORT_SYMBOL(cpufreq_global_kobject);
 
@@ -2756,8 +2748,6 @@ static int __init cpufreq_core_init(void)
        cpufreq_global_kobject = kobject_create_and_add("cpufreq", &cpu_subsys.dev_root->kobj);
        BUG_ON(!cpufreq_global_kobject);
 
-       register_syscore_ops(&cpufreq_syscore_ops);
-
        return 0;
 }
 module_param(off, int, 0444);
index e7982af9a5d86efd738640fbe08dba01e4704155..a97e2571a5273094f6cff5a7f77f8c541a89b411 100644 (file)
@@ -958,19 +958,6 @@ void pci_refresh_power_state(struct pci_dev *dev)
        pci_update_current_state(dev, dev->current_state);
 }
 
-/**
- * pci_power_up - Put the given device into D0 forcibly
- * @dev: PCI device to power up
- */
-void pci_power_up(struct pci_dev *dev)
-{
-       if (platform_pci_power_manageable(dev))
-               platform_pci_set_power_state(dev, PCI_D0);
-
-       pci_raw_set_power_state(dev, PCI_D0);
-       pci_update_current_state(dev, PCI_D0);
-}
-
 /**
  * pci_platform_power_transition - Use platform to change device power state
  * @dev: PCI device to handle.
@@ -1153,6 +1140,17 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
 }
 EXPORT_SYMBOL(pci_set_power_state);
 
+/**
+ * pci_power_up - Put the given device into D0 forcibly
+ * @dev: PCI device to power up
+ */
+void pci_power_up(struct pci_dev *dev)
+{
+       __pci_start_power_transition(dev, PCI_D0);
+       pci_raw_set_power_state(dev, PCI_D0);
+       pci_update_current_state(dev, PCI_D0);
+}
+
 /**
  * pci_choose_state - Choose the power state of a PCI device
  * @dev: PCI device to be suspended
index e8710d179b35beace0e7d48f1a2fd7af93e09ddf..e26de7af520beba281df4e42f11f06b150a0fab7 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/seq_file.h>
 #include <linux/suspend.h>
 #include <linux/syscalls.h>
+#include <linux/pm_runtime.h>
 
 #include "power.h"