1. 22 4月, 2016 1 次提交
  2. 09 3月, 2016 5 次提交
  3. 16 2月, 2016 2 次提交
    • A
      PM / Domains: remove old power on/off latencies · 90e63452
      Axel Haslam 提交于
      Now that all known users have been converted to use state latencies,
      we can remove the latency field in the generic_pm_domain structure.
      Signed-off-by: NAxel Haslam <ahaslam+renesas@baylibre.com>
      Acked-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      90e63452
    • A
      PM / Domains: Support for multiple states · fc5cbf0c
      Axel Haslam 提交于
      Some hardware (eg. OMAP), has the ability to enter different low power
      modes for a given power domain. This allows for more fine grained control
      over the power state of the platform. As a typical example, some registers
      of the hardware may be implemented with retention flip-flops and be able
      to retain their state at lower voltages allowing for faster on/off
      latencies and an increased window of opportunity to enter an intermediate
      low power state other than "off"
      
      When trying to set a power domain to off, the genpd governor will choose
      the deepest state that will respect the qos constraints of all the devices
      and sub-domains on the power domain. The state chosen by the governor is
      saved in the "state_idx" field of the generic_pm_domain structure and
      shall be used by the power_off and power_on callbacks to perform the
      necessary actions to set the power domain into (and out of) the state
      indicated by state_idx.
      
      States must be declared in ascending order from shallowest to deepest,
      deepest meaning the state which takes longer to enter and exit.
      
      For platforms that don't declare any states, a single a single "off"
      state is used. Once all platforms are converted to use the state array,
      the legacy on/off latencies will be removed.
      
      [ Lina: Modified genpd state initialization and remove use of
              save_state_latency_ns in genpd timing data ]
      Suggested-by: NKevin Hilman <khilman@linaro.org>
      Signed-off-by: NLina Iyer <lina.iyer@linaro.org>
      Signed-off-by: NAxel Haslam <ahaslam+renesas@baylibre.com>
      Acked-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      fc5cbf0c
  4. 03 2月, 2016 1 次提交
  5. 28 1月, 2016 2 次提交
  6. 22 1月, 2016 1 次提交
    • M
      PM / domains: fix lockdep issue for all subdomains · 0106ef51
      Marek Szyprowski 提交于
      During genpd_poweron, genpd->lock is acquired recursively for each
      parent (master) domain, which are separate objects. This confuses
      lockdep, which considers every operation on genpd->lock as being done on
      the same lock class. This leads to the following false positive warning:
      
      =============================================
      [ INFO: possible recursive locking detected ]
      4.4.0-rc4-xu3s #32 Not tainted
      ---------------------------------------------
      swapper/0/1 is trying to acquire lock:
       (&genpd->lock){+.+...}, at: [<c0361550>] __genpd_poweron+0x64/0x108
      
      but task is already holding lock:
       (&genpd->lock){+.+...}, at: [<c0361af8>] genpd_dev_pm_attach+0x168/0x1b8
      
      other info that might help us debug this:
       Possible unsafe locking scenario:
      
             CPU0
             ----
        lock(&genpd->lock);
        lock(&genpd->lock);
      
       *** DEADLOCK ***
      
       May be due to missing lock nesting notation
      
      3 locks held by swapper/0/1:
       #0:  (&dev->mutex){......}, at: [<c0350910>] __driver_attach+0x48/0x98
       #1:  (&dev->mutex){......}, at: [<c0350920>] __driver_attach+0x58/0x98
       #2:  (&genpd->lock){+.+...}, at: [<c0361af8>] genpd_dev_pm_attach+0x168/0x1b8
      
      stack backtrace:
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.4.0-rc4-xu3s #32
      Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      [<c0016c98>] (unwind_backtrace) from [<c00139c4>] (show_stack+0x10/0x14)
      [<c00139c4>] (show_stack) from [<c0270df0>] (dump_stack+0x84/0xc4)
      [<c0270df0>] (dump_stack) from [<c00780b8>] (__lock_acquire+0x1f88/0x215c)
      [<c00780b8>] (__lock_acquire) from [<c007886c>] (lock_acquire+0xa4/0xd0)
      [<c007886c>] (lock_acquire) from [<c0641f2c>] (mutex_lock_nested+0x70/0x4d4)
      [<c0641f2c>] (mutex_lock_nested) from [<c0361550>] (__genpd_poweron+0x64/0x108)
      [<c0361550>] (__genpd_poweron) from [<c0361b00>] (genpd_dev_pm_attach+0x170/0x1b8)
      [<c0361b00>] (genpd_dev_pm_attach) from [<c03520a8>] (platform_drv_probe+0x2c/0xac)
      [<c03520a8>] (platform_drv_probe) from [<c03507d4>] (driver_probe_device+0x208/0x2fc)
      [<c03507d4>] (driver_probe_device) from [<c035095c>] (__driver_attach+0x94/0x98)
      [<c035095c>] (__driver_attach) from [<c034ec14>] (bus_for_each_dev+0x68/0x9c)
      [<c034ec14>] (bus_for_each_dev) from [<c034fec8>] (bus_add_driver+0x1a0/0x218)
      [<c034fec8>] (bus_add_driver) from [<c035115c>] (driver_register+0x78/0xf8)
      [<c035115c>] (driver_register) from [<c0338488>] (exynos_drm_register_drivers+0x28/0x74)
      [<c0338488>] (exynos_drm_register_drivers) from [<c0338594>] (exynos_drm_init+0x6c/0xc4)
      [<c0338594>] (exynos_drm_init) from [<c00097f4>] (do_one_initcall+0x90/0x1dc)
      [<c00097f4>] (do_one_initcall) from [<c0895e08>] (kernel_init_freeable+0x158/0x1f8)
      [<c0895e08>] (kernel_init_freeable) from [<c063ecac>] (kernel_init+0x8/0xe8)
      [<c063ecac>] (kernel_init) from [<c000f7d0>] (ret_from_fork+0x14/0x24)
      
      This patch replaces mutex_lock with mutex_lock_nested() and uses
      recursion depth to annotate each genpd->lock operation with separate
      lockdep subclass.
      Reported-by: NAnand Moon <linux.amoon@gmail.com>
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Tested-by: NAnand Moon <linux.amoon@gmail.com>
      Tested-by: NTobias Jakobi <tjakobi@math.uni-bielefeld.de>
      Acked-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0106ef51
  7. 08 1月, 2016 2 次提交
  8. 10 12月, 2015 2 次提交
  9. 04 12月, 2015 1 次提交
  10. 02 11月, 2015 2 次提交
  11. 28 10月, 2015 2 次提交
  12. 14 10月, 2015 1 次提交
  13. 13 10月, 2015 3 次提交
  14. 09 10月, 2015 1 次提交
  15. 27 9月, 2015 1 次提交
  16. 26 9月, 2015 2 次提交
  17. 05 9月, 2015 1 次提交
  18. 03 9月, 2015 1 次提交
  19. 29 8月, 2015 3 次提交
  20. 01 8月, 2015 2 次提交
    • J
      PM / Domains: Return -EPROBE_DEFER if we fail to init or turn-on domain · 311fa6ad
      Jon Hunter 提交于
      When a device is probed, the function dev_pm_domain_attach() is called
      to see if there is a power-domain that is associated with the device and
      needs to be turned on. If dev_pm_domain_attach() does not return
      -EPROBE_DEFER then the device will be probed.
      
      For devices using genpd, dev_pm_domain_attach() will call
      genpd_dev_pm_attach(). If genpd_dev_pm_attach() does not find a power
      domain associated with the device then it returns an error code not
      equal to -EPROBE_DEFER to allow the device to be probed. However, if
      genpd_dev_pm_attach() does find a power-domain that is associated with
      the device, then it does not return -EPROBE_DEFER on failure and hence
      the device will still be probed. Furthermore, genpd_dev_pm_attach() does
      not check the error code returned by pm_genpd_poweron() to see if the
      power-domain was turned on successfully.
      
      Fix this by checking the return code from pm_genpd_poweron() and
      returning -EPROBE_DEFER from genpd_dev_pm_attach on failure, if there
      is a power-domain associated with the device.
      Signed-off-by: NJon Hunter <jonathanh@nvidia.com>
      Acked-by: NUlf Hansson <ulf.hansson@linaro.org>
      Acked-by: NKevin Hilman <khilman@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      311fa6ad
    • U
      PM / Domains: Remove intermediate states from the power off sequence · ba2bbfbf
      Ulf Hansson 提交于
      Genpd's ->runtime_suspend() (assigned to pm_genpd_runtime_suspend())
      doesn't immediately walk the hierarchy of ->runtime_suspend() callbacks.
      Instead, pm_genpd_runtime_suspend() calls pm_genpd_poweroff() which
      postpones that until *all* the devices in the genpd are runtime suspended.
      
      When pm_genpd_poweroff() discovers that the last device in the genpd is
      about to be runtime suspended, it calls __pm_genpd_save_device() for *all*
      the devices in the genpd sequentially. Furthermore,
      __pm_genpd_save_device() invokes the ->start() callback, walks the
      hierarchy of the ->runtime_suspend() callbacks and invokes the ->stop()
      callback. This causes a "thundering herd" problem.
      
      Let's address this issue by having pm_genpd_runtime_suspend() immediately
      walk the hierarchy of the ->runtime_suspend() callbacks, instead of
      postponing that to the power off sequence via pm_genpd_poweroff(). If the
      selected ->runtime_suspend() callback doesn't return an error code, call
      pm_genpd_poweroff() to see if it's feasible to also power off the PM
      domain.
      
      Adopting this change enables us to simplify parts of the code in genpd,
      for example the locking mechanism. Additionally, it gives some positive
      side effects, as described below.
      
      i)
      One device's ->runtime_resume() latency is no longer affected by other
      devices' latencies in a genpd.
      
      The complexity genpd has to support the option to abort the power off
      sequence suffers from latency issues. More precisely, a device that is
      requested to be runtime resumed, may end up waiting for
      __pm_genpd_save_device() to complete its operations for *another* device.
      That's because pm_genpd_poweroff() can't confirm an abort request while it
      waits for __pm_genpd_save_device() to return.
      
      As this patch removes the intermediate states in pm_genpd_poweroff() while
      powering off the PM domain, we no longer need the ability to abort that
      sequence.
      
      ii)
      Make pm_runtime[_status]_suspended() reliable when used with genpd.
      
      Until the last device in a genpd becomes idle, pm_genpd_runtime_suspend()
      will return 0 without actually walking the hierarchy of the
      ->runtime_suspend() callbacks. However, by returning 0 the runtime PM core
      considers the device as runtime_suspended, so
      pm_runtime[_status]_suspended() will return true, even though the device
      isn't (yet) runtime suspended.
      
      After this patch, since pm_genpd_runtime_suspend() immediately walks the
      hierarchy of the ->runtime_suspend() callbacks,
      pm_runtime[_status]_suspended() will accurately reflect the status of the
      device.
      
      iii)
      Enable fine-grained PM through runtime PM callbacks in drivers/subsystems.
      
      There are currently cases were drivers/subsystems implements runtime PM
      callbacks to deploy fine-grained PM (e.g. gate clocks, move pinctrl to
      power-save state, etc.). While using the genpd, pm_genpd_runtime_suspend()
      postpones invoking these callbacks until *all* the devices in the genpd
      are runtime suspended. In essence, one runtime resumed device prevents
      fine-grained PM for other devices within the same genpd.
      
      After this patch, since pm_genpd_runtime_suspend() immediately walks the
      hierarchy of the ->runtime_suspend() callbacks, fine-grained PM is enabled
      throughout all the levels of runtime PM callbacks.
      
      iiii)
      Enable fine-grained PM for IRQ safe devices
      
      Per the definition for an IRQ safe device, its runtime PM callbacks must
      be able to execute in atomic context. In the path while genpd walks the
      hierarchy of the ->runtime_suspend() callbacks for the device, it uses a
      mutex. Therefore, genpd prevents that path to be executed for IRQ safe
      devices.
      
      As this patch changes pm_genpd_runtime_suspend() to immediately walk the
      hierarchy of the ->runtime_suspend() callbacks and without needing to use
      a mutex, fine-grained PM is enabled throughout all the levels of runtime
      PM callbacks for IRQ safe devices.
      
      Unfortunately this patch also comes with a drawback, as described in the
      summary below.
      
      Driver's/subsystem's runtime PM callbacks may be invoked even when the
      genpd hasn't actually powered off the PM domain, potentially introducing
      unnecessary latency.
      
      However, in most cases, saving/restoring register contexts for devices are
      typically fast operations or can be optimized in device specific ways
      (e.g. shadow copies of register contents in memory, device-specific checks
      to see if context has been lost before restoring context, etc.).
      
      Still, in some cases the driver/subsystem may suffer from latency if
      runtime PM is used in a very fine-grained manner (e.g. for each IO request
      or xfer). To prevent that extra overhead, the driver/subsystem may deploy
      the runtime PM autosuspend feature.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NKevin Hilman <khilman@linaro.org>
      Tested-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Tested-by: NLina Iyer <lina.iyer@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ba2bbfbf
  21. 07 7月, 2015 1 次提交
  22. 16 6月, 2015 1 次提交
    • G
      PM / Domains: Skip timings during syscore suspend/resume · a4630c61
      Geert Uytterhoeven 提交于
      The PM Domain code uses ktime_get() to perform various latency
      measurements.  However, if ktime_get() is called while timekeeping is
      suspended, the following warning is printed:
      
          WARNING: CPU: 0 PID: 1340 at kernel/time/timekeeping.c:576 ktime_get+0x3
      
      This happens when resuming the PM Domain that contains the clock events
      source, which calls pm_genpd_syscore_poweron(). Chain of operations is:
      
          timekeeping_resume()
          {
      	clockevents_resume()
      	    sh_cmt_clock_event_resume()
      		pm_genpd_syscore_poweron()
      		    pm_genpd_sync_poweron()
      			genpd_syscore_switch()
      			    genpd_power_on()
      				ktime_get(), but timekeeping_suspended == 1
      	...
      	timekeeping_suspended = 0;
          }
      
      Fix this by adding a "timed" parameter to genpd_power_{on,off}() and
      pm_genpd_sync_power{off,on}(), to indicate whether latency measurements
      are allowed.  This parameter is passed as false in
      genpd_syscore_switch() (i.e. during syscore suspend/resume), and true in
      all other cases.
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a4630c61
  23. 24 3月, 2015 1 次提交
  24. 23 3月, 2015 1 次提交