]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commit
pmqos: Replace spinlock with mutex for pm_qos_lock
authorSai Gurrappadi <sgurrappadi@nvidia.com>
Tue, 1 Oct 2013 17:01:27 +0000 (10:01 -0700)
committerDiwakar Tundlam <dtundlam@nvidia.com>
Fri, 18 Oct 2013 20:59:20 +0000 (13:59 -0700)
commit0530e1769ba9991608e525bf24c0ea397116a563
treebb7b1290c95caa6a31057edb54955d96c9421be1
parent01c5b64105e4643e9dddc9e90be3ad6b4664500f
pmqos: Replace spinlock with mutex for pm_qos_lock

Using a spinlock (taken with irqsave) meant that pm_qos_lock couldn't be
used to synchronize on the notifiers in order to ensure proper order of
the notifications. This is needed in case where there might be two near
simultaneous pmqos client requests for a bound on the same constraint;
the notifiers in pm_qos_update_target for the two clients could
potentially engage in a race.

Example:

Assume two requests are made (A, B with A coming first) for max cpufreq
and these are the only requests currently available.

Current behavior can result in:

notify(max_cpu_freq, minof(A, B))
notify(max_cpu_freq, minof(LONG_MAX, A))

Expected behavior:

notify(max_cpu_freq, minof(LONG_MAX, A))
notify(max_cpu_freq, minof(A, B))

Most of the PM QoS and Dev PM QoS requester clients were reviewed and
none of them were found to be calling pm_qos_add/update/remove request
from interrupt or atomic context since those calls include the blocking
notifier call which cannot be done in atomic context.

Change-Id: I2fb43cc38da4c701e4872b937dd82cd38f1a1c1e
Signed-off-by: Sai Gurrappadi <sgurrappadi@nvidia.com>
Reviewed-on: http://git-master/r/299036
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Diwakar Tundlam <dtundlam@nvidia.com>
kernel/power/qos.c