linux/drivers/base/power
Rafael J. Wysocki 32bdfac546 PM: Do not hold dpm_list_mtx while disabling/enabling nonboot CPUs
We shouldn't hold dpm_list_mtx while executing
[disable|enable]_nonboot_cpus(), because theoretically this may lead
to a deadlock as shown by the following example (provided by Johannes
Berg):

CPU 3       CPU 2                     CPU 1
                                      suspend/hibernate
            something:
            rtnl_lock()               device_pm_lock()
                                       -> mutex_lock(&dpm_list_mtx)

            mutex_lock(&dpm_list_mtx)

linkwatch_work
 -> rtnl_lock()
                                      disable_nonboot_cpus()
                                       -> flush CPU 3 workqueue

Fortunately, device drivers are supposed to stop any activities that
might lead to the registration of new device objects way before
disable_nonboot_cpus() is called, so it shouldn't be necessary to
hold dpm_list_mtx over the entire late part of device suspend and
early part of device resume.

Thus, during the late suspend and the early resume of devices acquire
dpm_list_mtx only when dpm_list is going to be traversed and release
it right after that.

This patch is reported to fix the regressions tracked as
http://bugzilla.kernel.org/show_bug.cgi?id=13245.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Miles Lane <miles.lane@gmail.com>
Tested-by: Ming Lei <tom.leiming@gmail.com>
2009-05-24 21:15:07 +02:00
..
Makefile PM: Make PM_TRACE more architecture independent 2008-02-01 18:30:54 -05:00
main.c PM: Do not hold dpm_list_mtx while disabling/enabling nonboot CPUs 2009-05-24 21:15:07 +02:00
power.h Driver core: Fix device_move() vs. dpm list ordering, v2 2009-03-24 16:38:26 -07:00
sysfs.c PCI ACPI: Rework PCI handling of wake-up 2008-07-07 16:26:28 -07:00
trace.c driver core: struct device - replace bus_id with dev_name(), dev_set_name() 2009-01-06 10:44:31 -08:00