1. 11 2月, 2014 1 次提交
  2. 15 1月, 2014 3 次提交
  3. 22 12月, 2013 1 次提交
    • U
      PM / Runtime: Implement the pm_generic_runtime functions for CONFIG_PM · 717e5d45
      Ulf Hansson 提交于
      The pm_generic_runtime_suspend|resume functions were implemented within
      CONFIG_PM_RUNTIME.
      
      As we also may use runtime PM callbacks during system suspend, to put
      devices into low power state, we need to move the implementation of
      pm_generic_runtime_suspend|resume to CONFIG_PM.
      
      This change gives a power domain provision to invoke a platform
      driver's runtime PM callback from a power domain's system PM callback.
      This were earlier prevented by the platform bus, since it uses the
      pm_generic_runtime_suspend|resume functions as runtime PM callbacks.
      
      Cc: Kevin Hilman <khilman@linaro.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      717e5d45
  4. 08 12月, 2013 1 次提交
  5. 28 11月, 2013 1 次提交
  6. 15 11月, 2013 1 次提交
  7. 14 11月, 2013 1 次提交
  8. 26 10月, 2013 3 次提交
  9. 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
  10. 16 10月, 2013 1 次提交
  11. 06 8月, 2013 1 次提交
  12. 27 7月, 2013 2 次提交
    • 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
    • J
      driver core: replace strict_strto*() with kstrto*() · 34da5e67
      Jingoo Han 提交于
      The usage of strict_strto*() is not preferred, because
      strict_strto*() is obsolete. Thus, kstrto*() should be
      used.
      Signed-off-by: NJingoo Han <jg1.han@samsung.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      34da5e67
  13. 24 6月, 2013 1 次提交
  14. 21 6月, 2013 1 次提交
    • J
      PM / Sleep: Print last wakeup source on failed wakeup_count write · bb177fed
      Julius Werner 提交于
      Commit a938da06 introduced a useful little log message to tell
      users/debuggers which wakeup source aborted a suspend.  However,
      this message is only printed if the abort happens during the
      in-kernel suspend path (after writing /sys/power/state).
      
      The full specification of the /sys/power/wakeup_count facility
      allows user-space power managers to double-check if wakeups have
      already happened before it actually tries to suspend (e.g. while it
      was running user-space pre-suspend hooks), by writing the last known
      wakeup_count value to /sys/power/wakeup_count.  This patch changes
      the sysfs handler for that node to also print said log message if
      that write fails, so that we can figure out the offending wakeup
      source for both kinds of suspend aborts.
      Signed-off-by: NJulius Werner <jwerner@chromium.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      bb177fed
  15. 12 6月, 2013 1 次提交
  16. 04 6月, 2013 2 次提交
  17. 12 5月, 2013 1 次提交
  18. 12 4月, 2013 3 次提交
  19. 05 4月, 2013 1 次提交
  20. 02 4月, 2013 1 次提交
    • R
      PM / QoS: Avoid possible deadlock related to sysfs access · 0f703069
      Rafael J. Wysocki 提交于
      Commit b81ea1b5 (PM / QoS: Fix concurrency issues and memory leaks in
      device PM QoS) put calls to pm_qos_sysfs_add_latency(),
      pm_qos_sysfs_add_flags(), pm_qos_sysfs_remove_latency(), and
      pm_qos_sysfs_remove_flags() under dev_pm_qos_mtx, which was a
      mistake, because it may lead to deadlocks in some situations.
      For example, if pm_qos_remote_wakeup_store() is run in parallel
      with dev_pm_qos_constraints_destroy(), they may deadlock in the
      following way:
      
       ======================================================
       [ INFO: possible circular locking dependency detected ]
       3.9.0-rc4-next-20130328-sasha-00014-g91a3267 #319 Tainted: G        W
       -------------------------------------------------------
       trinity-child6/12371 is trying to acquire lock:
        (s_active#54){++++.+}, at: [<ffffffff81301631>] sysfs_addrm_finish+0x31/0x60
      
       but task is already holding lock:
        (dev_pm_qos_mtx){+.+.+.}, at: [<ffffffff81f07cc3>] dev_pm_qos_constraints_destroy+0x23/0x250
      
       which lock already depends on the new lock.
      
       the existing dependency chain (in reverse order) is:
      
       -> #1 (dev_pm_qos_mtx){+.+.+.}:
              [<ffffffff811811da>] lock_acquire+0x1aa/0x240
              [<ffffffff83dab809>] __mutex_lock_common+0x59/0x5e0
              [<ffffffff83dabebf>] mutex_lock_nested+0x3f/0x50
              [<ffffffff81f07f2f>] dev_pm_qos_update_flags+0x3f/0xc0
              [<ffffffff81f05f4f>] pm_qos_remote_wakeup_store+0x3f/0x70
              [<ffffffff81efbb43>] dev_attr_store+0x13/0x20
              [<ffffffff812ffdaa>] sysfs_write_file+0xfa/0x150
              [<ffffffff8127f2c1>] __kernel_write+0x81/0x150
              [<ffffffff812afc2d>] write_pipe_buf+0x4d/0x80
              [<ffffffff812af57c>] splice_from_pipe_feed+0x7c/0x120
              [<ffffffff812afa25>] __splice_from_pipe+0x45/0x80
              [<ffffffff812b14fc>] splice_from_pipe+0x4c/0x70
              [<ffffffff812b1538>] default_file_splice_write+0x18/0x30
              [<ffffffff812afae3>] do_splice_from+0x83/0xb0
              [<ffffffff812afb2e>] direct_splice_actor+0x1e/0x20
              [<ffffffff812b0277>] splice_direct_to_actor+0xe7/0x200
              [<ffffffff812b15bc>] do_splice_direct+0x4c/0x70
              [<ffffffff8127eda9>] do_sendfile+0x169/0x300
              [<ffffffff8127ff94>] SyS_sendfile64+0x64/0xb0
              [<ffffffff83db7d18>] tracesys+0xe1/0xe6
      
       -> #0 (s_active#54){++++.+}:
              [<ffffffff811800cf>] __lock_acquire+0x15bf/0x1e50
              [<ffffffff811811da>] lock_acquire+0x1aa/0x240
              [<ffffffff81300aa2>] sysfs_deactivate+0x122/0x1a0
              [<ffffffff81301631>] sysfs_addrm_finish+0x31/0x60
              [<ffffffff812ff77f>] sysfs_hash_and_remove+0x7f/0xb0
              [<ffffffff813035a1>] sysfs_unmerge_group+0x51/0x70
              [<ffffffff81f068f4>] pm_qos_sysfs_remove_flags+0x14/0x20
              [<ffffffff81f07490>] __dev_pm_qos_hide_flags+0x30/0x70
              [<ffffffff81f07cd5>] dev_pm_qos_constraints_destroy+0x35/0x250
              [<ffffffff81f06931>] dpm_sysfs_remove+0x11/0x50
              [<ffffffff81efcf6f>] device_del+0x3f/0x1b0
              [<ffffffff81efd128>] device_unregister+0x48/0x60
              [<ffffffff82d4083c>] usb_hub_remove_port_device+0x1c/0x20
              [<ffffffff82d2a9cd>] hub_disconnect+0xdd/0x160
              [<ffffffff82d36ab7>] usb_unbind_interface+0x67/0x170
              [<ffffffff81f001a7>] __device_release_driver+0x87/0xe0
              [<ffffffff81f00559>] device_release_driver+0x29/0x40
              [<ffffffff81effc58>] bus_remove_device+0x148/0x160
              [<ffffffff81efd07f>] device_del+0x14f/0x1b0
              [<ffffffff82d344f9>] usb_disable_device+0xf9/0x280
              [<ffffffff82d34ff8>] usb_set_configuration+0x268/0x840
              [<ffffffff82d3a7fc>] usb_remove_store+0x4c/0x80
              [<ffffffff81efbb43>] dev_attr_store+0x13/0x20
              [<ffffffff812ffdaa>] sysfs_write_file+0xfa/0x150
              [<ffffffff8127f71d>] do_loop_readv_writev+0x4d/0x90
              [<ffffffff8127f999>] do_readv_writev+0xf9/0x1e0
              [<ffffffff8127faba>] vfs_writev+0x3a/0x60
              [<ffffffff8127fc60>] SyS_writev+0x50/0xd0
              [<ffffffff83db7d18>] tracesys+0xe1/0xe6
      
       other info that might help us debug this:
      
        Possible unsafe locking scenario:
      
              CPU0                    CPU1
              ----                    ----
         lock(dev_pm_qos_mtx);
                                      lock(s_active#54);
                                      lock(dev_pm_qos_mtx);
         lock(s_active#54);
      
        *** DEADLOCK ***
      
      To avoid that, remove the calls to functions mentioned above from
      under dev_pm_qos_mtx and introduce a separate lock to prevent races
      between functions that add or remove device PM QoS sysfs attributes
      from happening.
      Reported-by: NSasha Levin <sasha.levin@oracle.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0f703069
  21. 04 3月, 2013 2 次提交
    • 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
    • R
      PM / QoS: Fix concurrency issues and memory leaks in device PM QoS · b81ea1b5
      Rafael J. Wysocki 提交于
      The current device PM QoS code assumes that certain functions will
      never be called in parallel with each other (for example, it is
      assumed that dev_pm_qos_expose_flags() won't be called in parallel
      with dev_pm_qos_hide_flags() for the same device and analogously
      for the latency limit), which may be overly optimistic.  Moreover,
      dev_pm_qos_expose_flags() and dev_pm_qos_expose_latency_limit()
      leak memory in error code paths (req needs to be freed on errors)
      and __dev_pm_qos_drop_user_request() forgets to free the request.
      
      To fix the above issues put more things under the device PM QoS
      mutex to make them mutually exclusive and add the missing freeing
      of memory.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      b81ea1b5
  22. 24 2月, 2013 2 次提交
    • M
      pm / runtime: force memory allocation with no I/O during Runtime PM callbcack · db88175f
      Ming Lei 提交于
      Apply the introduced memalloc_noio_save() and memalloc_noio_restore() to
      force memory allocation with no I/O during runtime_resume/runtime_suspend
      callback on device with the flag of 'memalloc_noio' set.
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: David Decotigny <david.decotigny@google.com>
      Cc: Tom Herbert <therbert@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Oliver Neukum <oneukum@suse.de>
      Cc: Jiri Kosina <jiri.kosina@suse.com>
      Cc: Mel Gorman <mel@csn.ul.ie>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Greg KH <greg@kroah.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      db88175f
    • M
      pm / runtime: introduce pm_runtime_set_memalloc_noio() · e823407f
      Ming Lei 提交于
      Introduce the flag memalloc_noio in 'struct dev_pm_info' to help PM core
      to teach mm not allocating memory with GFP_KERNEL flag for avoiding
      probable deadlock.
      
      As explained in the comment, any GFP_KERNEL allocation inside
      runtime_resume() or runtime_suspend() on any one of device in the path
      from one block or network device to the root device in the device tree
      may cause deadlock, the introduced pm_runtime_set_memalloc_noio() sets
      or clears the flag on device in the path recursively.
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Oliver Neukum <oneukum@suse.de>
      Cc: Jiri Kosina <jiri.kosina@suse.com>
      Cc: Mel Gorman <mel@csn.ul.ie>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Greg KH <greg@kroah.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: David Decotigny <david.decotigny@google.com>
      Cc: Tom Herbert <therbert@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e823407f
  23. 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
  24. 02 2月, 2013 2 次提交
  25. 26 1月, 2013 2 次提交
  26. 06 1月, 2013 2 次提交
  27. 24 11月, 2012 1 次提交