Skip to content

Commit

Permalink
PM / Domains: Do not execute device callbacks under locks
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rjwysocki committed Jul 11, 2011
1 parent b6c10c8 commit 17b75ec
Show file tree
Hide file tree
Showing 2 changed files with 185 additions and 74 deletions.
Loading

0 comments on commit 17b75ec

Please sign in to comment.