[SeaBIOS] [PATCH v2] Halt if number of started cpus are more then expected
Kevin O'Connor
kevin at koconnor.net
Thu Mar 22 00:39:12 CET 2012
On Fri, Mar 16, 2012 at 10:33:15AM +0100, Igor Mammedov wrote:
> Reduce amount of consumed cpu time (i.e. don't spin forever) if
> number of started cpus are more then expected. And print a bug
> message into debug port.
>
> And it is not safe to continue to boot if CountCPUs is more than
> cmos_smp_count and might be still racing, due to mp/acpi could be
> build with still changing CountCPUs. It is safer to stop and allow
> user to notice and restart system rather than debug possible
> inxplicable bugs later.
I don't understand the gain in this. The CPU is spinning on the
count, so (unless I missed something) there's a very good chance that
this check wont trigger even if the emulator sets the counts wrong.
It seems like we're just adding a random halt. Why bother?
[...]
> --- a/src/smp.c
> +++ b/src/smp.c
> @@ -115,8 +115,14 @@ smp_probe(void)
> msleep(10);
> } else {
> u8 cmos_smp_count = inb_cmos(CMOS_BIOS_SMP_COUNT);
> - while (cmos_smp_count + 1 != readl(&CountCPUs))
> + while (cmos_smp_count + 1 != readl(&CountCPUs)) {
> + if (cmos_smp_count + 1 < readl(&CountCPUs)) {
> + dprintf(1, "BUG: Expected %d cpu(s) but %d cpus started\n",
> + cmos_smp_count + 1, readl(&CountCPUs));
> + hlt();
The panic() call should be used instead of dprintf()/hlt().
-Kevin
More information about the SeaBIOS
mailing list