1. 09 4月, 2021 1 次提交
  2. 03 11月, 2020 2 次提交
  3. 23 10月, 2020 1 次提交
  4. 21 10月, 2020 1 次提交
  5. 16 10月, 2020 3 次提交
  6. 03 10月, 2020 2 次提交
  7. 02 10月, 2020 4 次提交
  8. 25 9月, 2020 1 次提交
    • X
      PM: runtime: Remove link state checks in rpm_get/put_supplier() · d12544fb
      Xiang Chen 提交于
      To support runtime PM for hisi SAS driver (the driver is in directory
      drivers/scsi/hisi_sas), we add device link between scsi_device->sdev_gendev
      (consumer device) and hisi_hba->dev(supplier device) with flags
      DL_FLAG_PM_RUNTIME | DL_FLAG_RPM_ACTIVE.
      
      After runtime suspended consumers and supplier, unload the dirver which
      causes a hung.
      
      We found that it called function device_release_driver_internal() to
      release the supplier device (hisi_hba->dev), as the device link was
      busy, it set the device link state to DL_STATE_SUPPLIER_UNBIND, and
      then it called device_release_driver_internal() to release the consumer
      device (scsi_device->sdev_gendev).
      
      Then it would try to call pm_runtime_get_sync() to resume the consumer
      device, but because consumer-supplier relation existed, it would try
      to resume the supplier first, but as the link state was already
      DL_STATE_SUPPLIER_UNBIND, so it skipped resuming the supplier and only
      resumed the consumer which hanged (it sends IOs to resume scsi_device
      while the SAS controller is suspended).
      
      Simple flow is as follows:
      
      device_release_driver_internal -> (supplier device)
          if device_links_busy ->
      	device_links_unbind_consumers ->
      	    ...
      	    WRITE_ONCE(link->status, DL_STATE_SUPPLIER_UNBIND)
      	    device_release_driver_internal (consumer device)
          pm_runtime_get_sync -> (consumer device)
      	...
      	__rpm_callback ->
      	    rpm_get_suppliers ->
      		if link->state == DL_STATE_SUPPLIER_UNBIND -> skip the action of resuming the supplier
      		...
          pm_runtime_clean_up_links
          ...
      
      Correct suspend/resume ordering between a supplier device and its consumer
      devices (resume the supplier device before resuming consumer devices, and
      suspend consumer devices before suspending the supplier device) should be
      guaranteed by runtime PM, but the state checks in rpm_get_supplier() and
      rpm_put_supplier() break this rule, so remove them.
      Signed-off-by: NXiang Chen <chenxiang66@hisilicon.com>
      [ rjw: Subject and changelog edits ]
      Cc: All applicable <stable@vger.kernel.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      d12544fb
  9. 25 8月, 2020 2 次提交
    • R
      PM: sleep: core: Fix the handling of pending runtime resume requests · e3eb6e8f
      Rafael J. Wysocki 提交于
      It has been reported that system-wide suspend may be aborted in the
      absence of any wakeup events due to unforseen interactions of it with
      the runtume PM framework.
      
      One failing scenario is when there are multiple devices sharing an
      ACPI power resource and runtime-resume needs to be carried out for
      one of them during system-wide suspend (for example, because it needs
      to be reconfigured before the whole system goes to sleep).  In that
      case, the runtime-resume of that device involves turning the ACPI
      power resource "on" which in turn causes runtime-resume requests
      to be queued up for all of the other devices sharing it.  Those
      requests go to the runtime PM workqueue which is frozen during
      system-wide suspend, so they are not actually taken care of until
      the resume of the whole system, but the pm_runtime_barrier()
      call in __device_suspend() sees them and triggers system wakeup
      events for them which then cause the system-wide suspend to be
      aborted if wakeup source objects are in active use.
      
      Of course, the logic that leads to triggering those wakeup events is
      questionable in the first place, because clearly there are cases in
      which a pending runtime resume request for a device is not connected
      to any real wakeup events in any way (like the one above).  Moreover,
      it is racy, because the device may be resuming already by the time
      the pm_runtime_barrier() runs and so if the driver doesn't take care
      of signaling the wakeup event as appropriate, it will be lost.
      However, if the driver does take care of that, the extra
      pm_wakeup_event() call in the core is redundant.
      
      Accordingly, drop the conditional pm_wakeup_event() call fron
      __device_suspend() and make the latter call pm_runtime_barrier()
      alone.  Also modify the comment next to that call to reflect the new
      code and extend it to mention the need to avoid unwanted interactions
      between runtime PM and system-wide device suspend callbacks.
      
      Fixes: 1e2ef05b ("PM: Limit race conditions between runtime PM and system sleep (v2)")
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NUtkarsh H Patel <utkarsh.h.patel@intel.com>
      Tested-by: NUtkarsh H Patel <utkarsh.h.patel@intel.com>
      Tested-by: NPengfei Xu <pengfei.xu@intel.com>
      Cc: All applicable <stable@vger.kernel.org>
      e3eb6e8f
    • S
      opp: Allow dev_pm_opp_get_opp_table() to return -EPROBE_DEFER · dd461cd9
      Stephan Gerhold 提交于
      The OPP core manages various resources, e.g. clocks or interconnect paths.
      These resources are looked up when the OPP table is allocated once
      dev_pm_opp_get_opp_table() is called the first time (either directly
      or indirectly through one of the many helper functions).
      
      At this point, the resources may not be available yet, i.e. looking them
      up will result in -EPROBE_DEFER. Unfortunately, dev_pm_opp_get_opp_table()
      is currently unable to propagate this error code since it only returns
      the allocated OPP table or NULL.
      
      This means that all consumers of the OPP core are required to make sure
      that all necessary resources are available. Usually this happens by
      requesting them, checking the result and releasing them immediately after.
      
      For example, we have added "dev_pm_opp_of_find_icc_paths(dev, NULL)" to
      several drivers now just to make sure the interconnect providers are
      ready before the OPP table is allocated. If this call is missing,
      the OPP core will only warn about this and then attempt to continue
      without interconnect. This will eventually fail horribly, e.g.:
      
          cpu cpu0: _allocate_opp_table: Error finding interconnect paths: -517
          ... later ...
          of: _read_bw: Mismatch between opp-peak-kBps and paths (1 0)
          cpu cpu0: _opp_add_static_v2: opp key field not found
          cpu cpu0: _of_add_opp_table_v2: Failed to add OPP, -22
      
      This example happens when trying to use interconnects for a CPU OPP
      table together with qcom-cpufreq-nvmem.c. qcom-cpufreq-nvmem calls
      dev_pm_opp_set_supported_hw(), which ends up allocating the OPP table
      early. To fix the problem with the current approach we would need to add
      yet another call to dev_pm_opp_of_find_icc_paths(dev, NULL).
      But actually qcom-cpufreq-nvmem.c has nothing to do with interconnects...
      
      This commit attempts to make this more robust by allowing
      dev_pm_opp_get_opp_table() to return an error pointer. Fixing all
      the usages is trivial because the function is usually used indirectly
      through another helper (e.g. dev_pm_opp_set_supported_hw() above).
      These other helpers already return an error pointer.
      
      The example above then works correctly because set_supported_hw() will
      return -EPROBE_DEFER, and qcom-cpufreq-nvmem.c already propagates that
      error. It should also be possible to remove the remaining usages of
      "dev_pm_opp_of_find_icc_paths(dev, NULL)" from other drivers as well.
      
      Note that this commit currently only handles -EPROBE_DEFER for the
      clock/interconnects within _allocate_opp_table(). Other errors are just
      ignored as before. Eventually those should be propagated as well.
      Signed-off-by: NStephan Gerhold <stephan@gerhold.net>
      Acked-by: NKrzysztof Kozlowski <krzk@kernel.org>
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      [ Viresh: skip checking return value of dev_pm_opp_get_opp_table() for
      	  EPROBE_DEFER in domain.c, fix NULL return value and reorder
      	  code a bit in core.c, and update exynos-asv.c ]
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      dd461cd9
  10. 04 8月, 2020 1 次提交
  11. 15 7月, 2020 1 次提交
  12. 09 7月, 2020 1 次提交
  13. 23 6月, 2020 1 次提交
  14. 10 6月, 2020 2 次提交
  15. 30 5月, 2020 1 次提交
  16. 25 5月, 2020 1 次提交
  17. 25 4月, 2020 6 次提交
  18. 22 4月, 2020 1 次提交
  19. 20 4月, 2020 2 次提交
    • R
      PM: sleep: core: Fold functions into their callers · 30205377
      Rafael J. Wysocki 提交于
      Fold four functions in the PM core that each have only one caller
      now into their callers.
      
      No intentional functional impact.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      30205377
    • R
      PM: sleep: core: Simplify the SMART_SUSPEND flag handling · 107d47b2
      Rafael J. Wysocki 提交于
      The code to handle the SMART_SUSPEND driver PM flag is hard to follow
      and somewhat inconsistent with respect to devices without middle-layer
      (subsystem) callbacks.
      
      Namely, for those devices the core takes the role of a middle layer
      in providing the expected ordering of execution of callbacks (under
      the assumption that the drivers setting SMART_SUSPEND can reuse their
      PM-runtime callbacks directly for system-wide suspend).  To that end,
      it prevents driver ->suspend_late and ->suspend_noirq callbacks from
      being executed for devices that are still runtime-suspended in
      __device_suspend_late(), because running the same callback funtion
      that was previously run by PM-runtime for them may be invalid.
      
      However, it does that only for devices without any middle-layer
      callbacks for the late/noirq/early suspend/resume phases even
      though it would be simpler and more consistent to skip the
      driver-lavel callbacks for all devices with SMART_SUSPEND set
      that are runtime-suspended in __device_suspend_late().
      
      Simplify the code in accordance with the above observation.
      Suggested-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      107d47b2
  20. 01 4月, 2020 1 次提交
  21. 25 3月, 2020 1 次提交
  22. 19 3月, 2020 1 次提交
  23. 18 3月, 2020 1 次提交
  24. 14 3月, 2020 1 次提交
  25. 04 3月, 2020 1 次提交
    • M
      PM: sleep: wakeup: Use built-in RCU list checking · 2591e7b1
      Madhuparna Bhowmik 提交于
      Pass cond argument to list_for_each_entry_rcu() to fix the
      following false positive lockdep warning and other uses of
      list_for_each_entry_rcu() in wakeup.c.
      (CONFIG_PROVE_RCU_LIST = y)
      
      [  331.934648] =============================
      [  331.934650] WARNING: suspicious RCU usage
      [  331.934653] 5.6.0-rc1+ #5 Not tainted
      [  331.934655] -----------------------------
      [  331.934657] drivers/base/power/wakeup.c:408 RCU-list traversed in non-reader section!!
      
      [  333.025156] =============================
      [  333.025161] WARNING: suspicious RCU usage
      [  333.025168] 5.6.0-rc1+ #5 Not tainted
      [  333.025173] -----------------------------
      [  333.025180] drivers/base/power/wakeup.c:424 RCU-list traversed in non-reader section!!
      Signed-off-by: NMadhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2591e7b1