qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Frediano Ziglio <frediano.ziglio@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: qemu-devel@nongnu.org, xen-devel@lists.xen.org
Subject: Re: [Qemu-devel] [Xen-devel] Project idea: make QEMU more flexible
Date: Mon, 6 Jan 2014 13:25:15 +0000	[thread overview]
Message-ID: <1389014715.19378.8.camel@hamster.uk.xensource.com> (raw)
In-Reply-To: <20140106125410.GD3119@zion.uk.xensource.com>

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

  parent reply	other threads:[~2014-01-06 13:25 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-06 12:54 [Qemu-devel] Project idea: make QEMU more flexible Wei Liu
2014-01-06 13:23 ` Peter Crosthwaite
2014-01-06 15:11   ` Wei Liu
2014-01-06 16:32     ` Peter Maydell
2014-01-06 17:34       ` Stefano Stabellini
2014-01-06 18:06         ` Peter Maydell
2014-01-07 13:26           ` Stefano Stabellini
2014-01-07 13:35             ` Peter Maydell
2014-01-07 13:50             ` Paolo Bonzini
2014-01-07 14:34               ` Stefano Stabellini
2014-01-07 14:38               ` Wei Liu
2014-01-07 14:40                 ` Paolo Bonzini
2014-01-07 15:11               ` Peter Maydell
2014-01-07 15:34                 ` Paolo Bonzini
2014-01-06 13:25 ` Frediano Ziglio [this message]
2014-01-06 14:17   ` [Qemu-devel] [Xen-devel] " Stefano Stabellini
2014-01-06 14:21     ` Peter Maydell
2014-01-06 14:27       ` Anthony Liguori
2014-01-06 14:54         ` Stefano Stabellini
2014-01-06 15:04           ` Peter Maydell
2014-01-06 20:59             ` Paolo Bonzini
2014-01-06 15:39           ` Anthony Liguori
2014-01-06 15:57             ` Stefano Stabellini
2014-01-06 17:49               ` Anthony Liguori
2014-01-06 18:04                 ` Stefano Stabellini
2014-01-06 18:00             ` Andreas Färber
2014-01-06 20:53               ` Paolo Bonzini
2014-01-07 12:34                 ` Wei Liu
2014-01-07 13:32                   ` Paolo Bonzini
2014-01-07 13:37                     ` Wei Liu
2014-01-21 18:27                     ` Wei Liu
2014-01-22 10:20                       ` Paolo Bonzini
2014-01-22 12:09                         ` Wei Liu
2014-01-22 16:09                         ` Wei Liu
2014-01-23  9:11                           ` Paolo Bonzini
2014-01-23 13:54                             ` Wei Liu
2014-01-23 16:23                               ` Wei Liu
2014-02-04  4:32                                 ` Paolo Bonzini
2014-01-06 13:30 ` [Qemu-devel] " Peter Maydell
2014-01-06 15:12   ` Wei Liu
2014-01-06 18:12     ` Andreas Färber
2014-01-06 18:25       ` Wei Liu
2014-01-07 13:10         ` [Qemu-devel] [Xen-devel] " Stefano Stabellini

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=1389014715.19378.8.camel@hamster.uk.xensource.com \
    --to=frediano.ziglio@citrix.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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).