qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: "Thomas Huth" <thuth@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Greg Kurz" <groug@kaod.org>
Subject: Re: [Qemu-devel] release retrospective, next release timing, numbering
Date: Thu, 3 May 2018 19:02:40 +0100	[thread overview]
Message-ID: <20180503180240.GC13789@stefanha-x1.localdomain> (raw)
In-Reply-To: <222ee475-9eb5-8887-819a-7b093fc269b1@kaod.org>

[-- Attachment #1: Type: text/plain, Size: 2497 bytes --]

On Thu, May 03, 2018 at 04:16:41PM +0200, Cédric Le Goater wrote:
> Coming back to the initial motivation that Peter pointed out, would
> the goal to be able to run vcpus of different architectures ? It would
> certainly be interesting to model a platform, specially if we can 
> synchronize the execution in some ways and find timing issues.

Yes, there is demand for heterogenous guests.  People have worked on
this problem in the past but nothing mergeable came out of it.

The main issue with a monolithic binary is that today, QEMU builds
target-specific object files (see Makefile.target).  That means the same
C source file is recompiled for each target with different #defines.  We
cannot easily link these "duplicate" object files into a single binary
because the symbol names would collide.

It would be necessary to refactor target-specific #ifdefs.  Here is a
trivial example from arch_init.c:

  #ifdef TARGET_SPARC
  int graphic_width = 1024;
  int graphic_height = 768;
  int graphic_depth = 8;
  #else
  int graphic_width = 800;
  int graphic_height = 600;
  int graphic_depth = 32;
  #endif

This can be converted into a runtime check:

  static void init_graphic_resolution(void)
  {
      if (arch_type == QEMU_ARCH_SPARC) {
          graphic_width = 1024;
          graphic_height = 768;
          graphic_depth = 8;
      } else {
          graphic_width = 800;
          graphic_height = 600;
          graphic_depth = 32;
      }
  }
  target_init(init_graphic_resolution)

I'm assuming target_init() registers functions that will be called once
arch_type has been set.

Of course the meaning of arch_type in a heterogenous system is different
since there can be multiple CPUs.  It would mean the overall board (e.g.
a SPARC machine).  But that is a separate issue and can only be
addressed once target-specific files have been eliminated.

I also want to point out that a monolithic binary is totally orthogonal
to modularity (reducing attack surface, reducing dependencies).  These
two issues do not conflict with each other.  We could have a single
"qemu-softmmu" binary that dynamically loads needed machine types, CPU,
and emulated devices.  That way the monolithic binary can do everything
but is still minimal.

So to clarify, three separate steps:

1. Get rid of target-specific #ifdefs
2a. Modular QEMU, single binary
2b. Heterogenous QEMU

2a and 2b are independent but both depend on 1.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  reply	other threads:[~2018-05-03 18:02 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-27 15:51 [Qemu-devel] release retrospective, next release timing, numbering Peter Maydell
2018-04-27 16:17 ` Thomas Huth
2018-04-27 16:24   ` Peter Maydell
2018-04-27 16:42     ` Thomas Huth
2018-04-30 10:06       ` Paolo Bonzini
2018-04-30 10:11         ` Peter Maydell
2018-05-02 11:58       ` Daniel P. Berrangé
2018-05-02 12:05         ` Peter Maydell
2018-05-03  9:33           ` Daniel P. Berrangé
2018-05-03  9:42             ` Thomas Huth
2018-05-03  9:45               ` Daniel P. Berrangé
2018-05-03 14:01                 ` Cédric Le Goater
2018-05-03 14:16               ` Cédric Le Goater
2018-05-03 18:02                 ` Stefan Hajnoczi [this message]
2018-05-03 18:50                   ` Dr. David Alan Gilbert
2018-05-04  8:29                     ` Stefan Hajnoczi
2018-05-04  5:29                   ` Markus Armbruster
2018-05-04  8:16                     ` Stefan Hajnoczi
2018-05-04  8:24                       ` Peter Maydell
2018-04-27 19:01     ` Michal Suchánek
2018-04-29 14:56       ` Richard Henderson
2018-05-02 10:41         ` Laszlo Ersek
2018-05-02 11:51           ` Peter Maydell
2018-05-07 18:12         ` Michal Suchánek
2018-04-30 10:35       ` Daniel P. Berrangé
2018-05-02  7:29     ` Markus Armbruster
2018-05-02  8:16       ` Daniel P. Berrangé
2018-05-02  9:44         ` Cornelia Huck
2018-04-30  9:29 ` Cornelia Huck
2018-04-30 10:01   ` Peter Maydell
2018-04-30 10:33 ` Daniel P. Berrangé
2018-04-30 11:21   ` Cornelia Huck
2018-04-30 17:36     ` Thomas Huth
2018-05-02  7:33       ` Cornelia Huck
2018-05-02  7:43         ` Liviu Ionescu
2018-05-02  7:59           ` Daniel P. Berrangé
2018-05-02  8:02             ` Liviu Ionescu
2018-05-02  8:13               ` Thomas Huth
2018-05-02  9:03                 ` Liviu Ionescu
2018-05-02  9:10                   ` Daniel P. Berrangé
2018-05-28  9:24                     ` Paolo Bonzini
2018-05-02  9:21                   ` Cornelia Huck
2018-05-02  9:22                   ` Thomas Huth
2018-05-02  8:26               ` Cornelia Huck
2018-05-04 17:34             ` Max Reitz
2018-05-02  7:44       ` Gerd Hoffmann
2018-05-02  8:02         ` Daniel P. Berrangé
2018-05-03  7:21           ` Stefan Hajnoczi
2018-05-03  9:07             ` Daniel P. Berrangé
2018-05-03  9:26               ` Cornelia Huck
2018-05-03  9:26               ` Peter Maydell
2018-05-03  9:31                 ` Daniel P. Berrangé
2018-05-03  9:47                   ` Thomas Huth
2018-05-03 13:43                 ` Gerd Hoffmann
2018-05-03 14:06                   ` Thomas Huth
2018-05-03 14:16                     ` Daniel P. Berrangé
2018-05-07 13:38                       ` Kashyap Chamarthy
2018-05-07 16:51                         ` Thomas Huth
2018-05-03 14:16                     ` Cornelia Huck
2018-05-04 13:20                   ` Kevin Wolf
2018-05-04 13:53                     ` Thomas Huth
2018-05-04 14:23                       ` Kevin Wolf
2018-05-04 17:30                     ` Richard Henderson
2018-05-07  5:33                       ` Thomas Huth
2018-05-07 14:05                         ` Kevin Wolf
2018-05-22 10:07   ` Peter Maydell
2018-06-01 11:57     ` Daniel P. Berrangé
2018-04-30 14:23 ` Greg Kurz
2018-04-30 14:30   ` Peter Maydell
2018-04-30 14:34   ` Daniel P. Berrangé
2018-05-03  1:04   ` David Gibson
2018-05-01 12:24 ` Stefan Hajnoczi
2018-05-01 12:48   ` Peter Maydell
2018-05-03 21:52   ` Laurent Vivier
2018-05-04  8:40     ` Stefan Hajnoczi
2018-05-28  5:31 ` Philippe Mathieu-Daudé

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=20180503180240.GC13789@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=clg@kaod.org \
    --cc=groug@kaod.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@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).