1. 10 6月, 2015 1 次提交
  2. 18 3月, 2015 1 次提交
  3. 28 10月, 2014 1 次提交
    • I
      PM / Sleep: fix async suspend_late/freeze_late error handling · 246ef766
      Imre Deak 提交于
      If an asynchronous suspend_late or freeze_late callback fails
      during the SUSPEND, FREEZE or QUIESCE phases, we don't propagate the
      corresponding error correctly, in effect ignoring the error and
      continuing the suspend-to-ram/hibernation. During suspend-to-ram this
      could leave some devices without a valid saved context, leading to a
      failure to reinitialize them during resume. During hibernation this
      could leave some devices active interfeering with the creation /
      restoration of the hibernation image. Also this could leave the
      corresponding devices without a valid saved context and failure to
      reinitialize them during resume.
      
      Fixes: de377b39 (PM / sleep: Asynchronous threads for suspend_late)
      Signed-off-by: NImre Deak <imre.deak@intel.com>
      Cc: 3.15+ <stable@vger.kernel.org> # 3.15+
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      246ef766
  4. 01 10月, 2014 1 次提交
  5. 29 7月, 2014 1 次提交
  6. 11 6月, 2014 1 次提交
    • T
      PM / sleep: trace events for device PM callbacks · e8bca479
      Todd E Brandt 提交于
      Adds two trace events which supply the same info that initcall_debug
      provides, but via ftrace instead of dmesg. The existing initcall_debug
      calls require the pm_print_times_enabled var to be set (either via
      sysfs or via the kernel cmd line). The new trace events provide all the
      same info as the initcall_debug prints but with less overhead, and also
      with coverage of device prepare and complete device callbacks.
      
      These events replace the device_pm_report_time event (which has been
      removed). device_pm_callback_start is called first and provides the device
      and callback info. device_pm_callback_end is called after with the
      device name and error info. The time and pid are gathered from the trace
      data headers.
      Signed-off-by: NTodd Brandt <todd.e.brandt@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      e8bca479
  7. 07 6月, 2014 1 次提交
    • T
      PM / sleep: trace events for suspend/resume · bb3632c6
      Todd E Brandt 提交于
      Adds trace events that give finer resolution into suspend/resume. These
      events are graphed in the timelines generated by the analyze_suspend.py
      script. They represent large areas of time consumed that are typical to
      suspend and resume.
      
      The event is triggered by calling the function "trace_suspend_resume"
      with three arguments: a string (the name of the event to be displayed
      in the timeline), an integer (case specific number, such as the power
      state or cpu number), and a boolean (where true is used to denote the start
      of the timeline event, and false to denote the end).
      
      The suspend_resume trace event reproduces the data that the machine_suspend
      trace event did, so the latter has been removed.
      Signed-off-by: NTodd Brandt <todd.e.brandt@intel.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      bb3632c6
  8. 17 5月, 2014 1 次提交
    • R
      PM / sleep: Mechanism to avoid resuming runtime-suspended devices unnecessarily · aae4518b
      Rafael J. Wysocki 提交于
      Currently, some subsystems (e.g. PCI and the ACPI PM domain) have to
      resume all runtime-suspended devices during system suspend, mostly
      because those devices may need to be reprogrammed due to different
      wakeup settings for system sleep and for runtime PM.
      
      For some devices, though, it's OK to remain in runtime suspend
      throughout a complete system suspend/resume cycle (if the device was in
      runtime suspend at the start of the cycle).  We would like to do this
      whenever possible, to avoid the overhead of extra power-up and power-down
      events.
      
      However, problems may arise because the device's descendants may require
      it to be at full power at various points during the cycle.  Therefore the
      most straightforward way to do this safely is if the device and all its
      descendants can remain runtime suspended until the complete stage of
      system resume.
      
      To this end, introduce a new device PM flag, power.direct_complete
      and modify the PM core to use that flag as follows.
      
      If the ->prepare() callback of a device returns a positive number,
      the PM core will regard that as an indication that it may leave the
      device runtime-suspended.  It will then check if the system power
      transition in progress is a suspend (and not hibernation in particular)
      and if the device is, indeed, runtime-suspended.  In that case, the PM
      core will set the device's power.direct_complete flag.  Otherwise it
      will clear power.direct_complete for the device and it also will later
      clear it for the device's parent (if there's one).
      
      Next, the PM core will not invoke the ->suspend() ->suspend_late(),
      ->suspend_irq(), ->resume_irq(), ->resume_early(), or ->resume()
      callbacks for all devices having power.direct_complete set.  It
      will invoke their ->complete() callbacks, however, and those
      callbacks are then responsible for resuming the devices as
      appropriate, if necessary.  For example, in some cases they may
      need to queue up runtime resume requests for the devices using
      pm_request_resume().
      
      Changelog partly based on an Alan Stern's description of the idea
      (http://marc.info/?l=linux-pm&m=139940466625569&w=2).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      aae4518b
  9. 06 3月, 2014 1 次提交
    • V
      cpufreq: suspend governors on system suspend/hibernate · 2f0aea93
      Viresh Kumar 提交于
      This patch adds cpufreq suspend/resume calls to dpm_{suspend|resume}()
      for handling suspend/resume of cpufreq governors.
      
      Lan Tianyu (Intel) & Jinhyuk Choi (Broadcom) found an issue where the
      tunables configuration for clusters/sockets with non-boot CPUs was
      lost after system suspend/resume, as we were notifying governors with
      CPUFREQ_GOV_POLICY_EXIT on removal of the last CPU for that policy
      which caused the tunables memory to be freed.
      
      This is fixed by preventing any governor operations from being
      carried out between the device suspend and device resume stages of
      system suspend and resume, respectively.
      
      We could have added these callbacks at dpm_{suspend|resume}_noirq()
      level, but there is an additional problem that the majority of I/O
      devices is already suspended at that point and if cpufreq drivers
      want to change the frequency before suspending, then that not be
      possible on some platforms (which depend on peripherals like i2c,
      regulators, etc).
      Reported-and-tested-by: NLan Tianyu <tianyu.lan@intel.com>
      Reported-by: NJinhyuk Choi <jinchoi@broadcom.com>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      [rjw: Changelog]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2f0aea93
  10. 20 2月, 2014 5 次提交
  11. 08 12月, 2013 1 次提交
  12. 28 11月, 2013 1 次提交
  13. 15 11月, 2013 1 次提交
  14. 14 11月, 2013 1 次提交
  15. 18 10月, 2013 1 次提交
    • B
      PM / Sleep: Detect device suspend/resume lockup and log event · 70fea60d
      Benoit Goby 提交于
      Rather than hard-lock the kernel, dump the suspend/resume thread stack
      and panic() to capture a message in pstore when a driver takes too long
      to suspend/resume. Default suspend/resume watchdog timeout is set to 12
      seconds to be longer than the usbhid 10 second timeout, but could be
      changed at compile time.
      
      Exclude from the watchdog the time spent waiting for children that
      are resumed asynchronously and time every device, whether or not they
      resumed synchronously.
      
      This patch is targeted for mobile devices where a suspend/resume lockup
      could cause a system reboot. Information about failing device can be
      retrieved in subsequent boot session by mounting pstore and inspecting
      the log. Laptops with EFI-enabled pstore could also benefit from
      this feature.
      
      The hardware watchdog timer is likely suspended during this time and
      couldn't be relied upon. The soft-lockup detector would eventually tell
      that tasks are not scheduled, but would provide little context as to why.
      The patch hence uses system timer and assumes it is still active while the
      devices are suspended/resumed.
      
      This feature can be enabled/disabled during kernel configuration.
      
      This change is based on earlier work by San Mehat.
      Signed-off-by: NBenoit Goby <benoit@android.com>
      Signed-off-by: NZoran Markovic <zoran.markovic@linaro.org>
      Acked-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      70fea60d
  16. 27 7月, 2013 1 次提交
    • S
      PM / Sleep: new trace event to print device suspend and resume times · 53644677
      Shuah Khan 提交于
      A new trace event is added to PM events to print the time it takes to
      suspend and resume a device.  It generates trace messages that
      include device, driver, parent information in addition to the type of
      PM ops invoked as well as the PM event and error status from the PM
      ops. Example trace below:
      
      bash-2239  [000] ....   290.883035: device_pm_report_time: backlight
       acpi_video0 parent=0000:00:02.0 state=freeze ops=class nsecs=332 err=0
      bash-2239  [000] ....   290.883041: device_pm_report_time: rfkill rf
      kill3 parent=phy0 state=freeze ops=legacy class nsecs=216 err=0
      bash-2239  [001] ....   290.973892: device_pm_report_time: ieee80211
       phy0 parent=0000:01:00.0 state=freeze ops=legacy class nsecs=90846477 err=0
      
      bash-2239  [001] ....   293.660129: device_pm_report_time: ieee80211 phy0 parent=0000:01:00.0 state=restore ops=legacy class nsecs=101295162 err=0
      bash-2239  [001] ....   293.660147: device_pm_report_time: rfkill rfkill3 parent=phy0 state=restore ops=legacy class nsecs=1804 err=0
      bash-2239  [001] ....   293.660157: device_pm_report_time: backlight acpi_video0 parent=0000:00:02.0 state=restore ops=class nsecs=757 err=0
      Signed-off-by: NShuah Khan <shuah.kh@samsung.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      53644677
  17. 12 4月, 2013 1 次提交
  18. 04 3月, 2013 1 次提交
    • R
      PM / QoS: Remove device PM QoS sysfs attributes at the right place · 37530f2b
      Rafael J. Wysocki 提交于
      Device PM QoS sysfs attributes, if present during device removal,
      are removed from within device_pm_remove(), which is too late,
      since dpm_sysfs_remove() has already removed the whole attribute
      group they belonged to.  However, moving the removal of those
      attributes to dpm_sysfs_remove() alone is not sufficient, because
      in theory they still can be re-added right after being removed by it
      (the device's driver is still bound to it at that point).
      
      For this reason, move the entire desctruction of device PM QoS
      constraints to dpm_sysfs_remove() and make it prevent any new
      constraints from being added after it has run.  Also, move the
      initialization of the power.qos field in struct device to
      device_pm_init_common() and drop the no longer needed
      dev_pm_qos_constraints_init().
      Reported-by: NSasha Levin <sasha.levin@oracle.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      37530f2b
  19. 06 1月, 2013 1 次提交
    • R
      PM: Move disabling/enabling runtime PM to late suspend/early resume · 9f6d8f6a
      Rafael J. Wysocki 提交于
      Currently, the PM core disables runtime PM for all devices right
      after executing subsystem/driver .suspend() callbacks for them
      and re-enables it right before executing subsystem/driver .resume()
      callbacks for them.  This may lead to problems when there are
      two devices such that the .suspend() callback executed for one of
      them depends on runtime PM working for the other.  In that case,
      if runtime PM has already been disabled for the second device,
      the first one's .suspend() won't work correctly (and analogously
      for resume).
      
      To make those issues go away, make the PM core disable runtime PM
      for devices right before executing subsystem/driver .suspend_late()
      callbacks for them and enable runtime PM for them right after
      executing subsystem/driver .resume_early() callbacks for them.  This
      way the potential conflitcs between .suspend_late()/.resume_early()
      and their runtime PM counterparts are still prevented from happening,
      but the subtle ordering issues related to disabling/enabling runtime
      PM for devices during system suspend/resume are much easier to avoid.
      Reported-and-tested-by: NJan-Matthias Braun <jan_braun@gmx.net>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NKevin Hilman <khilman@deeprootsystems.com>
      Cc: 3.4+ <stable@vger.kernel.org>
      9f6d8f6a
  20. 20 9月, 2012 1 次提交
    • A
      PM: Prevent runtime suspend during system resume · 88d26136
      Alan Stern 提交于
      This patch (as1591) moves the pm_runtime_get_noresume() and
      pm_runtime_put_sync() calls from __device_suspend() and
      device_resume() to device_prepare() and device_complete() in the PM
      core.
      
      The reason for doing this is to make sure that parent devices remain
      at full power (i.e., don't go into runtime suspend) while their
      children are being resumed from a system sleep.
      
      The PCI core already contained equivalent code to serve the same
      purpose.  The patch removes the duplicated code, since it is no longer
      needed.  One of the comments from the PCI core gets moved into the PM
      core, and a second comment is added to explain whe the _get_noresume
      and _put_sync calls are present.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      88d26136
  21. 19 9月, 2012 1 次提交
  22. 04 9月, 2012 2 次提交
    • R
      PM / Domains: Move syscore flag from subsys data to struct device · dbf37414
      Rafael J. Wysocki 提交于
      The syscore device PM flag is used to mark the devices (belonging to
      a PM domain) that should never be turned off, except for the system
      core (syscore) suspend/hibernation and resume stages.  That flag is
      stored in the device's struct pm_subsys_data object whose address is
      available from struct device.  However, in some situations it may be
      convenient to set that flag before the device is added to a PM
      domain, so it is better to move it directly to the "power" member of
      struct device.  Then, it can be checked by the routines in
      drivers/base/power/runtime.c and drivers/base/power/main.c, which is
      more straightforward.
      
      This also reduces the number of dev_gpd_data() invocations in the
      generic PM domains framework, so the overhead related to the syscore
      flag is slightly smaller.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NMagnus Damm <damm@opensource.se>
      dbf37414
    • R
      PM: Reorganize device PM initialization · e91c11b1
      Rafael J. Wysocki 提交于
      Make the device power management initialization more straightforward
      by moving the initialization of common (i.e. used by both runtime PM
      and system suspend) fields to a separate routine.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      e91c11b1
  23. 17 8月, 2012 1 次提交
  24. 19 7月, 2012 2 次提交
  25. 11 7月, 2012 1 次提交
    • P
      PM / cpuidle: System resume hang fix with cpuidle · 8651f97b
      Preeti U Murthy 提交于
      On certain bios, resume hangs if cpus are allowed to enter idle states
      during suspend [1].
      
      This was fixed in apci idle driver [2].But intel_idle driver does not
      have this fix. Thus instead of replicating the fix in both the idle
      drivers, or in more platform specific idle drivers if needed, the
      more general cpuidle infrastructure could handle this.
      
      A suspend callback in cpuidle_driver could handle this fix. But
      a cpuidle_driver provides only basic functionalities like platform idle
      state detection capability and mechanisms to support entry and exit
      into CPU idle states. All other cpuidle functions are found in the
      cpuidle generic infrastructure for good reason that all cpuidle
      drivers, irrepective of their platforms will support these functions.
      
      One option therefore would be to register a suspend callback in cpuidle
      which handles this fix. This could be called through a PM_SUSPEND_PREPARE
      notifier. But this is too generic a notfier for a driver to handle.
      
      Also, ideally the job of cpuidle is not to handle side effects of suspend.
      It should expose the interfaces which "handle cpuidle 'during' suspend"
      or any other operation, which the subsystems call during that respective
      operation.
      
      The fix demands that during suspend, no cpus should be allowed to enter
      deep C-states. The interface cpuidle_uninstall_idle_handler() in cpuidle
      ensures that. Not just that it also kicks all the cpus which are already
      in idle out of their idle states which was being done during cpu hotplug
      through a CPU_DYING_FROZEN callbacks.
      
      Now the question arises about when during suspend should
      cpuidle_uninstall_idle_handler() be called. Since we are dealing with
      drivers it seems best to call this function during dpm_suspend().
      Delaying the call till dpm_suspend_noirq() does no harm, as long as it is
      before cpu_hotplug_begin() to avoid race conditions with cpu hotpulg
      operations. In dpm_suspend_noirq(), it would be wise to place this call
      before suspend_device_irqs() to avoid ugly interactions with the same.
      
      Ananlogously, during resume.
      
      References:
      [1] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/674075.
      [2] http://marc.info/?l=linux-pm&m=133958534231884&w=2Reported-and-tested-by: NDave Hansen <dave@linux.vnet.ibm.com>
      Signed-off-by: NPreeti U Murthy <preeti@linux.vnet.ibm.com>
      Reviewed-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      8651f97b
  26. 01 7月, 2012 2 次提交
  27. 25 6月, 2012 1 次提交
  28. 02 5月, 2012 1 次提交
  29. 30 1月, 2012 1 次提交
    • R
      PM / Sleep: Introduce "late suspend" and "early resume" of devices · cf579dfb
      Rafael J. Wysocki 提交于
      The current device suspend/resume phases during system-wide power
      transitions appear to be insufficient for some platforms that want
      to use the same callback routines for saving device states and
      related operations during runtime suspend/resume as well as during
      system suspend/resume.  In principle, they could point their
      .suspend_noirq() and .resume_noirq() to the same callback routines
      as their .runtime_suspend() and .runtime_resume(), respectively,
      but at least some of them require device interrupts to be enabled
      while the code in those routines is running.
      
      It also makes sense to have device suspend-resume callbacks that will
      be executed with runtime PM disabled and with device interrupts
      enabled in case someone needs to run some special code in that
      context during system-wide power transitions.
      
      Apart from this, .suspend_noirq() and .resume_noirq() were introduced
      as a workaround for drivers using shared interrupts and failing to
      prevent their interrupt handlers from accessing suspended hardware.
      It appears to be better not to use them for other porposes, or we may
      have to deal with some serious confusion (which seems to be happening
      already).
      
      For the above reasons, introduce new device suspend/resume phases,
      "late suspend" and "early resume" (and analogously for hibernation)
      whose callback will be executed with runtime PM disabled and with
      device interrupts enabled and whose callback pointers generally may
      point to runtime suspend/resume routines.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      cf579dfb
  30. 22 12月, 2011 2 次提交
    • R
      PM: Run the driver callback directly if the subsystem one is not there · 35cd133c
      Rafael J. Wysocki 提交于
      Make the PM core execute driver PM callbacks directly if the
      corresponding subsystem callbacks are not present.
      
      There are three reasons for doing that.  First, it reflects the
      behavior of drivers/base/dd.c:really_probe() that runs the driver's
      .probe() callback directly if the bus type's one is not defined, so
      this change will remove one arbitrary difference between the PM core
      and the remaining parts of the driver core.  Second, it will allow
      some subsystems, whose PM callbacks don't do anything except for
      executing driver callbacks, to be simplified quite a bit by removing
      those "forward-only" callbacks.  Finally, it will allow us to remove
      one level of indirection in the system suspend and resume code paths
      where it is not necessary, which is going to lead to less debug noise
      with initcall_debug passed in the kernel command line (messages won't
      be printed for driverless devices whose subsystems don't provide
      PM callbacks among other things).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      35cd133c
    • R
      PM / Sleep: Make pm_op() and pm_noirq_op() return callback pointers · 9cf519d1
      Rafael J. Wysocki 提交于
      Make the pm_op() and pm_noirq_op() functions return pointers to
      appropriate callbacks instead of executing those callbacks and
      returning their results.
      
      This change is required for a subsequent modification that will
      execute the corresponding driver callback if the subsystem
      callback returned by either pm_op(), or pm_noirq_op() is NULL.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      9cf519d1
  31. 07 12月, 2011 1 次提交
  32. 24 11月, 2011 1 次提交