[LinuxBIOS] PATCH: failure/race in secondary CPU startup
Steven J. Magnani
steve at digidescorp.com
Mon Sep 12 18:39:09 CEST 2005
This patch does two things:
* Prints a failure message when a sibling CPU fails to start
(currently, a message is printed only when a CPU enumerated
in Config.lb fails to start).
* Detects a race condition that results in secondary CPUs
using the wrong CPU info. This can occur if the BSP times
out waiting for a secondary CPU to respond, for example
if the secondary startup code is modified so that an
emulator can be used to debug the secondary CPU.
PATCH:
--- src/cpu/intel/hyperthreading/intel_sibling.c.orig 2005-09-08
13:35:05.578125000 -0500
+++ src/cpu/intel/hyperthreading/intel_sibling.c 2005-09-12
11:24:20.546875000 -0500
@@ -67,7 +67,11 @@
new->path.u.apic.apic_id);
#endif
/* Start the new cpu */
- start_cpu(new);
+ if (!start_cpu(new)) {
+ /* Record the error in cpu? */
+ printk_err("CPU %u would not start!\n",
+ new->path.u.apic.apic_id);
+ }
}
}
--- src/arch/i386/lib/cpu.c.orig 2005-09-08 13:35:40.875000000
-0500
+++ src/arch/i386/lib/cpu.c 2005-09-12 11:26:27.375000000 -0500
@@ -231,6 +231,14 @@
die("CPU: missing cpu device structure");
}
+ // Check that we haven't been passed bad information as the
result of a race
+ // (i.e. BSP timed out while waiting for us to load
secondary_stack)
+
+ if (cpu->path.u.apic.apic_id != lapicid()) {
+ printk_err("CPU #%d Initialization FAILED: APIC ID
mismatch (%u != %u)\n",
+ info->index,
cpu->path.u.apic.apic_id, lapicid());
+ // return without setting initialized flag
+ } else {
/* Find what type of cpu we are dealing with */
identify_cpu(cpu);
printk_debug("CPU: vendor %s device %x\n",
@@ -247,6 +255,8 @@
}
printk_info("CPU #%d Initialized\n", info->index);
+ }
+
return;
}
------------------------------------------------------------------------
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