Received: from eggs.gnu.org ([2001:4830:134:3::10]:38378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0ABN-00057L-69 for qemu-devel@nongnu.org; Mon, 06 Jan 2014 08:25:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0ABH-0003HL-5Q for qemu-devel@nongnu.org; Mon, 06 Jan 2014 08:25:29 -0500 Received: from smtp.citrix.com ([66.165.176.89]:49243) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0ABH-0003HF-0y for qemu-devel@nongnu.org; Mon, 06 Jan 2014 08:25:23 -0500 Message-ID: <1389014715.19378.8.camel@hamster.uk.xensource.com> From: Frediano Ziglio Date: Mon, 6 Jan 2014 13:25:15 +0000 In-Reply-To: <20140106125410.GD3119@zion.uk.xensource.com> References: <20140106125410.GD3119@zion.uk.xensource.com> Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Xen-devel] Project idea: make QEMU more flexible List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wei Liu Cc: qemu-devel@nongnu.org, xen-devel@lists.xen.org On Mon, 2014-01-06 at 12:54 +0000, Wei Liu wrote: > Hi all > > This idea is to modify QEMU's Makefiles, plus implementing some stubs to > make it possible to tailor QEMU to a smaller binary. > > The current setup for Xen on X86 is to build i386-softmmu, and uses this > single binary for two purposes: > 1. serves as device emulator for HVM guest. > 2. serves as PV driver backend for PV guest. > Perhaps even KVM would benefit too. Are you sure we don't emulate any instruction for other purposes? > Either case CPU emulation is never used because Xen handles that > already. So we are in fact having a load of unused code in QEMU build. > > What I have in mind is to build a QEMU binary which: > 1. does not include CPU emulation code at all. > 2. only includes components that's useful (what's useful is TBD). > > And the rationales behind this idea are: > > 1. Reduce memory footprint. One usecase would be running Xen on embedded > platform (X86 or ARM). We would expect the system has very limited > resources. The smaller the binary, the better. > > 2. It doesn't make sense to have i386 emulation on ARM platform. > Arguably nobody can prevent user from running i386 emulator on ARM > platform, but it doesn't make sense in Xen's setup where QEMU is > only used as PV device backend on ARM. > > 3. Security concern. It's much easier to audit small code base. > > Please note that I'm not proposing to invalidate all the other usecases. > I'm only speaking with my Xen developer's hat on, aiming to make QEMU > more flexible. > > Down to implementation level I only need to (hopefully) add a few stubs > and create some new CONFIG_* options and move a few things around. It > might not be as intrusive as one thinks. > > In fact I've already hacked a prototype during Christmas. What's I've > done so far: > > 1. create target-null which only has some stubs to CPU emulation > framework. > > 2. add a few lines to configure / Makefiles*, create > default-configs/null-softmmu > > Finally I got a qemu-system-null. And the effect is immediately visible > -- the size of QEMU binary shrinked from 13MB to 7.6MB. I haven't really > looked at what device emulation code can be removed so the size can even > be made smaller. > Well, I would prefer something like a i386-nocpu. The system qemu emulate is still specific to a given architecture. You can't emulate ARM with the same executable. So we'd add default-configs/arm-nocpu.mak and default-config/x86_64-nocpu.mak (i386 don't make much sense anymore). > What do you think about this idea? > > Thanks > Wei. > Frediano