On Wed, Nov 28, 2018 at 3:38 PM Kevin O'Connor <ke...@koconnor.net> wrote: > > On Wed, Nov 28, 2018 at 12:30:42PM +0100, Stefano Garzarella wrote: > > On Wed, Nov 28, 2018 at 3:12 AM Kevin O'Connor <ke...@koconnor.net> wrote: > > > On Mon, Nov 26, 2018 at 12:39:12PM +0100, Stefano Garzarella wrote: > > > > Speed up the boot phase when qemu uses "linuxboot" optionrom > > > > (qemu -kernel) and the boot-menu is not required. > > > > Under these conditions we can skip the setup of devices and VGA, > > > > because they will be initialized (if they are required) during > > > > the Linux boot phase. > > > > > > > > Following the time measured between SeaBIOS entry point and > > > > "linuxboot" entry point: > > > > > > > > * Before this patch > > > > qemu -kernel | qemu -vga none -kernel > > > > --------------+----------------------- > > > > 53.5 msec | 23.34 msec > > > > > > > > * After this patch > > > > qemu -kernel | qemu -vga none -kernel > > > > --------------+----------------------- > > > > 12.82 msec | 10.89 msec > > > > > > > > Note: For the measuring, we used the default configuration disabling > > > > debug messages (CONFIG_DEBUG_LEVEL=0) and applying Stephen's patch: > > > > "tpm: Check for TPM related ACPI tables before attempting hw" > > > > > > > > Signed-off-by: Stefano Garzarella <sgarz...@redhat.com> > > > > --- > > > > src/bootsplash.c | 3 +++ > > > > src/fw/paravirt.c | 10 ++++++++++ > > > > src/fw/paravirt.h | 4 ++++ > > > > src/optionroms.c | 3 ++- > > > > src/post.c | 3 +++ > > > > 5 files changed, 22 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/src/bootsplash.c b/src/bootsplash.c > > > > index 165c98d..0eda7f2 100644 > > > > --- a/src/bootsplash.c > > > > +++ b/src/bootsplash.c > > > > @@ -8,6 +8,7 @@ > > > > #include "bregs.h" // struct bregs > > > > #include "config.h" // CONFIG_* > > > > #include "farptr.h" // FLATPTR_TO_SEG > > > > +#include "fw/paravirt.h" // runningOnQEMUFastBoot > > > > #include "malloc.h" // free > > > > #include "output.h" // dprintf > > > > #include "romfile.h" // romfile_loadfile > > > > @@ -39,6 +40,8 @@ call16_int10(struct bregs *br) > > > > void > > > > enable_vga_console(void) > > > > { > > > > + if(runningOnQEMUFastBoot()) > > > > + return; > > > > dprintf(1, "Turning on vga text mode console\n"); > > > > struct bregs br; > > > > > > > > diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c > > > > index 0770c47..9e6e618 100644 > > > > --- a/src/fw/paravirt.c > > > > +++ b/src/fw/paravirt.c > > > > @@ -621,4 +621,14 @@ void qemu_cfg_init(void) > > > > if (nogfx && !romfile_find("etc/sercon-port") > > > > && !romfile_find("vgaroms/sgabios.bin")) > > > > const_romfile_add_int("etc/sercon-port", PORT_SERIAL1); > > > > + > > > > + /* > > > > + * Enable QEMU fast boot if there is "linuxboot" optionrom and > > > > + * the boot menu is not required. > > > > + */ > > > > + if ((romfile_find("genroms/linuxboot_dma.bin") > > > > + || romfile_find("genroms/linuxboot.bin")) > > > > + && !romfile_loadint("etc/show-boot-menu", 1)) { > > > > + PlatformRunningOn |= PF_QEMU_FB; > > > > + } > > > > > > I don't think we should hardcode special meanings to the names of > > > bootable files. If QEMU wants SeaBIOS to not perform some type of > > > hardware init, then I think QEMU should explicitly request that from > > > SeaBIOS (eg, a "etc/dont-run-hardware-init"). > > > > I agree, it is cleaner. That was one of my doubt but, with an explicit > > request, it works only with a new version of QEMU. > > Do you think is acceptable? > > It would be good to understand what the source of the delay is. It > might be possible to avoid the delay without adding a new config > setting. For example, the patch above will prevent the vga rom from > being run, but it should be possible to accomplish the same with > "-device VGA,romfile=". The other change this patch makes is to skip > device_hardware_setup() - is it known which items in that function add > to the delay?
Hi Kevin, thanks for your advice. I tried to understand what are the sources of the delay, and I found that most of the time is spent because of QEMU default devices (eg e1000 ROM PCI, mouse, keyboard, etc) At this point, (without the patch above) I disabled the default QEMU devices (-nodefaults) and I reached 12.5 ms of SeaBIOS boot time (compared to 22 ms, where 4 ms is taken by the loading of e1000 ROM). Other 2 ms is taken by enable_vga_console(), where simply comment out the printf("SeaBIOS (version %s)\n", VERSION) I reached 10.7 ms of boot time. Do you think is acceptable to use dprintf(1, ...) instead of printf()? Or maybe check if we found the VGA. Note: All these tests are done with CONFIG_DEBUG_LEVEL=0, using CONFIG_DEBUG_LEVEL=1 the boot time grows up to 24 ms, maybe we should put CONFIG_DEBUG_LEVEL=0 in the SeaBIOS configuration used in QEMU. > > Also, what is the target boot time that is considered acceptable? I'm using qboot as a reference (6/7 ms). It is very minimal, so 10 ms I think is considered acceptable for SeaBIOS Thanks, Stefano > > Thanks, > -Kevin-- Stefano Garzarella Red Hat _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios