diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-02-24 13:25:14 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2017-02-27 15:07:38 +0100 |
commit | 6dbf5cea05a7098a69f294c96b6d76f08562cae5 (patch) | |
tree | b82971769598b518c88773bbb88874875a91aa62 /drivers | |
parent | 37efa4b41ffb31dcdfc3beb97d47992bb2a083e5 (diff) | |
download | linux-6dbf5cea05a7098a69f294c96b6d76f08562cae5.tar.gz linux-6dbf5cea05a7098a69f294c96b6d76f08562cae5.tar.bz2 linux-6dbf5cea05a7098a69f294c96b6d76f08562cae5.zip |
cpuidle: menu: Avoid taking spinlock for accessing QoS values
After commit 9908859acaa9 (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: 9908859acaa9 (cpuidle/menu: add per CPU PM QoS resume latency consideration)
Acked-by: Alex Shi <alex.shi@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/power/qos.c | 3 | ||||
-rw-r--r-- | drivers/cpuidle/governors/menu.c | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/drivers/base/power/qos.c b/drivers/base/power/qos.c index 58fcc758334e..73142d086240 100644 --- a/drivers/base/power/qos.c +++ b/drivers/base/power/qos.c @@ -108,8 +108,7 @@ s32 __dev_pm_qos_read_value(struct device *dev) { lockdep_assert_held(&dev->power.lock); - return IS_ERR_OR_NULL(dev->power.qos) ? - 0 : pm_qos_read_value(&dev->power.qos->resume_latency); + return dev_pm_qos_raw_read_value(dev); } /** diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 8d6d25c38c02..6d6f46e79d94 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -287,7 +287,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) unsigned int interactivity_req; unsigned int expected_interval; unsigned long nr_iowaiters, cpu_load; - int resume_latency = dev_pm_qos_read_value(device); + int resume_latency = dev_pm_qos_raw_read_value(device); if (data->needs_update) { menu_update(drv, dev); |