1. 08 1月, 2016 2 次提交
  2. 02 1月, 2016 1 次提交
  3. 21 12月, 2015 1 次提交
  4. 04 12月, 2015 1 次提交
  5. 02 12月, 2015 1 次提交
  6. 30 11月, 2015 2 次提交
    • U
      PM / runtime: Re-init runtime PM states at probe error and driver unbind · 5de85b9d
      Ulf Hansson 提交于
      There are two common expectations among several subsystems/drivers that
      deploys runtime PM support, but which isn't met by the driver core.
      
      Expectation 1)
      At ->probe() the subsystem/driver expects the runtime PM status of the
      device to be RPM_SUSPENDED, which is the initial status being assigned at
      device registration.
      
      This expectation is especially common among some of those subsystems/
      drivers that manages devices with an attached PM domain, as those requires
      the ->runtime_resume() callback at the PM domain level to be invoked
      during ->probe().
      
      Moreover these subsystems/drivers entirely relies on runtime PM resources
      being managed at the PM domain level, thus don't implement their own set
      of runtime PM callbacks.
      
      These are two scenarios that suffers from this unmet expectation.
      
      i) A failed ->probe() sequence requests probe deferral:
      
      ->probe()
        ...
        pm_runtime_enable()
        pm_runtime_get_sync()
        ...
      
      err:
        pm_runtime_put()
        pm_runtime_disable()
        ...
      
      As there are no guarantees that such sequence turns the runtime PM status
      of the device into RPM_SUSPENDED, the re-trying ->probe() may start with
      the status in RPM_ACTIVE.
      
      In such case the runtime PM core won't invoke the ->runtime_resume()
      callback because of a pm_runtime_get_sync(), as it considers the device to
      be already runtime resumed.
      
      ii) A driver re-bind sequence:
      
      At driver unbind, the subsystem/driver's >remove() callback invokes a
      sequence of runtime PM APIs, to undo actions during ->probe() and to put
      the device into low power state.
      
      ->remove()
        ...
        pm_runtime_put()
        pm_runtime_disable()
        ...
      
      Similar as in the failing ->probe() case, this sequence don't guarantee
      the runtime PM status of the device to turn into RPM_SUSPENDED.
      
      Trying to re-bind the driver thus causes the same issue as when re-trying
      ->probe(), in the probe deferral scenario.
      
      Expectation 2)
      Drivers that invokes the pm_runtime_irq_safe() API during ->probe(),
      triggers the runtime PM core to increase the usage count for the device's
      parent and permanently make it runtime resumed.
      
      The usage count is only dropped at device removal, which also allows it to
      be runtime suspended again.
      
      A re-trying ->probe() repeats the call to pm_runtime_irq_safe() and thus
      once more triggers the usage count of the device's parent to be increased.
      
      This leads to not only an imbalance issue of the usage count of the
      device's parent, but also to keep it runtime resumed permanently even if
      ->probe() fails.
      
      To address these issues, let's change the policy of the driver core to
      meet these expectations. More precisely, at ->probe() failures and driver
      unbind, restore the initial states of runtime PM.
      
      Although to still allow subsystem's to control PM for devices that doesn't
      ->probe() successfully, don't restore the initial states unless runtime PM
      is disabled.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NKevin Hilman <khilman@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      5de85b9d
    • S
      PM / sleep: prohibit devices probing during suspend/hibernation · 013c074f
      Strashko, Grygorii 提交于
      It is unsafe [1] if probing of devices will happen during suspend or
      hibernation and system behavior will be unpredictable in this case.
      So, let's prohibit device's probing in dpm_prepare() and defer their
      probing instead. The normal behavior will be restored in
      dpm_complete().
      
      This patch introduces new DD core APIs:
       device_block_probing()
         It will disable probing of devices and defer their probes instead.
       device_unblock_probing()
         It will restore normal behavior and trigger re-probing of deferred
         devices.
      
      [1] https://lkml.org/lkml/2015/9/11/554Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      013c074f
  7. 17 11月, 2015 1 次提交
  8. 07 11月, 2015 4 次提交
    • V
      PM / OPP: Add opp_rcu_lockdep_assert() to _find_device_opp() · 0597e818
      Viresh Kumar 提交于
      _find_device_opp() should be called with rcu-read lock or
      dev_opp_list_lock held. Add the opp_rcu_lockdep_assert() check to make
      sure caller have taken appropriate locks.
      
      Fix comment over the routine as well.
      Suggested-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0597e818
    • V
      PM / OPP: Hold dev_opp_list_lock for writers · 4a3a1353
      Viresh Kumar 提交于
      Writers need to update OPP device and their list with dev_opp_list_lock
      mutex held, which was missed at few places. Fix it.
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Cc: 4.3 <stable@vger.kernel.org> # 4.3
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      4a3a1353
    • V
      PM / OPP: Protect updates to list_dev with mutex · 87b4115d
      Viresh Kumar 提交于
      dev_opp_list_lock is used everywhere to protect device and OPP lists,
      but dev_pm_opp_set_sharing_cpus() is missed somehow. And instead we used
      rcu-lock, which wouldn't help here as we are adding a new list_dev.
      
      This also fixes a problem where we have called kzalloc(..., GFP_KERNEL)
      from within rcu-lock, which isn't allowed as kzalloc can sleep when
      called with GFP_KERNEL.
      
      With CONFIG_DEBUG_ATOMIC_SLEEP set, we get following lockdep-splat:
      
      include/linux/rcupdate.h:578 Illegal context switch in RCU read-side critical section!
      
      other info that might help us debug this:
      
      rcu_scheduler_active = 1, debug_locks = 0
      5 locks held by swapper/0/1:
       #0:  (&dev->mutex){......}, at: [<c02f68f4>] __driver_attach+0x48/0x98
       #1:  (&dev->mutex){......}, at: [<c02f6904>] __driver_attach+0x58/0x98
       #2:  (cpu_hotplug.lock){++++++}, at: [<c00249d0>] get_online_cpus+0x40/0xb0
       #3:  (subsys mutex#5){+.+.+.}, at: [<c02f4f8c>] subsys_interface_register+0x44/0xdc
       #4:  (rcu_read_lock){......}, at: [<c0305c80>] dev_pm_opp_set_sharing_cpus+0x0/0x1e4
      
      stack backtrace:
      CPU: 1 PID: 1 Comm: swapper/0 Tainted: G        W       4.3.0-rc7-00047-g81f5932958a8 #59
      Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      [<c0016874>] (unwind_backtrace) from [<c001355c>] (show_stack+0x10/0x14)
      [<c001355c>] (show_stack) from [<c022553c>] (dump_stack+0x94/0xbc)
      [<c022553c>] (dump_stack) from [<c004904c>] (___might_sleep+0x24c/0x298)
      [<c004904c>] (___might_sleep) from [<c00f07e4>] (kmem_cache_alloc+0xe8/0x164)
      [<c00f07e4>] (kmem_cache_alloc) from [<c0305354>] (_add_list_dev+0x30/0x58)
      [<c0305354>] (_add_list_dev) from [<c0305d50>] (dev_pm_opp_set_sharing_cpus+0xd0/0x1e4)
      [<c0305d50>] (dev_pm_opp_set_sharing_cpus) from [<c040eda4>] (cpufreq_init+0x4cc/0x62c)
      [<c040eda4>] (cpufreq_init) from [<c040a964>] (cpufreq_online+0xbc/0x73c)
      [<c040a964>] (cpufreq_online) from [<c02f4fe0>] (subsys_interface_register+0x98/0xdc)
      [<c02f4fe0>] (subsys_interface_register) from [<c040a640>] (cpufreq_register_driver+0x110/0x17c)
      [<c040a640>] (cpufreq_register_driver) from [<c040ef64>] (dt_cpufreq_probe+0x60/0x8c)
      [<c040ef64>] (dt_cpufreq_probe) from [<c02f8084>] (platform_drv_probe+0x44/0xa4)
      [<c02f8084>] (platform_drv_probe) from [<c02f67c0>] (driver_probe_device+0x208/0x2f4)
      [<c02f67c0>] (driver_probe_device) from [<c02f6940>] (__driver_attach+0x94/0x98)
      [<c02f6940>] (__driver_attach) from [<c02f4c1c>] (bus_for_each_dev+0x68/0x9c)
      Reported-by: NMichael Turquette <mturquette@baylibre.com>
      Reviewed-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Cc: 4.3 <stable@vger.kernel.org> # 4.3
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      87b4115d
    • V
      PM / OPP: Propagate error properly from dev_pm_opp_set_sharing_cpus() · 1794ec1f
      Viresh Kumar 提交于
      We are returning 0 even in case of errors, fix it.
      
      Fixes: 8d4d4e98 ("PM / OPP: Add helpers for initializing CPU OPPs")
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Cc: 4.3 <stable@vger.kernel.org> # 4.3
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      1794ec1f
  9. 02 11月, 2015 5 次提交
  10. 31 10月, 2015 1 次提交
    • J
      PM / OPP: get the voltage for all OPPs · d6d00742
      Javi Merino 提交于
      The OPP library is now used for power models to calculate the power
      that a device would consume at a specific OPP.  To do that, we use a
      simple power model which takes frequency and voltage as inputs.  We get
      the voltage and frequency from the OPP library.
      
      The devfreq cooling device for the thermal framework controls
      temperature by disabling OPPs.  The power model needs to calculate the
      power that would be consumed if we reenabled the OPP.  Therefore, let
      dev_pm_opp_get_voltage() work for disabled OPPs.
      
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Acked-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NJavi Merino <javi.merino@arm.com>
      Signed-off-by: NEduardo Valentin <edubezval@gmail.com>
      d6d00742
  11. 28 10月, 2015 3 次提交
    • U
      PM / Domains: Merge measurements for PM QoS device latencies · 2b1d88cd
      Ulf Hansson 提交于
      Measure latency does by itself contribute to an increased latency, thus we
      should avoid it when it isn't needed.
      
      By merging the latency measurements for the ->save_state() and the
      ->stop() callbacks, we get one measurement instead of two and we get one
      value to store instead of two. Let's also apply the likewise change for
      the ->start() and ->restore_state() callbacks.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NLina Iyer <lina.iyer@linaro.org>
      Acked-by: NKevin Hilman <khilman@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2b1d88cd
    • U
      PM / Domains: Don't measure ->start|stop() latency in system PM callbacks · 51cda844
      Ulf Hansson 提交于
      Measure latency does by itself contribute to an increased latency, thus we
      should avoid it when it isn't needed.
      
      Genpd measures latencies in the system PM phase for the ->start|stop()
      callbacks and is thus affecting the system PM suspend/resume time.
      Moreover these latencies are validated only at runtime PM suspend/resume.
      
      To this reasoning, let's decide to leave these measurements out of the
      system PM phase. There should be plenty of occasions during runtime PM to
      perform these measurements anyway.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Reviewed-by: NLina Iyer <lina.iyer@linaro.org>
      Acked-by: NKevin Hilman <khilman@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      51cda844
    • G
      PM / clk: Fix broken build due to non-matching code and header #ifdefs · a6175616
      Geert Uytterhoeven 提交于
      If an architecture's main Kconfig file doesn't include
      kernel/power/Kconfig, but CONFIG_PM=y and HAVE_CLK=y (e.g. m68knommu
      allmodconfig):
      
          drivers/base/power/clock_ops.c: In function ‘__pm_clk_add’:
          drivers/base/power/clock_ops.c:106: error: ‘struct pm_subsys_data’ has no member named ‘clock_list’
          drivers/base/power/clock_ops.c: At top level:
          drivers/base/power/clock_ops.c:120: error: redefinition of ‘pm_clk_add’
          include/linux/pm_clock.h:64: error: previous definition of ‘pm_clk_add’ was here
          drivers/base/power/clock_ops.c:135: error: redefinition of ‘pm_clk_add_clk’
          include/linux/pm_clock.h:69: error: previous definition of ‘pm_clk_add_clk’ was here
          drivers/base/power/clock_ops.c:171: error: redefinition of ‘pm_clk_remove’
          include/linux/pm_clock.h:73: error: previous definition of ‘pm_clk_remove’ was here
          drivers/base/power/clock_ops.c: In function ‘pm_clk_remove’:
          drivers/base/power/clock_ops.c:180: error: ‘struct pm_subsys_data’ has no member named ‘clock_list’
          drivers/base/power/clock_ops.c:180: error: ‘struct pm_subsys_data’ has no member named ‘clock_list’
          drivers/base/power/clock_ops.c: At top level:
          drivers/base/power/clock_ops.c:207: error: redefinition of ‘pm_clk_init’
          include/linux/pm_clock.h:54: error: previous definition of ‘pm_clk_init’ was here
          drivers/base/power/clock_ops.c: In function ‘pm_clk_init’:
          drivers/base/power/clock_ops.c:210: error: ‘struct pm_subsys_data’ has no member named ‘clock_list’
          drivers/base/power/clock_ops.c: At top level:
          drivers/base/power/clock_ops.c:221: error: redefinition of ‘pm_clk_create’
          include/linux/pm_clock.h:57: error: previous definition of ‘pm_clk_create’ was here
          drivers/base/power/clock_ops.c:234: error: redefinition of ‘pm_clk_destroy’
          include/linux/pm_clock.h:61: error: previous definition of ‘pm_clk_destroy’ was here
          drivers/base/power/clock_ops.c: In function ‘pm_clk_destroy’:
          drivers/base/power/clock_ops.c:246: error: ‘struct pm_subsys_data’ has no member named ‘clock_list’
          drivers/base/power/clock_ops.c:246: error: ‘struct pm_subsys_data’ has no member named ‘clock_list’
          drivers/base/power/clock_ops.c: At top level:
          drivers/base/power/clock_ops.c:263: error: expected identifier or ‘(’ before ‘void’
          drivers/base/power/clock_ops.c:263: error: expected ‘)’ before numeric constant
          drivers/base/power/clock_ops.c:293: error: expected identifier or ‘(’ before ‘void’
          drivers/base/power/clock_ops.c:293: error: expected ‘)’ before numeric constant
          drivers/base/power/clock_ops.c: In function ‘pm_clk_runtime_suspend’:
          drivers/base/power/clock_ops.c:384: error: called object ‘0u’ is not a function
          drivers/base/power/clock_ops.c: In function ‘pm_clk_runtime_resume’:
          drivers/base/power/clock_ops.c:400: error: called object ‘0u’ is not a function
      
      This happens because:
        - drivers/base/power/clock_ops.c depends on CONFIG_HAVE_CLK,
        - the failing code inside clock_ops.c additionally depends on
          CONFIG_PM,
        - the forward declarations and other definitions in <linux/pm_clock.h>
          depend on CONFIG_PM_CLK,
        - CONFIG_PM_CLK is defined as PM && HAVE_CLK in kernel/power/Kconfig,
          but it is not included on all architectures.
      
      Fix this by protecting the failing code inside clock_ops.c by
      CONFIG_PM_CLK instead of CONFIG_PM, so it matches <linux/pm_clock.h>.
      Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a6175616
  12. 14 10月, 2015 4 次提交
    • U
      PM / Domains: Fix validation of latency constraints in genpd governor · a98f1b78
      Ulf Hansson 提交于
      Commit ba2bbfbf (PM / Domains: Remove intermediate states from the
      power off sequence) changed the power off sequence in genpd. That also
      required some updates regarding the validation of latency constraints in
      the genpd governor. Unfortunate that wasn't covered, so let's fix this.
      
      From a runtime PM and latency point of view, we need to consider the worst
      case scenario while validating latency constraints. That's typically when
      a call to pm_runtime_get_sync() needs to wait for a ongoing runtime
      suspend operation to be carried out, as it then also needs to wait for the
      device to be runtime resumed again.
      
      The above mentioned commit made the genpd governor's ->stop_ok() callback
      responsible of validating genpd's device's runtime suspend/resume latency.
      In other words, the constraint needs to be validated towards the relevant
      latencies present in genpd's ->runtime_suspend|resume() callbacks.
      
      Earlier, that included latencies from the ->stop|start() callbacks, but as
      ->save|restore_state() are now also being invoked from genpd's
      ->runtime_suspend|resume() and to comply with the worst case scenario,
      let's take also those latencies into account.
      
      Fixes: ba2bbfbf (PM / Domains: Remove intermediate states from the power off sequence)
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a98f1b78
    • U
      PM / Domains: Rename *pm_genpd_poweron|poweroff() · 7420aa4f
      Ulf Hansson 提交于
      This is another step to get consistent names of functions in genpd. Let's
      rename the internal *pm_genpd_poweron|poweroff() into
      *genpd_poweron|poweroff().
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      7420aa4f
    • R
      PM / PCI / ACPI: Kick devices that might have been reset by firmware · 58a1fbbb
      Rafael J. Wysocki 提交于
      There is a concern that if the platform firmware was involved in
      the system resume that's being completed,  some devices might have
      been reset by it and if those devices had the power.direct_complete
      flag set during the preceding suspend transition, they may stay
      in a reset-power-on state indefinitely (until they are runtime-resumed
      and then suspended again).  That may not be a big deal from the
      individual device's perspective, but if the system is an SoC, it may
      be prevented from entering deep SoC-wide low-power states on idle
      because of that.
      
      The devices that are most likely to be affected by this issue are
      PCI devices and ACPI-enumerated devices using the general ACPI PM
      domain, so to prevent it from happening for those devices, force a
      runtime resume for them if they have their power.direct_complete
      flags set and the platform firmware was involved in the resume
      transition currently in progress.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      58a1fbbb
    • R
      PM / sleep: Drop pm_request_idle() from pm_generic_complete() · c2df86ea
      Rafael J. Wysocki 提交于
      The pm_request_idle() in pm_generic_complete() is pointless as it is
      called with the runtime PM usage counter different from zero (bumped
      up by the core during the prepare phase of system suspend) and the
      core calls pm_runtime_put() for all devices after executing their
      complete callbacks, so drop it.
      
      This allows the PCI PM layer to use pm_generic_complete() too.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      c2df86ea
  13. 13 10月, 2015 3 次提交
  14. 10 10月, 2015 1 次提交
  15. 09 10月, 2015 1 次提交
  16. 06 10月, 2015 1 次提交
    • S
      PM / clk: Do not __clk_get passed in clock-references · 772b0508
      Stephen Boyd 提交于
      Clock references are on a per-user basis now, so they are not supposed
      to be refcounted by itself anymore. Therefore multiple cascaded get and
      put calls will fail.
      
      When a clock reference gets passed into pm_clk_add_clk we can assume
      that the pm clock handling will take control of the clock reference,
      so after this functions returns the caller should've given up control
      of that handle.
      
      So remove the additional call to __clk_get() in __pm_clk_add().
      
      The only current user of pm_clk_add_clk is drivers/clk/shmobile/clk-mstp.c
      which already follows this paradigm by only getting the clock but not
      puting it after passing the reference into pm_clk_add_clk.
      
      In the error case the caller is expected to clean up the clock, as it
      may very well try to do something different if pm_clk_add_clk() fails.
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      [add commit-message]
      Signed-off-by: NHeiko Stuebner <heiko@sntech.de>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      772b0508
  17. 27 9月, 2015 1 次提交
  18. 26 9月, 2015 3 次提交
  19. 25 9月, 2015 2 次提交
  20. 16 9月, 2015 1 次提交
  21. 15 9月, 2015 1 次提交