Received: from eggs.gnu.org ([140.186.70.92]:57513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDcAb-0007Ke-G9 for qemu-devel@nongnu.org; Tue, 11 Oct 2011 09:14:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RDcAZ-00042y-6p for qemu-devel@nongnu.org; Tue, 11 Oct 2011 09:14:57 -0400 Received: from cantor2.suse.de ([195.135.220.15]:41700 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RDcAY-00042e-VG for qemu-devel@nongnu.org; Tue, 11 Oct 2011 09:14:55 -0400 Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Alexander Graf In-Reply-To: <4E9440B6.3060201@codemonkey.ws> Date: Tue, 11 Oct 2011 15:14:52 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <2DB3FD25-4BF7-4F82-9A62-49A6891316B3@suse.de> References: <20111010170803.GV9408@redhat.com> <4E933F2D.7090703@codemonkey.ws> <20111011082315.GI14627@redhat.com> <4E940919.7010901@redhat.com> <5C80782F-C30A-4F35-93FD-0397A1040AFF@suse.de> <4E940BB6.2000400@redhat.com> <050FFBD4-BF45-4425-865B-24E7C228B592@suse.de> <4E9440B6.3060201@codemonkey.ws> Subject: Re: [Qemu-devel] Slow kernel/initrd loading via fw_cfg; Was Re: Hack integrating SeaBios / LinuxBoot option rom with QEMU trace backends List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: "Richard W.M. Jones" , Avi Kivity , Gleb Natapov , qemu-devel On 11.10.2011, at 15:12, Anthony Liguori wrote: > On 10/11/2011 04:38 AM, Alexander Graf wrote: >>=20 >> On 11.10.2011, at 11:26, Avi Kivity wrote: >>=20 >>> On 10/11/2011 11:19 AM, Alexander Graf wrote: >>>>>>=20 >>>>>> 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. >>>>>=20 >>>>> 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. >>>>=20 >>>> That doesn't allow modification of -append >>>=20 >>> Is it really needed? >>=20 >> For our use case for example yes. We pass the cifs user/pass using = the kernel cmdline, so we can reuse existing initrd code and just mount = it as root. >>=20 >>>=20 >>>> and gets you in a pretty bizarre state when doing updates of your = host files, since then you have 2 different paths: full boot and = restore. That's yet another potential source for bugs. >>>=20 >>> Typically you'd check the timestamps to make sure you're running an = up-to-date version. >>=20 >> Yes. That's why I said you end up with 2 different boot cases. Now = imagine you get a bug once every 10000 bootups and try to trace that = down that it only happens when running in the non-resume case. >>=20 >>>=20 >>>>=20 >>>>>=20 >>>>>>=20 >>>>>> 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. >>>>>=20 >>>>> You can accept parameters from virtio-serial or some other = channel. Is there any reason you need them specifically as *kernel* = command line parameters? >>>>=20 >>>> That doesn't work for kernel parameters. It also means things would = have to be rewritten needlessly. Some times we can't easily change the = way parameters are passed into the guest either, for example when = running a random (read: old, think of RHEL5) distro installation initrd. >>>=20 >>> This use case is not installation, it's for app sandboxing. >>=20 >> I thought we were talking about plenty different use cases here? I'm = pretty sure there are even more out there that we haven't even thought = about. >>=20 >>>=20 >>>> And I don't see the point why we would have to shoot yet another = hole into the guest just because we're too unwilling to make an = interface that's perfectly valid horribly slow. >>>=20 >>> rep/ins is exactly like dma+wait for this use case: provide an = address, get a memory image in return. There's no need to add another = interface, we should just optimize the existing one. >>=20 >> Whatever we do, the interface will never be as fast as DMA. We will = always have to do sanity / permission checks for every IO operation, can = batch up only so many IO requests and in QEMU again have to call our = callbacks in a loop. >=20 > rep/ins is effectively equivalent to DMA except in how it's handled = within QEMU. No, DMA has a lot bigger granularities in kvm/user interaction. We can = easily DMA a 50MB region with a single kvm/user exit. For PIO we can at = most do page granularity. Alex