qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Why is SeaBIOS used with -kernel?


From: Kevin O'Connor
Subject: Re: [Qemu-devel] Why is SeaBIOS used with -kernel?
Date: Thu, 31 Mar 2016 12:22:23 -0400
User-agent: Mutt/1.5.24 (2015-08-30)

On Thu, Mar 31, 2016 at 10:21:25AM +0100, Stefan Hajnoczi wrote:
> On Sat, Mar 19, 2016 at 08:31:24PM +0000, Richard W.M. Jones wrote:
> > Is there something I'm missing, or for Linux + -kernel could we use a
> > much simpler BIOS?
> 
> The data that Marc Mari collected when comparing qboot with an optimized
> SeaBIOS/QEMU showed that there's no need for a separate "lightweight
> firmware" codebase.
> 
> https://github.com/bonzini/qboot
> 
> It would create a maintenance burden and eventually we'd want many of
> the SeaBIOS features anyway.  It's better to optimize linuxboot.bin and
> SeaBIOS instead.

In the tests I've run, the time spent in SeaBIOS is dominated by
hardware delays.  (Or for qemu, the time needed for seabios to
communicate with virtual hardware and the time required for qemu to
implement the requests.)  As such, boot times can be most easily
improved by configuring the VM with less hardware, or configuring (via
SeaBIOS kconfig) less hardware drivers in SeaBIOS.

It's possible to do course grained profiling with SeaBIOS by timing
its debug messages - see:
http://www.seabios.org/Debugging#Timing_debug_messages

The debug messages themselves can consume time though (one can
eliminate debug messages using CONFIG_DEBUG_LEVEL=0).  I use the
following to profile while also accounting for the debug message delay
(on my system, each debug character takes ~2.5us):

scripts/readserial.py -f ../qemu-test/qemudebugpipe -t 2.5

I find a standard SeaBIOS build on my machine with KVM takes ~50ms to
start the OS (not including OS load time).  This breaks down roughly
to the following times:

6ms  - enabling shadow ram (qemu makes 0xc0000-0x100000 read/writable)
4ms  - PCI initialization
2ms  - smm init
4ms  - load acpi tables from qemu
16ms - init and enable vga console
5ms  - load and run various option roms from qemu (eg, ipxe)
7ms  - locking shadow ram (qemu makes 0xc0000-0x100000 readonly)
6ms  - other

There are several SeaBIOS kconfig options that would remove many of
the above delays (with the obvious caveat that the given hardware
would no longer be initialized by seabios).

> Kevin O'Connor had some SeaBIOS optimizations that improved boot time by
> skipping unnecessary probing and timer calibration IIRC.  I have CCed
> Marc and Kevin on this email.

There were a couple of optimizations in SeaBIOS (avoid TSC calibration
when not using the TSC, avoid a PS2 keyboard reset delay) found last
year, but they were committed and released in SeaBIOS v1.9.0.  They
should already be in QEMU.

Cheers,
-Kevin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]