linux-stable/drivers/oprofile
Srivatsa S. Bhat 180d864632 oprofile, nmi-timer: Fix CPU hotplug callback registration
Subsystems that want to register CPU hotplug callbacks, as well as perform
initialization for the CPUs that are already online, often do it as shown
below:

	get_online_cpus();

	for_each_online_cpu(cpu)
		init_cpu(cpu);

	register_cpu_notifier(&foobar_cpu_notifier);

	put_online_cpus();

This is wrong, since it is prone to ABBA deadlocks involving the
cpu_add_remove_lock and the cpu_hotplug.lock (when running concurrently
with CPU hotplug operations).

Instead, the correct and race-free way of performing the callback
registration is:

	cpu_notifier_register_begin();

	for_each_online_cpu(cpu)
		init_cpu(cpu);

	/* Note the use of the double underscored version of the API */
	__register_cpu_notifier(&foobar_cpu_notifier);

	cpu_notifier_register_done();

Fix the nmi-timer code in oprofile by using this latter form of callback
registration.

Cc: Robert Richter <rric@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-20 13:43:46 +01:00
..
buffer_sync.c mm: use mm->exe_file instead of first VM_EXECUTABLE vma->vm_file 2012-10-09 16:22:18 +09:00
buffer_sync.h cpumask: modifiy oprofile initialization 2009-01-22 14:37:06 +01:00
cpu_buffer.c oprofile: Remove 'WQ on CPUx, prefer CPUy' warning 2012-08-27 14:49:39 +02:00
cpu_buffer.h oprofile: Remove deprecated use of flush_scheduled_work() 2010-10-29 11:54:18 +02:00
event_buffer.c locking, oprofile: Annotate oprofilefs lock as raw 2011-09-13 11:12:05 +02:00
event_buffer.h oprofile: Use linux/mutex.h 2011-05-24 12:45:59 +02:00
nmi_timer_int.c oprofile, nmi-timer: Fix CPU hotplug callback registration 2014-03-20 13:43:46 +01:00
oprof.c oprofile, x86: Reimplement nmi timer mode using perf event 2011-11-04 16:27:18 +01:00
oprof.h oprofile: get rid of pointless forward declarations of struct super_block 2013-09-03 22:52:48 -04:00
oprofile_files.c oprofilefs_create_...() do not need superblock argument 2013-09-03 22:52:48 -04:00
oprofile_perf.c oprofilefs_create_...() do not need superblock argument 2013-09-03 22:52:48 -04:00
oprofile_stats.c oprofilefs_create_...() do not need superblock argument 2013-09-03 22:52:48 -04:00
oprofile_stats.h oprofile: get rid of pointless forward declarations of struct super_block 2013-09-03 22:52:48 -04:00
oprofilefs.c oprofilefs_create_...() do not need superblock argument 2013-09-03 22:52:48 -04:00
timer_int.c drivers: delete __cpuinit usage from all remaining drivers files 2013-07-14 19:36:59 -04:00