]> git.karo-electronics.de Git - karo-tx-linux.git/commit
PM / Domains: Do not execute device callbacks under locks
authorRafael J. Wysocki <rjw@sisk.pl>
Mon, 11 Jul 2011 22:39:29 +0000 (00:39 +0200)
committerRafael J. Wysocki <rjw@sisk.pl>
Mon, 11 Jul 2011 22:39:29 +0000 (00:39 +0200)
commit17b75eca7683d4942f4d8d00563fd15f37c39589
tree539ee88f2c4008eec206ca98cec54263deeae708
parentb6c10c84665912985d0bf9b6ae8ce19fc4298d9f
PM / Domains: Do not execute device callbacks under locks

Currently, the .start_device() and .stop_device() callbacks from
struct generic_pm_domain() as well as the device drivers' runtime PM
callbacks used by the generic PM domains code are executed under
the generic PM domain lock.  This, unfortunately, is prone to
deadlocks, for example if a device and its parent are boths members
of the same PM domain.  For this reason, it would be better if the
PM domains code didn't execute device callbacks under the lock.

Rework the locking in the generic PM domains code so that the lock
is dropped for the execution of device callbacks.  To this end,
introduce PM domains states reflecting the current status of a PM
domain and such that the PM domain lock cannot be acquired if the
status is GPD_STATE_BUSY.  Make threads attempting to acquire a PM
domain's lock wait until the status changes to either
GPD_STATE_ACTIVE or GPD_STATE_POWER_OFF.

This change by itself doesn't fix the deadlock problem mentioned
above, but the mechanism introduced by it will be used for for this
purpose by a subsequent patch.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
drivers/base/power/domain.c
include/linux/pm_domain.h