From: "Daniel P. Berrange" <berrange@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>,
"Richard W.M. Jones" <rjones@redhat.com>,
Alexander Graf <agraf@suse.de>,
qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Slow kernel/initrd loading via fw_cfg; Was Re: Hack integrating SeaBios / LinuxBoot option rom with QEMU trace backends
Date: Tue, 11 Oct 2011 10:27:28 +0100 [thread overview]
Message-ID: <20111011092728.GL14627@redhat.com> (raw)
In-Reply-To: <4E940919.7010901@redhat.com>
On Tue, Oct 11, 2011 at 11:15:05AM +0200, Avi Kivity wrote:
> On 10/11/2011 10:23 AM, Daniel P. Berrange wrote:
> > - Application sandbox, directly boots the regular host's kernel and
> > a custom initrd image. The initrd does not contain any files except
> > for the 9p kernel modules and a custom init binary, which mounts
> > the guest root FS from a 9p filesystem export.
> >
> > The kernel is< 5 MB, while the initrd is approx 700 KB compressed,
> > or 1.4 MB compressed. Performance for the sandbox is even more
> > critical than for libguestfs. Even 10's of milliseconds make a
> > difference here. The commands being run in the sandbox can be
> > very short lived processes, executed reasonably frequently. The
> > goal is to have end-to-end runtime overhead of< 2 seconds. This
> > includes libvirt guest startup, qemu startup/shutdown, bios time,
> > option ROM time, kernel boot& shutdown time.
> >
> > The reason for using a kerenl/initrd instead of a bootable ISO,
> > is that building an ISO requires time itself, and we need to be
> > able to easily pass kernel boot arguments via -append.
> >
> >
> >I'm focusing on the last use case, and if the phase of the moon
> >is correct, I can currently executed a sandbox command with a total
> >overhead of 3.5 seconds (if using a compressed initrd) of which
> >the QEMU execution time is 2.5 seconds.
> >
> >Of this, 1.4 seconds is the time required by LinuxBoot to copy the
> >kernel+initrd. If I used an uncompressed initrd, which I really want
> >to, to avoid decompression overhead, this increases to ~1.7 seconds.
> >So the LinuxBoot ROM is ~60% of total QEMU execution time, or 40%
> >of total sandbox execution overhead.
>
> One thing we can do is boot a guest and immediately snapshot it,
> before it runs any application specific code. Subsequent
> invocations will MAP_PRIVATE the memory image and COW their way.
> This avoids the kernel initialization time as well.
This is adding an awful lot of complexity to the process, just
to avoid fixing a performance problem in QEMU. You can't even
reliably snapshot in between the time of booting the kerenl and
running the app code, without having to write some kind of handshake
betwen guest & the host app. You now also have the problem of
figuring out when the snapshot has become invalid due to host OS
software updates, which I explicitly wanted to avoid by *always*
running the current software directly.
> >For comparison I also did a test building a bootable ISO using ISOLinux.
> >This required 700 ms for the boot time, which is appoximately 1/2 the
> >time reqiured for direct kernel/initrd boot. But you have to then add
> >on time required to build the ISO on every boot, to add custom kernel
> >command line args. So while ISO is faster than LinuxBoot currently
> >there is still non-negligable overhead here that I want to avoid.
>
> You can accept parameters from virtio-serial or some other channel.
> Is there any reason you need them specifically as *kernel* command
> line parameters?
Well some of the parameters are actually kernel parameters :-) The rest
are things I pass to the 'init' process which runs in the initrd. When
this process first starts the only things it can easily access are those
builtin to the kernel image, so data available from /proc or /sys like
the /proc/cmdline file. It hasn't even loaded things like the virtio-serial
or virtio-9pfs kernel modules at this point.
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
next prev parent reply other threads:[~2011-10-11 9:27 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-10 17:08 [Qemu-devel] Hack integrating SeaBios / LinuxBoot option rom with QEMU trace backends Daniel P. Berrange
2011-10-10 18:53 ` Anthony Liguori
2011-10-10 19:01 ` Alexander Graf
2011-10-11 8:23 ` [Qemu-devel] Slow kernel/initrd loading via fw_cfg; Was " Daniel P. Berrange
2011-10-11 8:43 ` Richard W.M. Jones
2011-10-11 9:15 ` Avi Kivity
2011-10-11 9:19 ` Alexander Graf
2011-10-11 9:26 ` Avi Kivity
2011-10-11 9:38 ` Alexander Graf
2011-10-11 9:49 ` Avi Kivity
2011-10-11 9:56 ` Gleb Natapov
2011-10-11 9:59 ` Avi Kivity
2011-10-11 10:28 ` Gleb Natapov
2011-10-11 13:12 ` Anthony Liguori
2011-10-11 13:14 ` Alexander Graf
2011-10-11 13:17 ` Gleb Natapov
2011-10-11 13:19 ` Anthony Liguori
2011-10-11 13:23 ` Avi Kivity
2011-10-11 13:24 ` Gleb Natapov
2011-10-11 13:29 ` Anthony Liguori
2011-10-11 13:45 ` Avi Kivity
2011-10-11 13:58 ` Anthony Liguori
2011-10-11 14:01 ` Daniel P. Berrange
2011-10-11 14:33 ` Anthony Liguori
2011-10-11 14:34 ` Alexander Graf
2011-10-11 14:36 ` Daniel P. Berrange
2011-10-11 9:50 ` Gleb Natapov
2011-10-11 9:55 ` Avi Kivity
2011-10-11 13:17 ` Anthony Liguori
2011-10-11 13:22 ` Gleb Natapov
2011-10-15 14:19 ` Kevin O'Connor
2011-10-11 9:27 ` Daniel P. Berrange [this message]
2011-10-11 9:39 ` Avi Kivity
2011-10-11 9:49 ` Daniel P. Berrange
2011-10-11 9:50 ` Avi Kivity
2011-10-11 10:09 ` Daniel P. Berrange
2011-10-15 10:00 ` Blue Swirl
2011-10-15 16:16 ` Richard W.M. Jones
2011-10-16 17:20 ` Lluís Vilanova
2011-10-11 9:08 ` [Qemu-devel] " Avi Kivity
2011-10-11 9:18 ` Daniel P. Berrange
2011-10-11 9:35 ` Avi Kivity
2011-10-10 23:57 ` Kevin O'Connor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111011092728.GL14627@redhat.com \
--to=berrange@redhat.com \
--cc=agraf@suse.de \
--cc=avi@redhat.com \
--cc=gleb@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).