1. 01 10月, 2014 1 次提交
  2. 22 9月, 2014 1 次提交
  3. 03 9月, 2014 1 次提交
  4. 23 7月, 2014 1 次提交
  5. 21 7月, 2014 1 次提交
  6. 17 7月, 2014 1 次提交
  7. 15 7月, 2014 1 次提交
  8. 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
  9. 26 5月, 2014 3 次提交
    • R
      PM / sleep: Introduce command line argument for sleep state enumeration · 0399d4db
      Rafael J. Wysocki 提交于
      On some systems the platform doesn't support neither
      PM_SUSPEND_MEM nor PM_SUSPEND_STANDBY, so 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 is not always possible.
      
      For this reason, add a new kernel command line argument,
      relative_sleep_states, allowing the users of those systems to change
      the way in which the kernel assigns labels to system sleep states.
      Namely, for relative_sleep_states=1, the "mem", "standby" and "freeze"
      labels will enumerate the available system sleem states from the
      deepest to the shallowest, respectively, so that "mem" is always
      present in /sys/power/state and the other state strings may or may
      not be presend depending on what is supported by the platform.
      
      Update system sleep states documentation to reflect this change.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0399d4db
    • R
      PM / sleep: Use valid_state() for platform-dependent sleep states only · 43e8317b
      Rafael J. Wysocki 提交于
      Use the observation that, for platform-dependent sleep states
      (PM_SUSPEND_STANDBY, PM_SUSPEND_MEM), a given state is either
      always supported or always unsupported and store that information
      in pm_states[] instead of calling valid_state() every time we
      need to check it.
      
      Also do not use valid_state() for PM_SUSPEND_FREEZE, which is always
      valid, and move the pm_test_level validity check for PM_SUSPEND_FREEZE
      directly into enter_state().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      43e8317b
    • R
      PM / sleep: Add state field to pm_states[] entries · 27ddcc65
      Rafael J. Wysocki 提交于
      To allow sleep states corresponding to the "mem", "standby" and
      "freeze" lables to be different from the pm_states[] indexes of
      those strings, introduce struct pm_sleep_state, consisting of
      a string label and a state number, and turn pm_states[] into an
      array of objects of that type.
      
      This modification should not lead to any functional changes.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      27ddcc65
  10. 16 5月, 2014 1 次提交
    • R
      ACPI / PM: Hold ACPI scan lock over the "freeze" sleep state · 1f0b6386
      Rafael J. Wysocki 提交于
      The "freeze" sleep state suffers from the same issue that was
      addressed by commit ad07277e (ACPI / PM: Hold acpi_scan_lock over
      system PM transitions) for ACPI sleep states, that is, things break
      if ->remove() is called for devices whose system resume callbacks
      haven't been executed yet.
      
      It also can be addressed in the same way, by holding the ACPI scan
      lock over the "freeze" sleep state and PM transitions to and from
      that state, but ->begin() and ->end() platform operations for the
      "freeze" sleep state are needed for this purpose.
      
      This change has been tested on Acer Aspire S5 with Thunderbolt.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1f0b6386
  11. 07 5月, 2014 1 次提交
  12. 22 4月, 2014 1 次提交
  13. 08 4月, 2014 1 次提交
  14. 11 3月, 2014 1 次提交
  15. 26 7月, 2013 1 次提交
    • B
      PM / Sleep: increase ftrace coverage in suspend/resume · 3831261e
      Brandt, Todd E 提交于
      Change where ftrace is disabled and re-enabled during system
      suspend/resume to allow tracing of device driver pm callbacks.
      Ftrace will now be turned off when suspend reaches
      disable_nonboot_cpus() instead of at the very beginning of system
      suspend.
      
      Ftrace was disabled during suspend/resume back in 2008 by
      Steven Rostedt as he discovered there was a conflict in the
      enable_nonboot_cpus() call (see commit f42ac38c "ftrace: disable
      tracing for suspend to ram").  This change preserves his fix by
      disabling ftrace, but only at the function where it is known
      to cause problems.
      
      The new change allows tracing of the device level code for better
      debug.
      
      [rjw: Changelog]
      Signed-off-by: NTodd Brandt <todd.e.brandt@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      3831261e
  16. 12 6月, 2013 1 次提交
  17. 05 4月, 2013 2 次提交
  18. 10 2月, 2013 1 次提交
    • Z
      PM: Introduce suspend state PM_SUSPEND_FREEZE · 7e73c5ae
      Zhang Rui 提交于
      PM_SUSPEND_FREEZE state is a general state that
      does not need any platform specific support, it equals
      frozen processes + suspended devices + idle processors.
      
      Compared with PM_SUSPEND_MEMORY,
      PM_SUSPEND_FREEZE saves less power
      because the system is still in a running state.
      PM_SUSPEND_FREEZE has less resume latency because it does not
      touch BIOS, and the processors are in idle state.
      
      Compared with RTPM/idle,
      PM_SUSPEND_FREEZE saves more power as
      1. the processor has longer sleep time because processes are frozen.
         The deeper c-state the processor supports, more power saving we can get.
      2. PM_SUSPEND_FREEZE uses system suspend code path, thus we can get
         more power saving from the devices that does not have good RTPM support.
      
      This state is useful for
      1) platforms that do not have STR, or have a broken STR.
      2) platforms that have an extremely low power idle state,
         which can be used to replace STR.
      
      The following describes how PM_SUSPEND_FREEZE state works.
      1. echo freeze > /sys/power/state
      2. the processes are frozen.
      3. all the devices are suspended.
      4. all the processors are blocked by a wait queue
      5. all the processors idles and enters (Deep) c-state.
      6. an interrupt fires.
      7. a processor is woken up and handles the irq.
      8. if it is a general event,
         a) the irq handler runs and quites.
         b) goto step 4.
      9. if it is a real wake event, say, power button pressing, keyboard touch, mouse moving,
         a) the irq handler runs and activate the wakeup source
         b) wakeup_source_activate() notifies the wait queue.
         c) system starts resuming from PM_SUSPEND_FREEZE
      10. all the devices are resumed.
      11. all the processes are unfrozen.
      12. system is back to working.
      
      Known Issue:
      The wakeup of this new PM_SUSPEND_FREEZE state may behave differently
      from the previous suspend state.
      Take ACPI platform for example, there are some GPEs that only enabled
      when the system is in sleep state, to wake the system backk from S3/S4.
      But we are not touching these GPEs during transition to PM_SUSPEND_FREEZE.
      This means we may lose some wake event.
      But on the other hand, as we do not disable all the Interrupts during
      PM_SUSPEND_FREEZE, we may get some extra "wakeup" Interrupts, that are
      not available for S3/S4.
      
      The patches has been tested on an old Sony laptop, and here are the results:
      
      Average Power:
      1. RPTM/idle for half an hour:
         14.8W, 12.6W, 14.1W, 12.5W, 14.4W, 13.2W, 12.9W
      2. Freeze for half an hour:
         11W, 10.4W, 9.4W, 11.3W 10.5W
      3. RTPM/idle for three hours:
         11.6W
      4. Freeze for three hours:
         10W
      5. Suspend to Memory:
         0.5~0.9W
      
      Average Resume Latency:
      1. RTPM/idle with a black screen: (From pressing keyboard to screen back)
         Less than 0.2s
      2. Freeze: (From pressing power button to screen back)
         2.50s
      3. Suspend to Memory: (From pressing power button to screen back)
         4.33s
      
      >From the results, we can see that all the platforms should benefit from
      this patch, even if it does not have Low Power S0.
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      7e73c5ae
  19. 09 8月, 2012 1 次提交
  20. 31 7月, 2012 1 次提交
    • S
      NMI watchdog: fix for lockup detector breakage on resume · 45226e94
      Sameer Nanda 提交于
      On the suspend/resume path the boot CPU does not go though an
      offline->online transition.  This breaks the NMI detector post-resume
      since it depends on PMU state that is lost when the system gets
      suspended.
      
      Fix this by forcing a CPU offline->online transition for the lockup
      detector on the boot CPU during resume.
      
      To provide more context, we enable NMI watchdog on Chrome OS.  We have
      seen several reports of systems freezing up completely which indicated
      that the NMI watchdog was not firing for some reason.
      
      Debugging further, we found a simple way of repro'ing system freezes --
      issuing the command 'tasket 1 sh -c "echo nmilockup > /proc/breakme"'
      after the system has been suspended/resumed one or more times.
      
      With this patch in place, the system freeze result in panics, as
      expected.
      
      These panics provide a nice stack trace for us to debug the actual issue
      causing the freeze.
      
      [akpm@linux-foundation.org: fiddle with code comment]
      [akpm@linux-foundation.org: make lockup_detector_bootcpu_resume() conditional on CONFIG_SUSPEND]
      [akpm@linux-foundation.org: fix section errors]
      Signed-off-by: NSameer Nanda <snanda@chromium.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Mandeep Singh Baines <msb@chromium.org>
      Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Cc: Anshuman Khandual <khandual@linux.vnet.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      45226e94
  21. 01 7月, 2012 1 次提交
    • S
      ftrace: Disable function tracing during suspend/resume and hibernation, again · 443772d4
      Srivatsa S. Bhat 提交于
      If function tracing is enabled for some of the low-level suspend/resume
      functions, it leads to triple fault during resume from suspend, ultimately
      ending up in a reboot instead of a resume (or a total refusal to come out
      of suspended state, on some machines).
      
      This issue was explained in more detail in commit f42ac38c (ftrace:
      disable tracing for suspend to ram). However, the changes made by that commit
      got reverted by commit cbe2f5a6 (tracing: allow tracing of
      suspend/resume & hibernation code again). So, unfortunately since things are
      not yet robust enough to allow tracing of low-level suspend/resume functions,
      suspend/resume is still broken when ftrace is enabled.
      
      So fix this by disabling function tracing during suspend/resume & hibernation.
      Signed-off-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      443772d4
  22. 29 3月, 2012 1 次提交
    • R
      PM / Sleep: Move disabling of usermode helpers to the freezer · 1e73203c
      Rafael J. Wysocki 提交于
      The core suspend/hibernation code calls usermodehelper_disable() to
      avoid race conditions between the freezer and the starting of
      usermode helpers and each code path has to do that on its own.
      However, it is always called right before freeze_processes()
      and usermodehelper_enable() is always called right after
      thaw_processes().  For this reason, to avoid code duplication and
      to make the connection between usermodehelper_disable() and the
      freezer more visible, make freeze_processes() call it and remove the
      direct usermodehelper_disable() and usermodehelper_enable() calls
      from all suspend/hibernation code paths.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: stable@vger.kernel.org
      1e73203c
  23. 18 2月, 2012 3 次提交
  24. 10 2月, 2012 1 次提交
  25. 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
  26. 09 12月, 2011 1 次提交
  27. 22 11月, 2011 1 次提交
    • T
      freezer: clean up freeze_processes() failure path · 03afed8b
      Tejun Heo 提交于
      freeze_processes() failure path is rather messy.  Freezing is canceled
      for workqueues and tasks which aren't frozen yet but frozen tasks are
      left alone and should be thawed by the caller and of course some
      callers (xen and kexec) didn't do it.
      
      This patch updates __thaw_task() to handle cancelation correctly and
      makes freeze_processes() and freeze_kernel_threads() call
      thaw_processes() on failure instead so that the system is fully thawed
      on failure.  Unnecessary [suspend_]thaw_processes() calls are removed
      from kernel/power/hibernate.c, suspend.c and user.c.
      
      While at it, restructure error checking if clause in suspend_prepare()
      to be less weird.
      
      -v2: Srivatsa spotted missing removal of suspend_thaw_processes() in
           suspend_prepare() and error in commit message.  Updated.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Acked-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      03afed8b
  28. 01 11月, 2011 1 次提交
  29. 31 10月, 2011 1 次提交
    • P
      kernel: fix several implicit usasges of kmod.h · 74da1ff7
      Paul Gortmaker 提交于
      These files were implicitly relying on <linux/kmod.h> coming in via
      module.h, as without it we get things like:
      
      kernel/power/suspend.c:100: error: implicit declaration of function ‘usermodehelper_disable’
      kernel/power/suspend.c:109: error: implicit declaration of function ‘usermodehelper_enable’
      kernel/power/user.c:254: error: implicit declaration of function ‘usermodehelper_disable’
      kernel/power/user.c:261: error: implicit declaration of function ‘usermodehelper_enable’
      
      kernel/sys.c:317: error: implicit declaration of function ‘usermodehelper_disable’
      kernel/sys.c:1816: error: implicit declaration of function ‘call_usermodehelper_setup’
      kernel/sys.c:1822: error: implicit declaration of function ‘call_usermodehelper_setfns’
      kernel/sys.c:1824: error: implicit declaration of function ‘call_usermodehelper_exec’
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      74da1ff7
  30. 17 10月, 2011 2 次提交
    • D
      PM / Suspend: Off by one in pm_suspend() · 528f7ce6
      Dan Carpenter 提交于
      In enter_state() we use "state" as an offset for the pm_states[]
      array.  The pm_states[] array only has PM_SUSPEND_MAX elements so
      this test is off by one.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Cc: stable@kernel.org
      528f7ce6
    • S
      PM / Suspend: Add statistics debugfs file for suspend to RAM · 2a77c46d
      ShuoX Liu 提交于
      Record S3 failure time about each reason and the latest two failed
      devices' names in S3 progress.
      We can check it through 'suspend_stats' entry in debugfs.
      
      The motivation of the patch:
      
      We are enabling power features on Medfield. Comparing with PC/notebook,
      a mobile enters/exits suspend-2-ram (we call it s3 on Medfield) far
      more frequently. If it can't enter suspend-2-ram in time, the power
      might be used up soon.
      
      We often find sometimes, a device suspend fails. Then, system retries
      s3 over and over again. As display is off, testers and developers
      don't know what happens.
      
      Some testers and developers complain they don't know if system
      tries suspend-2-ram, and what device fails to suspend. They need
      such info for a quick check. The patch adds suspend_stats under
      debugfs for users to check suspend to RAM statistics quickly.
      
      If not using this patch, we have other methods to get info about
      what device fails. One is to turn on  CONFIG_PM_DEBUG, but users
      would get too much info and testers need recompile the system.
      
      In addition, dynamic debug is another good tool to dump debug info.
      But it still doesn't match our utilization scenario closely.
      1) user need write a user space parser to process the syslog output;
      2) Our testing scenario is we leave the mobile for at least hours.
         Then, check its status. No serial console available during the
         testing. One is because console would be suspended, and the other
         is serial console connecting with spi or HSU devices would consume
         power. These devices are powered off at suspend-2-ram.
      Signed-off-by: NShuoX Liu <shuox.liu@intel.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      2a77c46d
  31. 16 7月, 2011 2 次提交
    • K
      PM / Suspend: Export suspend_set_ops, suspend_valid_only_mem · a5e4fd87
      Kevin Hilman 提交于
      Some platforms wish to implement their PM core suspend code as
      modules.  To do so, these functions need to be exported to modules.
      
      [rjw: Replaced EXPORT_SYMBOL with EXPORT_SYMBOL_GPL]
      Reported-by: NJean Pihet <j-pihet@ti.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      a5e4fd87
    • M
      PM / Suspend: Add .suspend_again() callback to suspend_ops · 3b5fe852
      MyungJoo Ham 提交于
      A system or a device may need to control suspend/wakeup events. It may
      want to wakeup the system after a predefined amount of time or at a
      predefined event decided while entering suspend for polling or delayed
      work. Then, it may want to enter suspend again if its predefined wakeup
      condition is the only wakeup reason and there is no outstanding events;
      thus, it does not wakeup the userspace unnecessary or unnecessary
      devices and keeps suspended as long as possible (saving the power).
      
      Enabling a system to wakeup after a specified time can be easily
      achieved by using RTC. However, to enter suspend again immediately
      without invoking userland and unrelated devices, we need additional
      features in the suspend framework.
      
      Such need comes from:
      
       1. Monitoring a critical device status without interrupts that can
      wakeup the system. (in-suspend polling)
       An example is ambient temperature monitoring that needs to shut down
      the system or a specific device function if it is too hot or cold. The
      temperature of a specific device may be needed to be monitored as well;
      e.g., a charger monitors battery temperature in order to stop charging
      if overheated.
      
       2. Execute critical "delayed work" at suspend.
       A driver or a system/board may have a delayed work (or any similar
      things) that it wants to execute at the requested time.
       For example, some chargers want to check the battery voltage some
      time (e.g., 30 seconds) after the battery is fully charged and the
      charger has stopped. Then, the charger restarts charging if the voltage
      has dropped more than a threshold, which is smaller than "restart-charger"
      voltage, which is a threshold to restart charging regardless of the
      time passed.
      
      This patch allows to add "suspend_again" callback at struct
      platform_suspend_ops and let the "suspend_again" callback return true if
      the system is required to enter suspend again after the current instance
      of wakeup. Device-wise suspend_again implemented at dev_pm_ops or
      syscore is not done because: a) suspend_again feature is usually under
      platform-wise decision and controls the behavior of the whole platform
      and b) There are very limited devices related to the usage cases of
      suspend_again; chargers and temperature sensors are mentioned so far.
      
      With suspend_again callback registered at struct platform_suspend_ops
      suspend_ops in kernel/power/suspend.c with suspend_set_ops by the
      platform, the suspend framework tries to enter suspend again by
      looping suspend_enter() if suspend_again has returned true and there has
      been no errors in the suspending sequence or pending wakeups (by
      pm_wakeup_pending).
      
      Tested at Exynos4-NURI.
      
      [rjw: Fixed up kerneldoc comment for suspend_enter().]
      Signed-off-by: NMyungJoo Ham <myungjoo.ham@samsung.com>
      Signed-off-by: NKyungmin Park <kyungmin.park@samsung.com>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      3b5fe852
  32. 18 5月, 2011 1 次提交
  33. 12 5月, 2011 1 次提交