All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] CPU hotplug, Freezer: Fix bugs in CPU hotplug call path
@ 2011-10-21 12:24 Srivatsa S. Bhat
  2011-10-21 12:24 ` [PATCH v3 1/3] CPU hotplug, Freezer: Don't hardcode 'tasks_frozen' argument in _cpu_*() Srivatsa S. Bhat
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Srivatsa S. Bhat @ 2011-10-21 12:24 UTC (permalink / raw)
  To: a.p.zijlstra
  Cc: rjw, pavel, len.brown, mingo, akpm, suresh.b.siddha,
	lucas.demarchi, linux-pm, rusty, vatsa, ashok.raj, linux-kernel,
	linux-doc, rdunlap

When using the CPU hotplug infrastructure to offline/online CPUs, the cpu_up()
and cpu_down() functions are used, which internally call _cpu_up() and
_cpu_down() with the second argument *always* set to 0. The second argument
is "tasks_frozen", which should be correctly set to 1 when tasks have been
frozen, even when the freezing of tasks may be due to an event unrelated
to CPU hotplug, such as a suspend operation in progress, in which case the
freezer subsystem freezes all the freezable tasks.

Not giving the correct value for the 'tasks_frozen' argument can potentially
lead to a lot of issues since this will send wrong notifications via the
notifier mechanism leading to the execution of inappropriate code by the
callbacks registered for the notifiers. That is, instead of CPU_ONLINE_FROZEN
and CPU_DEAD_FROZEN notifications, it results in CPU_ONLINE and CPU_DEAD
notifications to be sent all the time, irrespective of the actual state of
the system (i.e., whether tasks are frozen or not).

This patch introduces a flag to indicate whether the tasks are frozen are not
(by any event) and modifies cpu_up() and cpu_down() functions to check the
value of this flag and accordingly call _cpu_up() and _cpu_down() respectively
by supplying the correct value as the second argument based on the state of
the system. This in turn means that the correct notifications are sent, thus
ensuring that all the registered callbacks do the right thing.

Additionally, to ensure that the tasks are not frozen or thawed by the freezer
subsystem while the registered callbacks are running, this patch adds a few
notifications in the freezer which is then hooked onto by the CPU hotplug
code, to avoid this race.

v3: * Added synchronization between CPU hotplug and the freezer subsystem
      without introducing any new locks in the CPU hotplug call path.

v2: * Removed the atomic_t declaration of tasks_frozen flag and the
      atomic_[set|read] functions since they were unnecessary.
    * Updated the changelog to give an example scenario where things could go
      wrong due to the bug in the CPU hotplug call path.

References:
v1 -> http://thread.gmane.org/gmane.linux.kernel/1198312/
v2 -> http://thread.gmane.org/gmane.linux.kernel/1198312/focus=1199087

--
Srivatsa S. Bhat (3):
      CPU hotplug, Freezer: Don't hardcode 'tasks_frozen' argument in _cpu_*()
      CPU hotplug, Freezer: Synchronize CPU hotplug and freezer
      PM, Freezer, Docs: Update documentation about the new freezer notifiers


 Documentation/power/notifiers.txt |    8 ++++
 include/linux/freezer.h           |    2 +
 include/linux/suspend.h           |    6 ++-
 kernel/cpu.c                      |   76 ++++++++++++++++++++++++++++++++++++-
 kernel/power/process.c            |   32 +++++++++++++++-
 5 files changed, 120 insertions(+), 4 deletions(-)



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-10-21 15:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-21 12:24 [PATCH v3 0/3] CPU hotplug, Freezer: Fix bugs in CPU hotplug call path Srivatsa S. Bhat
2011-10-21 12:24 ` [PATCH v3 1/3] CPU hotplug, Freezer: Don't hardcode 'tasks_frozen' argument in _cpu_*() Srivatsa S. Bhat
2011-10-21 12:25 ` [PATCH v3 2/3] CPU hotplug, Freezer: Synchronize CPU hotplug and freezer Srivatsa S. Bhat
2011-10-21 14:43   ` Alan Stern
2011-10-21 12:25 ` [PATCH v3 3/3] PM, Freezer, Docs: Update documentation about the new freezer notifiers Srivatsa S. Bhat
2011-10-21 14:42 ` [PATCH v3 0/3] CPU hotplug, Freezer: Fix bugs in CPU hotplug call path Alan Stern
2011-10-21 15:39   ` Srivatsa S. Bhat

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.