linux/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
cpu_buffer.c
cpu_buffer.h
event_buffer.c
event_buffer.h
nmi_timer_int.c oprofile, nmi-timer: Fix CPU hotplug callback registration 2014-03-20 13:43:46 +01:00
oprof.c
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