linux/arch/x86/kernel/cpu/mcheck
Srivatsa S. Bhat 82a8f131aa x86, mce: 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 mce code in x86 by using this latter form of callback registration.

Cc: Tony Luck <tony.luck@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
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:42 +01:00
..
Makefile ACPI, APEI, Generic Hardware Error Source memory error support 2010-05-19 22:41:16 -04:00
mce_amd.c x86: delete __cpuinit usage from all x86 files 2013-07-14 19:36:56 -04:00
mce_intel.c x86: Delete non-required instances of include <linux/init.h> 2014-01-06 21:25:18 -08:00
mce-apei.c ACPI, APEI, GHES: Do not report only correctable errors with SCI 2013-12-21 13:31:06 +01:00
mce-inject.c x86, mce: Fix "braodcast" typo 2013-06-05 11:59:17 +02:00
mce-internal.h mce: acpi/apei: Honour Firmware First for MCA banks listed in APEI HEST CMC 2013-07-08 11:53:01 -07:00
mce-severity.c x86/mce: Fix mce regression from recent cleanup 2013-07-29 11:23:27 -07:00
mce.c x86, mce: Fix CPU hotplug callback registration 2014-03-20 13:43:42 +01:00
p5.c x86: Delete non-required instances of include <linux/init.h> 2014-01-06 21:25:18 -08:00
therm_throt.c x86: delete __cpuinit usage from all x86 files 2013-07-14 19:36:56 -04:00
threshold.c x86, trace: Add irq vector tracepoints 2013-06-20 22:25:34 -07:00
winchip.c x86: Delete non-required instances of include <linux/init.h> 2014-01-06 21:25:18 -08:00