[LinuxBIOS] PATCH: nested spinlock hang when initializing x86 sibling CPUs

Steven J. Magnani steve at digidescorp.com
Fri Sep 9 21:59:16 CEST 2005


Here is a revised patch which works in the Intel world. Let me know if
this causes any problems in the AMD world.

I'm still planning on making the comment changes to
src/config/Options.lb, unless someone thinks I've made things more
confusing.


PATCH:

--- src/cpu/x86/lapic/lapic_cpu_init.c.orig	2005-09-09
09:29:25.156250000 -0500
+++ src/cpu/x86/lapic/lapic_cpu_init.c	2005-09-09 14:54:51.218750000
-0500
@@ -227,20 +227,26 @@
 }
 
 /* C entry point of secondary cpus */
+
+// secondary_cpu_lock is used to serialize initialization of secondary
CPUs
+// This can be used to avoid interleaved debugging messages.
+
+static spinlock_t secondary_cpu_lock = SPIN_LOCK_UNLOCKED;
+
 void secondary_cpu_init(void)
 {
 	atomic_inc(&active_cpus);
+
 #if SERIAL_CPU_INIT == 1
-  #if CONFIG_MAX_CPUS>2
-	spin_lock(&start_cpu_lock);
-  #endif
+	spin_lock(&secondary_cpu_lock);
 #endif
+
 	cpu_initialize();
+
 #if SERIAL_CPU_INIT == 1
-  #if CONFIG_MAX_CPUS>2
-	spin_unlock(&start_cpu_lock);
-  #endif
+	spin_unlock(&secondary_cpu_lock);
 #endif
+
 	atomic_dec(&active_cpus);
 	stop_this_cpu();
 }
------------------------------------------------------------------------
 Steven J. Magnani               "I claim this network for MARS!
 www.digidescorp.com              Earthling, return my space modulator!"

 #include <standard.disclaimer>







More information about the coreboot mailing list