Please do not touch SERIAL_CPU_INIT. That doesn't hurt.

YH

-----Original Message-----
From: Steven J. Magnani [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 09, 2005 12:59 PM
To: Lu, Yinghai; [EMAIL PROTECTED]
Cc: [email protected]
Subject: RE: [LinuxBIOS] PATCH: nested spinlock hang when initializing
x86 sibling CPUs

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>






--
LinuxBIOS mailing list
[email protected]
http://www.openbios.org/mailman/listinfo/linuxbios

Reply via email to