1. 03 4月, 2018 1 次提交
  2. 09 11月, 2017 1 次提交
    • R
      PM / s2idle: Clear the events_check_enabled flag · 95b982b4
      Rajat Jain 提交于
      Problem: This flag does not get cleared currently in the suspend or
      resume path in the following cases:
      
       * In case some driver's suspend routine returns an error.
       * Successful s2idle case
       * etc?
      
      Why is this a problem: What happens is that the next suspend attempt
      could fail even though the user did not enable the flag by writing to
      /sys/power/wakeup_count. This is 1 use case how the issue can be seen
      (but similar use case with driver suspend failure can be thought of):
      
       1. Read /sys/power/wakeup_count
       2. echo count > /sys/power/wakeup_count
       3. echo freeze > /sys/power/wakeup_count
       4. Let the system suspend, and wakeup the system using some wake source
          that calls pm_wakeup_event() e.g. power button or something.
       5. Note that the combined wakeup count would be incremented due
          to the pm_wakeup_event() in the resume path.
       6. After resuming the events_check_enabled flag is still set.
      
      At this point if the user attempts to freeze again (without writing to
      /sys/power/wakeup_count), the suspend would fail even though there has
      been no wake event since the past resume.
      
      Address that by clearing the flag just before a resume is completed,
      so that it is always cleared for the corner cases mentioned above.
      Signed-off-by: NRajat Jain <rajatja@google.com>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      95b982b4
  3. 29 9月, 2017 1 次提交
    • R
      PM / s2idle: Invoke the ->wake() platform callback earlier · 87cbde8d
      Rafael J. Wysocki 提交于
      The role of the ->wake() platform callback for suspend-to-idle is to
      deal with possible spurious wakeups, among other things.  The ACPI
      implementation of it, acpi_s2idle_wake(), additionally checks the
      conditions for entering the Low Power S0 Idle state by the platform
      and reports the ones that have not been met.
      
      However, the ->wake() platform callback is invoked after calling
      dpm_noirq_resume_devices(), which means that the power states of some
      devices may have changed since s2idle_enter() returned, so some unmet
      Low Power S0 Idle conditions may be reported incorrectly as a result
      of that.
      
      To avoid these false positives, reorder the invocations of the
      dpm_noirq_resume_devices() routine and the ->wake() platform callback
      in s2idle_loop().
      
      Fixes: 726fb6b4 (ACPI / PM: Check low power idle constraints for debug only)
      Tested-by: NSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      87cbde8d
  4. 11 8月, 2017 3 次提交
  5. 05 8月, 2017 1 次提交
    • R
      ACPI / PM: Prefer suspend-to-idle over S3 on some systems · e870c6c8
      Rafael J. Wysocki 提交于
      Modify the ACPI system sleep support setup code to select
      suspend-to-idle as the default system sleep state if
      (1) the ACPI_FADT_LOW_POWER_S0 flag is set in the FADT and
      (2) the Low Power Idle S0 _DSM interface has been discovered and
      (3) the default sleep state was not selected from the kernel command
      line.
      
      The main motivation for this change is that systems where the (1) and
      (2) conditions are met typically ship with OSes that don't exercise
      the S3 path in the platform firmware which remains untested and turns
      out to be non-functional at least in some cases.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMario Limonciello <mario.limonciello@dell.com>
      e870c6c8
  6. 25 7月, 2017 4 次提交
  7. 22 7月, 2017 3 次提交
  8. 15 6月, 2017 1 次提交
    • R
      ACPI / PM: Ignore spurious SCI wakeups from suspend-to-idle · 33e4f80e
      Rafael J. Wysocki 提交于
      The ACPI SCI (System Control Interrupt) is set up as a wakeup IRQ
      during suspend-to-idle transitions and, consequently, any events
      signaled through it wake up the system from that state.  However,
      on some systems some of the events signaled via the ACPI SCI while
      suspended to idle should not cause the system to wake up.  In fact,
      quite often they should just be discarded.
      
      Arguably, systems should not resume entirely on such events, but in
      order to decide which events really should cause the system to resume
      and which are spurious, it is necessary to resume up to the point
      when ACPI SCIs are actually handled and processed, which is after
      executing dpm_resume_noirq() in the system resume path.
      
      For this reasons, add a loop around freeze_enter() in which the
      platforms can process events signaled via multiplexed IRQ lines
      like the ACPI SCI and add suspend-to-idle hooks that can be
      used for this purpose to struct platform_freeze_ops.
      
      In the ACPI case, the ->wake hook is used for checking if the SCI
      has triggered while suspended and deferring the interrupt-induced
      system wakeup until the events signaled through it are actually
      processed sufficiently to decide whether or not the system should
      resume.  In turn, the ->sync hook allows all of the relevant event
      queues to be flushed so as to prevent events from being missed due
      to race conditions.
      
      In addition to that, some ACPI code processing wakeup events needs
      to be modified to use the "hard" version of wakeup triggers, so that
      it will cause a system resume to happen on device-induced wakeup
      events even if the "soft" mechanism to prevent the system from
      suspending is not enabled.  However, to preserve the existing
      behavior with respect to suspend-to-RAM, this only is done in
      the suspend-to-idle case and only if an SCI has occurred while
      suspended.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      33e4f80e
  9. 07 6月, 2017 1 次提交
  10. 06 5月, 2017 1 次提交
    • R
      ACPI / sleep: Ignore spurious SCI wakeups from suspend-to-idle · eed4d47e
      Rafael J. Wysocki 提交于
      The ACPI SCI (System Control Interrupt) is set up as a wakeup IRQ
      during suspend-to-idle transitions and, consequently, any events
      signaled through it wake up the system from that state.  However,
      on some systems some of the events signaled via the ACPI SCI while
      suspended to idle should not cause the system to wake up.  In fact,
      quite often they should just be discarded.
      
      Arguably, systems should not resume entirely on such events, but in
      order to decide which events really should cause the system to resume
      and which are spurious, it is necessary to resume up to the point
      when ACPI SCIs are actually handled and processed, which is after
      executing dpm_resume_noirq() in the system resume path.
      
      For this reasons, add a loop around freeze_enter() in which the
      platforms can process events signaled via multiplexed IRQ lines
      like the ACPI SCI and add suspend-to-idle hooks that can be
      used for this purpose to struct platform_freeze_ops.
      
      In the ACPI case, the ->wake hook is used for checking if the SCI
      has triggered while suspended and deferring the interrupt-induced
      system wakeup until the events signaled through it are actually
      processed sufficiently to decide whether or not the system should
      resume.  In turn, the ->sync hook allows all of the relevant event
      queues to be flushed so as to prevent events from being missed due
      to race conditions.
      
      In addition to that, some ACPI code processing wakeup events needs
      to be modified to use the "hard" version of wakeup triggers, so that
      it will cause a system resume to happen on device-induced wakeup
      events even if the "soft" mechanism to prevent the system from
      suspending is not enabled (that also helps to catch device-induced
      wakeup events occurring during suspend transitions in progress).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      eed4d47e
  11. 20 1月, 2017 1 次提交
  12. 22 11月, 2016 2 次提交
    • R
      PM / sleep / ACPI: Use the ACPI_FADT_LOW_POWER_S0 flag · 08b98d32
      Rafael J. Wysocki 提交于
      Modify the ACPI system sleep support setup code to select
      suspend-to-idle as the default system sleep state if the
      ACPI_FADT_LOW_POWER_S0 flag is set in the FADT and the
      default sleep state was not selected from the kernel command
      line.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMario Limonciello <mario.limonciello@dell.com>
      08b98d32
    • R
      PM / sleep: System sleep state selection interface rework · 406e7938
      Rafael J. Wysocki 提交于
      There are systems in which the platform doesn't support any special
      sleep states, so suspend-to-idle (PM_SUSPEND_FREEZE) is the only
      available system sleep state.  However, some user space frameworks
      only use the "mem" and (sometimes) "standby" sleep state labels, so
      the users of those systems need to modify user space in order to be
      able to use system suspend at all and that may be a pain in practice.
      
      Commit 0399d4db (PM / sleep: Introduce command line argument for
      sleep state enumeration) attempted to address this problem by adding
      a command line argument to change the meaning of the "mem" string in
      /sys/power/state to make it trigger suspend-to-idle (instead of
      suspend-to-RAM).
      
      However, there also are systems in which the platform does support
      special sleep states, but suspend-to-idle is the preferred one anyway
      (it even may save more energy than the platform-provided sleep states
      in some cases) and the above commit doesn't help in those cases.
      
      For this reason, rework the system sleep state selection interface
      again (but preserve backwards compatibiliby).  Namely, add a new
      sysfs file, /sys/power/mem_sleep, that will control the system
      suspend mode triggered by writing "mem" to /sys/power/state (in
      analogy with what /sys/power/disk does for hibernation).  Make it
      select suspend-to-RAM ("deep" sleep) by default (if supported) and
      fall back to suspend-to-idle ("s2idle") otherwise and add a new
      command line argument, mem_sleep_default, allowing that default to
      be overridden if need be.
      
      At the same time, drop the relative_sleep_states command line
      argument that doesn't make sense any more.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Tested-by: NMario Limonciello <mario.limonciello@dell.com>
      406e7938
  13. 24 10月, 2016 1 次提交
    • J
      PM / suspend: Fix missing KERN_CONT for suspend message · 1adb469b
      Jon Hunter 提交于
      Commit 4bcc595c (printk: reinstate KERN_CONT for printing
      continuation lines) exposed a missing KERN_CONT from one of the
      messages shown on entering suspend. With v4.9-rc1, the 'done.' shown
      after syncing the filesystems no longer appears as a continuation but
      a new message with its own timestamp.
      
      [    9.259566] PM: Syncing filesystems ... [    9.264119] done.
      
      Fix this by adding the KERN_CONT log level for the 'done.' part of the
      message seen after syncing filesystems. While we are at it, convert
      these suspend printks to pr_info and pr_cont, respectively.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1adb469b
  14. 13 9月, 2016 1 次提交
    • S
      PM / sleep: enable suspend-to-idle even without registered suspend_ops · fa7fd6fa
      Sudeep Holla 提交于
      Suspend-to-idle (aka the "freeze" sleep state) is a system sleep state
      in which all of the processors enter deepest possible idle state and
      wait for interrupts right after suspending all the devices.
      
      There is no hard requirement for a platform to support and register
      platform specific suspend_ops to enter suspend-to-idle/freeze state.
      Only deeper system sleep states like PM_SUSPEND_STANDBY and
      PM_SUSPEND_MEM rely on such low level support/implementation.
      
      suspend-to-idle can be entered as along as all the devices can be
      suspended. This patch enables the support for suspend-to-idle even on
      systems that don't have any low level support for deeper system sleep
      states and/or don't register any platform specific suspend_ops.
      Signed-off-by: NSudeep Holla <sudeep.holla@arm.com>
      Tested-by: NAndy Gross <andy.gross@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      fa7fd6fa
  15. 28 6月, 2016 1 次提交
  16. 23 3月, 2016 1 次提交
  17. 11 2月, 2016 1 次提交
  18. 14 10月, 2015 1 次提交
    • R
      PM / sleep: Add flags to indicate platform firmware involvement · ef25ba04
      Rafael J. Wysocki 提交于
      There are quite a few cases in which device drivers, bus types or
      even the PM core itself may benefit from knowing whether or not
      the platform firmware will be involved in the upcoming system power
      transition (during system suspend) or whether or not it was involved
      in it (during system resume).
      
      For this reason, introduce global system suspend flags that can be
      used by the platform code to expose that information for the benefit
      of the other parts of the kernel and make the ACPI core set them
      as appropriate.
      
      Users of the new flags will be added later.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ef25ba04
  19. 01 8月, 2015 1 次提交
  20. 19 5月, 2015 1 次提交
  21. 13 5月, 2015 1 次提交
    • R
      PM / sleep: Refine diagnostic messages in enter_state() · a9215045
      Rafael J. Wysocki 提交于
      Some of the system suspend diagnostic messages related to
      suspend-to-idle refer to it as "freeze sleep" or "freeze state"
      while the others say "suspend-to-idle".  To reduce the possible
      confusion that may result from that, refine the former either to
      say "suspend to idle" too or to make it clearer that what is printed
      is a state string written to /sys/power/state ("mem", "standby",
      or "freeze").
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a9215045
  22. 26 2月, 2015 1 次提交
    • B
      PM / sleep: add configurable delay for pm_test · 1d4a9c17
      Brian Norris 提交于
      When CONFIG_PM_DEBUG=y, we provide a sysfs file (/sys/power/pm_test) for
      selecting one of a few suspend test modes, where rather than entering a
      full suspend state, the kernel will perform some subset of suspend
      steps, wait 5 seconds, and then resume back to normal operation.
      
      This mode is useful for (among other things) observing the state of the
      system just before entering a sleep mode, for debugging or analysis
      purposes. However, a constant 5 second wait is not sufficient for some
      sorts of analysis; for example, on an SoC, one might want to use
      external tools to probe the power states of various on-chip controllers
      or clocks.
      
      This patch turns this 5 second delay into a configurable module
      parameter, so users can determine how long to wait in this
      pseudo-suspend state before resuming the system.
      
      Example (wait 30 seconds);
      
        # echo 30 > /sys/module/suspend/parameters/pm_test_delay
        # echo core > /sys/power/pm_test
        # time echo mem  > /sys/power/state
        ...
        [   17.583625] suspend debug: Waiting for 30 second(s).
        ...
        real	0m30.381s
        user	0m0.017s
        sys	0m0.080s
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Reviewed-by: NKevin Cernekee <cernekee@chromium.org>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1d4a9c17
  23. 14 2月, 2015 1 次提交
    • R
      PM / sleep: Re-implement suspend-to-idle handling · 38106313
      Rafael J. Wysocki 提交于
      In preparation for adding support for quiescing timers in the final
      stage of suspend-to-idle transitions, rework the freeze_enter()
      function making the system wait on a wakeup event, the freeze_wake()
      function terminating the suspend-to-idle loop and the mechanism by
      which deep idle states are entered during suspend-to-idle.
      
      First of all, introduce a simple state machine for suspend-to-idle
      and make the code in question use it.
      
      Second, prevent freeze_enter() from losing wakeup events due to race
      conditions and ensure that the number of online CPUs won't change
      while it is being executed.  In addition to that, make it force
      all of the CPUs re-enter the idle loop in case they are in idle
      states already (so they can enter deeper idle states if possible).
      
      Next, drop cpuidle_use_deepest_state() and replace use_deepest_state
      checks in cpuidle_select() and cpuidle_reflect() with a single
      suspend-to-idle state check in cpuidle_idle_call().
      
      Finally, introduce cpuidle_enter_freeze() that will simply find the
      deepest idle state available to the given CPU and enter it using
      cpuidle_enter().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      38106313
  24. 09 11月, 2014 1 次提交
  25. 01 10月, 2014 3 次提交
  26. 22 9月, 2014 1 次提交
  27. 03 9月, 2014 1 次提交
  28. 23 7月, 2014 1 次提交
  29. 21 7月, 2014 1 次提交
  30. 17 7月, 2014 1 次提交