Skip to contentSkip to conversation

x86-64 fix smp boot failure with thread_info change

PATCH In review Benjamin LaHaise 1 participant 1 message Nov 30, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 5/9 x86-64 fix smp boot failure with thread_info change

Make sure that stack_smp_processor_id() gets set for all CPUs regardless of which path we take in do_boot_cpu(), as well as in upcoming case where tsk->thread_info != task_thread_info(tsk).

Add a memory barrier to ensure this change is flushed before the other CPU comes up. My P4/HT machine was occasionally randomly failing to boot without this barrier.

---

 arch/x86_64/kernel/smpboot.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

applies-to: ff25c960b7af25819aba4fbecbd94bd3500a3a4a 932262b117ba1c3a77078b64674e1a1823c169df

arch/x86_64/kernel/smpboot.c +4 -0
index 50d018a..10b951b 100644
@@ -780,6 +780,9 @@ do_rest:
 
 	cpu_pda[cpu].pcurrent = c_idle.idle;
 
+	/* set the CPU for stack_smp_processor_id() */
+	c_idle.idle->thread_info->cpu = cpu;
+
 	start_rip = setup_trampoline();
 
 	init_rsp = c_idle.idle->thread.rsp;
@@ -796,6 +799,7 @@ do_rest:
 	 * the targeted processor.
 	 */
 
+	mb();
 	atomic_set(&init_deasserted, 0);
 
 	Dprintk("Setting warm reset code and vector.\n");

---
0.99.9.GIT