1. 24 10月, 2017 1 次提交
    • R
      PM / QoS: Fix device resume latency PM QoS · 0cc2b4e5
      Rafael J. Wysocki 提交于
      The special value of 0 for device resume latency PM QoS means
      "no restriction", but there are two problems with that.
      
      First, device resume latency PM QoS requests with 0 as the
      value are always put in front of requests with positive
      values in the priority lists used internally by the PM QoS
      framework, causing 0 to be chosen as an effective constraint
      value.  However, that 0 is then interpreted as "no restriction"
      effectively overriding the other requests with specific
      restrictions which is incorrect.
      
      Second, the users of device resume latency PM QoS have no
      way to specify that *any* resume latency at all should be
      avoided, which is an artificial limitation in general.
      
      To address these issues, modify device resume latency PM QoS to
      use S32_MAX as the "no constraint" value and 0 as the "no
      latency at all" one and rework its users (the cpuidle menu
      governor, the genpd QoS governor and the runtime PM framework)
      to follow these changes.
      
      Also add a special "n/a" value to the corresponding user space I/F
      to allow user space to indicate that it cannot accept any resume
      latencies at all for the given device.
      
      Fixes: 85dc0b8a (PM / QoS: Make it possible to expose PM QoS latency constraints)
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=197323Reported-by: NReinette Chatre <reinette.chatre@intel.com>
      Tested-by: NReinette Chatre <reinette.chatre@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NAlex Shi <alex.shi@linaro.org>
      Cc: All applicable <stable@vger.kernel.org>
      0cc2b4e5
  2. 18 9月, 2017 1 次提交
  3. 27 2月, 2017 1 次提交
    • R
      cpuidle: menu: Avoid taking spinlock for accessing QoS values · 6dbf5cea
      Rafael J. Wysocki 提交于
      After commit 9908859a (cpuidle/menu: add per CPU PM QoS resume
      latency consideration) the cpuidle menu governor calls
      dev_pm_qos_read_value() on CPU devices to read the current resume
      latency QoS constraint values for them.  That function takes a spinlock
      to prevent the device's power.qos pointer from becoming NULL during
      the access which is a problem for the RT patchset where spinlocks are
      converted into mutexes and the idle loop stops working.
      
      However, it is not even necessary for the menu governor to take
      that spinlock, because the power.qos pointer accessed under it
      cannot be modified during the access anyway.
      
      For this reason, introduce a "raw" routine for accessing device
      QoS resume latency constraints without locking and use it in the
      menu governor.
      
      Fixes: 9908859a (cpuidle/menu: add per CPU PM QoS resume latency consideration)
      Acked-by: NAlex Shi <alex.shi@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6dbf5cea
  4. 24 2月, 2017 1 次提交
  5. 18 2月, 2017 1 次提交
    • J
      PM / QoS: Fix memory leak on resume_latency.notifiers · e84b4a84
      John Keeping 提交于
      Since commit 2d984ad1 (PM / QoS: Introcuce latency tolerance device
      PM QoS type) we reassign "c" to point at qos->latency_tolerance before
      freeing c->notifiers, but the notifiers field of latency_tolerance is
      never used.
      
      Restore the original behaviour of freeing the notifiers pointer on
      qos->resume_latency, which is used, and fix the following kmemleak
      warning.
      
      unreferenced object 0xed9dba00 (size 64):
        comm "kworker/0:1", pid 36, jiffies 4294670128 (age 15202.983s)
        hex dump (first 32 bytes):
          00 00 00 00 04 ba 9d ed 04 ba 9d ed 00 00 00 00  ................
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<c06f6084>] kmemleak_alloc+0x74/0xb8
          [<c011c964>] kmem_cache_alloc_trace+0x170/0x25c
          [<c035f448>] dev_pm_qos_constraints_allocate+0x3c/0xe4
          [<c035f574>] __dev_pm_qos_add_request+0x84/0x1a0
          [<c035f6cc>] dev_pm_qos_add_request+0x3c/0x54
          [<c03c3fc4>] usb_hub_create_port_device+0x110/0x2b8
          [<c03b2a60>] hub_probe+0xadc/0xc80
          [<c03bb050>] usb_probe_interface+0x1b4/0x260
          [<c035773c>] driver_probe_device+0x198/0x40c
          [<c0357b14>] __device_attach_driver+0x8c/0x98
          [<c0355bbc>] bus_for_each_drv+0x8c/0x9c
          [<c0357494>] __device_attach+0x98/0x138
          [<c0357c64>] device_initial_probe+0x14/0x18
          [<c03569dc>] bus_probe_device+0x30/0x88
          [<c0354c54>] device_add+0x430/0x554
          [<c03b92d8>] usb_set_configuration+0x660/0x6fc
      
      Fixes: 2d984ad1 (PM / QoS: Introcuce latency tolerance device PM QoS type)
      Signed-off-by: NJohn Keeping <john@metanate.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      e84b4a84
  6. 01 12月, 2016 2 次提交
  7. 28 7月, 2015 1 次提交
  8. 24 1月, 2015 1 次提交
  9. 04 12月, 2014 1 次提交
  10. 11 2月, 2014 4 次提交
    • R
      PM / QoS: Add type to dev_pm_qos_add_ancestor_request() arguments · 71d821fd
      Rafael J. Wysocki 提交于
      Rework dev_pm_qos_add_ancestor_request() so that device PM QoS type
      is passed to it as the third argument and make it support the
      DEV_PM_QOS_LATENCY_TOLERANCE device PM QoS type (in addition to
      DEV_PM_QOS_RESUME_LATENCY).
      
      That will allow the drivers of devices without latency tolerance
      hardware support to use their ancestors having it as proxies for
      their latency tolerance requirements.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      71d821fd
    • R
      PM / QoS: Introcuce latency tolerance device PM QoS type · 2d984ad1
      Rafael J. Wysocki 提交于
      Add a new latency tolerance device PM QoS type to be use for
      specifying active state (RPM_ACTIVE) memory access (DMA) latency
      tolerance requirements for devices.  It may be used to prevent
      hardware from choosing overly aggressive energy-saving operation
      modes (causing too much latency to appear) for the whole platform.
      
      This feature reqiures hardware support, so it only will be
      available for devices having a new .set_latency_tolerance()
      callback in struct dev_pm_info populated, in which case the
      routine pointed to by it should implement whatever is necessary
      to transfer the effective requirement value to the hardware.
      
      Whenever the effective latency tolerance changes for the device,
      its .set_latency_tolerance() callback will be executed and the
      effective value will be passed to it.  If that value is negative,
      which means that the list of latency tolerance requirements for
      the device is empty, the callback is expected to switch the
      underlying hardware latency tolerance control mechanism to an
      autonomous mode if available.  If that value is PM_QOS_LATENCY_ANY,
      in turn, and the hardware supports a special "no requirement"
      setting, the callback is expected to use it.  That allows software
      to prevent the hardware from automatically updating the device's
      latency tolerance in response to its power state changes (e.g. during
      transitions from D3cold to D0), which generally may be done in the
      autonomous latency tolerance control mode.
      
      If .set_latency_tolerance() is present for the device, a new
      pm_qos_latency_tolerance_us attribute will be present in the
      devivce's power directory in sysfs.  Then, user space can use
      that attribute to specify its latency tolerance requirement for
      the device, if any.  Writing "any" to it means "no requirement, but
      do not let the hardware control latency tolerance" and writing
      "auto" to it allows the hardware to be switched to the autonomous
      mode if there are no other requirements from the kernel side in the
      device's list.
      
      This changeset includes a fix from Mika Westerberg.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      2d984ad1
    • R
      PM / QoS: Add no_constraints_value field to struct pm_qos_constraints · 327adaed
      Rafael J. Wysocki 提交于
      Add a new field, no_constraints_value, to struct pm_qos_constraints
      representing a list of PM QoS constraint requests to be returned by
      pm_qos_get_value() when that list of requests is empty.
      
      That field will be equal to default_value for all of the existing
      global PM QoS classes and for the resume latency device PM QoS type,
      but it will be different from default_value for the new latency
      tolerance device PM QoS type introduced by the next changeset.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      327adaed
    • R
      PM / QoS: Rename device resume latency QoS items · b02f6695
      Rafael J. Wysocki 提交于
      Rename symbols, variables, functions and structure fields related do
      the resume latency device PM QoS type so that it is clear where they
      belong (in particular, to avoid confusion with the latency tolerance
      device PM QoS type introduced by a subsequent changeset).
      
      Update the PM QoS documentation to better reflect its current state.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      b02f6695
  11. 24 6月, 2013 1 次提交
  12. 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
  13. 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
  14. 26 1月, 2013 1 次提交
  15. 06 1月, 2013 1 次提交
  16. 24 11月, 2012 2 次提交
  17. 11 11月, 2012 1 次提交
  18. 02 11月, 2012 2 次提交
  19. 31 10月, 2012 1 次提交
  20. 24 10月, 2012 1 次提交
    • R
      PM / QoS: Make it possible to expose PM QoS device flags to user space · e39473d0
      Rafael J. Wysocki 提交于
      Define two device PM QoS flags, PM_QOS_FLAG_NO_POWER_OFF
      and PM_QOS_FLAG_REMOTE_WAKEUP, and introduce routines
      dev_pm_qos_expose_flags() and dev_pm_qos_hide_flags() allowing the
      caller to expose those two flags to user space or to hide them
      from it, respectively.
      
      After the flags have been exposed, user space will see two
      additional sysfs attributes, pm_qos_no_power_off and
      pm_qos_remote_wakeup, under the device's /sys/devices/.../power/
      directory.  Then, writing 1 to one of them will update the
      PM QoS flags request owned by user space so that the corresponding
      flag is requested to be set.  In turn, writing 0 to one of them
      will cause the corresponding flag in the user space's request to
      be cleared (however, the owners of the other PM QoS flags requests
      for the same device may still request the flag to be set and it
      may be effectively set even if user space doesn't request that).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NJean Pihet <j-pihet@ti.com>
      Acked-by: Nmark gross <markgross@thegnar.org>
      e39473d0
  21. 23 10月, 2012 3 次提交
    • R
      PM / QoS: Introduce PM QoS device flags support · ae0fb4b7
      Rafael J. Wysocki 提交于
      Modify the device PM QoS core code to support PM QoS flags requests.
      
      First, add a new field of type struct pm_qos_flags called "flags"
      to struct dev_pm_qos for representing the list of PM QoS flags
      requests for the given device.  Accordingly, add a new "type" field
      to struct dev_pm_qos_request (along with an enum for representing
      request types) and a new member called "flr" to its data union for
      representig flags requests.
      
      Second, modify dev_pm_qos_add_request(), dev_pm_qos_update_request(),
      the internal routine apply_constraint() used by them and their
      existing callers to cover flags requests as well as latency
      requests.  In particular, dev_pm_qos_add_request() gets a new
      argument called "type" for specifying the type of a request to be
      added.
      
      Finally, introduce two routines, __dev_pm_qos_flags() and
      dev_pm_qos_flags(), allowing their callers to check which PM QoS
      flags have been requested for the given device (the caller is
      supposed to pass the mask of flags to check as the routine's
      second argument and examine its return value for the result).
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NJean Pihet <j-pihet@ti.com>
      Reviewed-by: Nmark gross <markgross@thegnar.org>
      ae0fb4b7
    • R
      PM / QoS: Prepare struct dev_pm_qos_request for more request types · 021c870b
      Rafael J. Wysocki 提交于
      The subsequent patches will use struct dev_pm_qos_request for
      representing both latency requests and flags requests.  To make that
      easier, put the node member of struct dev_pm_qos_request (under the
      name "pnode") into a union called "data" that will represent the
      request's  value and list node depending on its type.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NJean Pihet <j-pihet@ti.com>
      Reviewed-by: Nmark gross <markgross@thegnar.org>
      021c870b
    • R
      PM / QoS: Prepare device structure for adding more constraint types · 5f986c59
      Rafael J. Wysocki 提交于
      Currently struct dev_pm_info contains only one PM QoS constraints
      pointer reserved for latency requirements.  Since one more device
      constraints type (i.e. flags) will be necessary, introduce a new
      structure, struct dev_pm_qos, that eventually will contain all of
      the available device PM QoS constraints and replace the "constraints"
      pointer in struct dev_pm_info with a pointer to the new structure
      called "qos".
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NJean Pihet <j-pihet@ti.com>
      5f986c59
  22. 25 9月, 2012 1 次提交
  23. 19 9月, 2012 1 次提交
    • J
      PM QoS: Use spinlock in the per-device PM QoS constraints code · fc2fb3a0
      Jean Pihet 提交于
      The per-device PM QoS locking requires a spinlock to be used. The reasons
      are:
       - an alignement with the PM QoS core code, which is used by the per-device
         PM QoS code for the constraints lists management. The PM QoS core code
         uses spinlocks to protect the constraints lists,
       - some drivers need to use the per-device PM QoS functionality from
         interrupt context or spinlock protected context.
         An example of such a driver is the OMAP HSI (high-speed synchronous serial
         interface) driver which needs to control the IP block idle state
         depending on the FIFO empty state, from interrupt context.
      Reported-by: NDjamil Elaidi <d-elaidi@ti.com>
      Signed-off-by: NJean Pihet <j-pihet@ti.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      fc2fb3a0
  24. 19 7月, 2012 1 次提交
  25. 02 5月, 2012 1 次提交
    • R
      PM / QoS: Create device constraints objects on notifier registration · 23e0fc5a
      Rafael J. Wysocki 提交于
      The current behavior of dev_pm_qos_add_notifier() makes device PM QoS
      notifiers less than useful.  Namely, it silently returns success when
      called before any PM QoS constraints are added for the device, so the
      caller will assume that the notifier has been registered, but when
      someone actually adds some nontrivial constraints for the device
      eventually, the previous callers of dev_pm_qos_add_notifier()
      will not know about that and their notifier routines will not be
      executed (contrary to their expectations).
      
      To address this problem make dev_pm_qos_add_notifier() create the
      constraints object for the device if it is not present when the
      routine is called.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by : markgross <markgross@thegnar.org>
      23e0fc5a
  26. 14 3月, 2012 1 次提交
    • R
      PM / QoS: Make it possible to expose PM QoS latency constraints · 85dc0b8a
      Rafael J. Wysocki 提交于
      A runtime suspend of a device (e.g. an MMC controller) belonging to
      a power domain or, in a more complicated scenario, a runtime suspend
      of another device in the same power domain, may cause power to be
      removed from the entire domain.  In that case, the amount of time
      necessary to runtime-resume the given device (e.g. the MMC
      controller) is often substantially greater than the time needed to
      run its driver's runtime resume callback.  That may hurt performance
      in some situations, because user data may need to wait for the
      device to become operational, so we should make it possible to
      prevent that from happening.
      
      For this reason, introduce a new sysfs attribute for devices,
      power/pm_qos_resume_latency_us, allowing user space to specify the
      upper bound of the time necessary to bring the (runtime-suspended)
      device up after the resume of it has been requested.  However, make
      that attribute appear only for the devices whose drivers declare
      support for it by calling the (new) dev_pm_qos_expose_latency_limit()
      helper function with the appropriate initial value of the attribute.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      Reviewed-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      85dc0b8a
  27. 26 12月, 2011 1 次提交
    • R
      PM / QoS: Introduce dev_pm_qos_add_ancestor_request() · 40a5f8be
      Rafael J. Wysocki 提交于
      Some devices, like the I2C controller on SH7372, are not
      necessary for providing power to their children or forwarding
      wakeup signals (and generally interrupts) from them.  They are
      only needed by their children when there's some data to transfer,
      so they may be suspended for the majority of time and resumed
      on demand, when the children have data to send or receive.  For this
      purpose, however, their power.ignore_children flags have to be set,
      or the PM core wouldn't allow them to be suspended while their
      children were active.
      
      Unfortunately, in some situations it may take too much time to
      resume such devices so that they can assist their children in
      transferring data.  For example, if such a device belongs to a PM
      domain which goes to the "power off" state when that device is
      suspended, it may take too much time to restore power to the
      domain in response to the request from one of the device's
      children.  In that case, if the parent's resume time is critical,
      the domain should stay in the "power on" state, although it still may
      be desirable to power manage the parent itself (e.g. by manipulating
      its clock).
      
      In general, device PM QoS may be used to address this problem.
      Namely, if the device's children added PM QoS latency constraints
      for it, they would be able to prevent it from being put into an
      overly deep low-power state.  However, in some cases the devices
      needing to be serviced are not the immediate children of a
      "children-ignoring" device, but its grandchildren or even less
      direct descendants.  In those cases, the entity wanting to add a
      PM QoS request for a given device's ancestor that ignores its
      children will have to find it in the first place, so introduce a new
      helper function that may be used to achieve that.  This function,
      dev_pm_qos_add_ancestor_request(), will search for the first
      ancestor of the given device whose power.ignore_children flag is
      set and will add a device PM QoS latency request for that ancestor
      on behalf of the caller.  The request added this way may be removed
      with the help of dev_pm_qos_remove_request() in the future, like
      any other device PM QoS latency request.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      40a5f8be
  28. 02 12月, 2011 1 次提交
    • R
      PM / Runtime: Use device PM QoS constraints (v2) · 00dc9ad1
      Rafael J. Wysocki 提交于
      Make the runtime PM core use device PM QoS constraints to check if
      it is allowed to suspend a given device, so that an error code is
      returned if the device's own PM QoS constraint is negative or one of
      its children has already been suspended for too long.  If this is
      not the case, the maximum estimated time the device is allowed to be
      suspended, computed as the minimum of the device's PM QoS constraint
      and the PM QoS constraints of its children (reduced by the difference
      between the current time and their suspend times) is stored in a new
      device's PM field power.max_time_suspended_ns that can be used by
      the device's subsystem or PM domain to decide whether or not to put
      the device into lower-power (and presumably higher-latency) states
      later (if the constraint is 0, which means "no constraint", the
      power.max_time_suspended_ns is set to -1).
      
      Additionally, the time of execution of the subsystem-level
      .runtime_suspend() callback for the device is recorded in the new
      power.suspend_time field for later use by the device's subsystem or
      PM domain along with power.max_time_suspended_ns (it also is used
      by the core code when the device's parent is suspended).
      
      Introduce a new helper function,
      pm_runtime_update_max_time_suspended(), allowing subsystems and PM
      domains (or device drivers) to update the power.max_time_suspended_ns
      field, for example after changing the power state of a suspended
      device.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      00dc9ad1
  29. 10 11月, 2011 1 次提交
  30. 01 11月, 2011 1 次提交
  31. 05 10月, 2011 1 次提交
    • R
      PM / QoS: Add function dev_pm_qos_read_value() (v3) · 1a9a9152
      Rafael J. Wysocki 提交于
      To read the current PM QoS value for a given device we need to
      make sure that the device's power.constraints object won't be
      removed while we're doing that.  For this reason, put the
      operation under dev->power.lock and acquire the lock
      around the initialization and removal of power.constraints.
      
      Moreover, since we're using the value of power.constraints to
      determine whether or not the object is present, the
      power.constraints_state field isn't necessary any more and may be
      removed.  However, dev_pm_qos_add_request() needs to check if the
      device is being removed from the system before allocating a new
      PM QoS constraints object for it, so make it use the
      power.power_state field of struct device for this purpose.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      1a9a9152