]> git.karo-electronics.de Git - karo-tx-linux.git/commit
PM / Sleep: Fix race between CPU hotplug and freezer
authorSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Wed, 2 Nov 2011 23:59:25 +0000 (00:59 +0100)
committerRafael J. Wysocki <rjw@sisk.pl>
Wed, 2 Nov 2011 23:59:25 +0000 (00:59 +0100)
commit1ac54770d59aeb59f73c2c2ca39e2a8c8c7aa059
tree2b82c8a4698278a59ecad6685a07e625cc27f8e6
parent2e3342a4f0ab3507583e39d278d1bc0849895002
PM / Sleep: Fix race between CPU hotplug and freezer

The CPU hotplug notifications sent out by the _cpu_up() and _cpu_down()
functions depend on the value of the 'tasks_frozen' argument passed to them
(which indicates whether tasks have been frozen or not).
(Examples for such CPU hotplug notifications: CPU_ONLINE, CPU_ONLINE_FROZEN,
CPU_DEAD, CPU_DEAD_FROZEN).

Thus, it is essential that while the callbacks for those notifications are
running, the state of the system with respect to the tasks being frozen or
not remains unchanged, *throughout that duration*. Hence there is a need for
synchronizing the CPU hotplug code with the freezer subsystem.

Since the freezer is involved only in the Suspend/Hibernate call paths, this
patch hooks the CPU hotplug code to the suspend/hibernate notifiers
PM_[SUSPEND|HIBERNATE]_PREPARE and PM_POST_[SUSPEND|HIBERNATE] to prevent
the race between CPU hotplug and freezer, thus ensuring that CPU hotplug
notifications will always be run with the state of the system really being
what the notifications indicate, _throughout_ their execution time.

Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
kernel/cpu.c