linux-hardened/kernel/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
..
console.c PM: Wait for console in resume 2009-02-21 14:17:17 -08:00
disk.c PM: Do not hold dpm_list_mtx while disabling/enabling nonboot CPUs 2009-05-24 21:15:07 +02:00
Kconfig PM_TEST_SUSPEND should depend on RTC_CLASS, not RTC_LIB 2008-11-01 12:40:38 -07:00
main.c PM: Do not hold dpm_list_mtx while disabling/enabling nonboot CPUs 2009-05-24 21:15:07 +02:00
Makefile PM: fix build for CONFIG_PM unset 2009-02-21 14:17:17 -08:00
power.h [PATCH] propagate mode through swsusp_close() 2008-10-21 07:49:02 -04:00
poweroff.c cpumask: convert rest of files in kernel/ 2009-01-01 10:12:28 +10:30
process.c container freezer: skip frozen cgroups during power management resume 2008-10-20 08:52:34 -07:00
snapshot.c mm: introduce for_each_populated_zone() macro 2009-04-01 08:59:11 -07:00
swap.c swap: Remove code handling bio_alloc failure with __GFP_WAIT 2009-04-15 12:10:13 +02:00
swsusp.c pm: rework includes, remove arch ifdefs 2009-04-01 08:59:16 -07:00
user.c PM/Hibernate: Wait for SCSI devices scan to complete during resume 2009-04-13 11:37:07 -07:00