[SeaBIOS] [PATCH 1/3] Halt if number of started cpus are more then expected
Gleb Natapov
gleb at redhat.com
Mon Mar 12 14:27:45 CET 2012
On Mon, Mar 12, 2012 at 02:09:02PM +0100, Igor Mammedov wrote:
> On 03/12/2012 11:14 AM, Gleb Natapov wrote:
> >On Mon, Mar 12, 2012 at 10:52:18AM +0100, Igor Mammedov wrote:
> >>On 03/11/2012 11:36 AM, Gleb Natapov wrote:
> >>>On Sat, Mar 10, 2012 at 12:47:26PM +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.
> >>>>
> >>>>Signed-off-by: Igor Mammedov<imammedo at redhat.com>
> >>>>---
> >>>> src/smp.c | 8 +++++++-
> >>>> 1 files changed, 7 insertions(+), 1 deletions(-)
> >>>>
> >>>>diff --git a/src/smp.c b/src/smp.c
> >>>>index 8c077a1..9933ac6 100644
> >>>>--- 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));
> >>>Shouldn't we print it to the console too?
> >>I'm not sure if it's possible to print at this stage, but I'll try and
> >>re-post if it works.
> >>
> >If it is not possible currently may be we should move smp detection to
> >later stage. Or do not hlt here and report error later. The easier for a
> >user to see this error the easier it is for us to debug user's problems.
>
> It looks safe to move vga_setup() right after pci_setup() in post().
> However I can't tell what structures various option roms might access so
> I'm not completely sure if it right thing to do.
>
Well you move it above "Setup interfaces that option roms may need"
comment, so we can be sure it is not safe :)
I think moving smp detection to later stage should be safer. But now I am
not even sure we should halt at all. May be warn the user and continue
booting with cmos_smp_count = CountCPUs?
> Does something like this look good to you?
> (kvm guest boots without any issue and error prints as well if condition is met)
>
> diff --git a/src/post.c b/src/post.c
> index 43523dd..9358b49 100644
> --- a/src/post.c
> +++ b/src/post.c
> @@ -208,6 +208,9 @@ post(void)
> pci_setup();
> smm_init();
>
> + // Run vga option rom
> + vga_setup();
> +
> // Initialize internal tables
> boot_setup();
> drive_setup();
> @@ -227,9 +230,6 @@ post(void)
> mouse_setup();
> init_bios_tables();
>
> - // Run vga option rom
> - vga_setup();
> -
> // Do hardware initialization (if running synchronously)
> if (!CONFIG_THREADS || !CONFIG_THREAD_OPTIONROMS) {
> init_hw();
> diff --git a/src/smp.c b/src/smp.c
> index 42184a4..b11cb95 100644
> --- a/src/smp.c
> +++ b/src/smp.c
> @@ -138,8 +138,9 @@ smp_probe(void)
>
> 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",
> + printf("ERROR: Expected %d cpu(s) but %d cpus started.\n",
> cmos_smp_count + 1, readl(&CountCPUs));
> + printf("Machine halted.\n");
> hlt();
> }
> yield();
>
>
>
> --
> -----
> Igor
--
Gleb.
More information about the SeaBIOS
mailing list