aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/kernel
diff options
context:
space:
mode:
authorSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>2014-03-10 16:34:52 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-03-20 08:43:40 -0400
commit9f37bca9a9e97fcd7589492aba7b8a5310026c47 (patch)
treecc985a7fd6fd796e212abd1378fa0fbb59426d61 /arch/ia64/kernel
parenteff722b06bdd6de326894ea2353ec0eda3e5ed34 (diff)
ia64, palinfo: 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 palinfo code in ia64 by using this latter form of callback registration. Cc: Tony Luck <tony.luck@intel.com> Cc: Fenghua Yu <fenghua.yu@intel.com> 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>
Diffstat (limited to 'arch/ia64/kernel')
-rw-r--r--arch/ia64/kernel/palinfo.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
index ab333284f4b2..c39c3cd3ac34 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
@@ -996,13 +996,17 @@ palinfo_init(void)
996 if (!palinfo_dir) 996 if (!palinfo_dir)
997 return -ENOMEM; 997 return -ENOMEM;
998 998
999 cpu_notifier_register_begin();
1000
999 /* Create palinfo dirs in /proc for all online cpus */ 1001 /* Create palinfo dirs in /proc for all online cpus */
1000 for_each_online_cpu(i) { 1002 for_each_online_cpu(i) {
1001 create_palinfo_proc_entries(i); 1003 create_palinfo_proc_entries(i);
1002 } 1004 }
1003 1005
1004 /* Register for future delivery via notify registration */ 1006 /* Register for future delivery via notify registration */
1005 register_hotcpu_notifier(&palinfo_cpu_notifier); 1007 __register_hotcpu_notifier(&palinfo_cpu_notifier);
1008
1009 cpu_notifier_register_done();
1006 1010
1007 return 0; 1011 return 0;
1008} 1012}