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

From: Benjamin LaHaise
Date: Tue Nov 29 2005 - 23:24:16 EST


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
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index 50d018a..10b951b 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/