From: "Daniel P. Berrange" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Markus Armbruster" <armbru@redhat.com>,
"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH RFC 0/7] Making QOM introspectable
Date: Wed, 2 Sep 2015 10:05:39 +0100 [thread overview]
Message-ID: <20150902090539.GB22094@redhat.com> (raw)
In-Reply-To: <1440590594-5514-1-git-send-email-berrange@redhat.com>
Ping, any thoughts on this....
On Wed, Aug 26, 2015 at 01:03:07PM +0100, Daniel P. Berrange wrote:
> There are many problems in QEMU related to introspection
> of features, which Markus has been attacking/slaying for
> a while. One of the remaining elephants in the corner of
> the room which I've not seen work on is QOM.
>
> QOM has a nice class/object framework, kind of like GLib's
> GObject, but with the difference that properties are
> registered against objects rather than classes. IIRC the
> rationale for this is that in some cases the properties
> registered are going to be dynamically decided at runtime,
> so it isn't possible to statically define them against
> classes. Now this may well be true of some properties,
> but there are equally plenty of cases where the properties
> /are/ invariant and could be registered against classes.
>
> There are two core problems with registering properties
> against object instances:
>
> - It is wasteful of memory to duplicate the allocation
> of ObjectProperty structs against each object
> instance. When you have N object instances, you
> have O(N) memory usage, instead of O(1). This is not
> a problem for objects which are mostly singletons,
> but there are cases in QEMU where you instantiate
> many instances of the same class and/or have many
> properties.
>
> - It prevents static introspection. Since the property
> is only registered in the object initializer, there
> is no way to programmatically query what properties
> an object supports without first instantiating it.
> Taking machine types as an example, if you want to
> introspect every machine type supported by a QEMU
> binary you thus have to launch QEMU many times,
> passing a different -M argument each time. As the
> number of different machine types & objects
> increases this quickly becomes impractical.
>
> This series thus extends QOM to make it possible to register
> properties against the classes, in addition to against object
> instances. When looking up a property, a search will be done
> starting at the base class, then each subclass in turn, and
> finally against the object. Names are enforced to be unique
> across the parent classes for sanity.
>
> This only currently supports simple scalar properties where
> the actual property value storage is managed by the object
> instance. The object child and object link properties use
> implicit storage in the ObjectProperty struct's 'opaque'
> field, so we can't allow those against the class. Solving
> this is doable, but more work, so is left as an exercise
> for the future.
>
> The first patch adds the neccessary QOM functionality. The
> following 6 patches then illustrate the fairly trivial
> conversions of a bunch of objects.
>
> The eventual goal ought to be that everything is registered
> against the class, leaving only the (hopefully few) cases
> where per-instance properties are truely needed unconverted.
>
> This series doesn't attempt to implement introspection
> either - this would require a new QMP command such as
> 'qom-list-type-props' to query the properties against
> classes.
>
> I'm not really planning to spend much more time on this
> myself. I'm just using this series to illustrate how I
> believe the introspection problem in QOM can be fairly
> easily addressed. Hopefully this will stimulate some
> discussion & interest in doing the full job....
>
> Daniel P. Berrange (7):
> qom: allow properties to be registered against classes
> hostmem: register properties against the class instead of object
> rng: register properties against the class instead of object
> tpm: register properties against the class instead of object
> cpu: avoid using object instance state in property getter
> x86-cpu: register properties against the class instead of object
> machine: register properties against the class instead of object
>
> backends/hostmem-file.c | 26 +++---
> backends/hostmem.c | 41 ++++-----
> backends/rng-egd.c | 12 +--
> backends/rng-random.c | 10 +--
> backends/rng.c | 14 ++-
> backends/tpm.c | 12 +--
> hw/core/machine.c | 193 +++++++++++++++++++--------------------
> include/qom/object.h | 44 +++++++++
> qom/object.c | 233 ++++++++++++++++++++++++++++++++++++++++++++++--
> target-i386/cpu.c | 88 +++++++++++-------
> 10 files changed, 476 insertions(+), 197 deletions(-)
>
> --
> 2.4.3
>
Regards,
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:[~2015-09-02 9:05 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-26 12:03 [Qemu-devel] [PATCH RFC 0/7] Making QOM introspectable Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 1/7] qom: allow properties to be registered against classes Daniel P. Berrange
2015-09-02 16:18 ` Andreas Färber
2015-09-03 15:49 ` Daniel P. Berrange
2015-09-03 16:37 ` Markus Armbruster
2015-09-03 16:41 ` Andreas Färber
2015-09-03 17:02 ` Markus Armbruster
2015-09-03 17:09 ` Daniel P. Berrange
2015-09-03 17:21 ` Andreas Färber
2015-09-03 17:25 ` Daniel P. Berrange
2015-09-04 6:56 ` Markus Armbruster
2015-09-07 12:54 ` Paolo Bonzini
2015-09-11 16:09 ` Daniel P. Berrange
2015-09-04 21:38 ` Marc-André Lureau
2015-09-07 8:46 ` Daniel P. Berrange
2015-09-07 13:11 ` Andreas Färber
2015-09-07 13:17 ` Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 2/7] hostmem: register properties against the class instead of object Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 3/7] rng: " Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 4/7] tpm: " Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 5/7] cpu: avoid using object instance state in property getter Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 6/7] x86-cpu: register properties against the class instead of object Daniel P. Berrange
2015-08-26 12:03 ` [Qemu-devel] [PATCH RFC 7/7] machine: " Daniel P. Berrange
2015-09-02 9:05 ` Daniel P. Berrange [this message]
2015-09-02 11:14 ` [Qemu-devel] [PATCH RFC 0/7] Making QOM introspectable Markus Armbruster
2015-09-02 16:16 ` Andreas Färber
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=20150902090539.GB22094@redhat.com \
--to=berrange@redhat.com \
--cc=afaerber@suse.de \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.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).