From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Pratik Parvati" <pratikp@vayavyalabs.com>,
qemu-devel@nongnu.org
Subject: Re: sysbus_create_simple Vs qdev_create
Date: Wed, 29 Jul 2020 18:08:17 +0200 [thread overview]
Message-ID: <6ee49ad2-8b6b-cb6f-c3c9-b440631cfc75@redhat.com> (raw)
In-Reply-To: <87zh7i5uj5.fsf@dusky.pond.sub.org>
On 29/07/20 15:18, Markus Armbruster wrote:
>> Even code riddled by backwards-compatibility special cases, such as
>> -accel and -machine, can share code between themselves and -object to
>> some extent; this is thanks to functions such as object_property_parse,
>> whose parsing is deferred to visitors and hence to QAPI.
>
> QOM relies on QAPI visitors to access properties. There is no
> integration with the QAPI schema.
Indeed it doesn't use _all_ of the QAPI goodies. It does use visitors
and it's a major feature of QOM.
> Going through a visitor enables property access from QMP, HMP and CLI.
>
> Access from C *also* goes through a visitor. We typically go from C
> type to QObject and back. Comically inefficient (which hardly matters),
> verbose to use and somewhat hard to understand (which does).
It's verbose in the getters/setters, but we have wrappers such as
object_property_set_str, object_property_set_bool etc. that do not make
it too hard to understand.
> Compare to what QOM replaced: qdev. Properties are a layer on top of
> ordinary C. From C, you can either use the C layer (struct members,
> basically), or the property layer for C (functions taking C types, no
> conversion to string and back under the hood), or the "text" layer
> (parse from text / format to text).
>
> My point is not that qdev was great and QOM is terrible. There are
> reasons we replaced qdev with QOM. My point is QOM doesn't *have* to be
> the way it is. It is the way it is because we made it so.
QOM didn't only replace qdev: it also removed the need to have a command
line option du jour for any new concept, e.g. all the TLS stuff, RNG
backends, RAM backends, etc.
It didn't succeed (at all) in deprecating chardev/netdev/device etc.,
but this is a very underappreciated part of QOM, and this is why I think
it's appropriate to say QOM is "C with classes and CLI/RPC
serialization", as opposed for example to "C with classes and multi
programming language interface" that is GObject.
> I've long had the nagging feeling that if we had special-cased
> containers, children and links, we could have made a QOM that was easier
> to reason about, and much easier to integrate with a QAPI schema.
That's at least plausible. But I have a nagging feeling that it would
only cover 99% of what we're doing with QOM. :)
Paolo
next prev parent reply other threads:[~2020-07-29 16:09 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-14 16:09 sysbus_create_simple Vs qdev_create Pratik Parvati
2020-07-14 16:17 ` Pratik Parvati
2020-07-14 17:02 ` Philippe Mathieu-Daudé
2020-07-15 8:32 ` Markus Armbruster
2020-07-15 13:58 ` Pratik Parvati
2020-07-15 14:11 ` Peter Maydell
2020-07-15 14:37 ` Markus Armbruster
2020-07-16 22:21 ` Eduardo Habkost
2020-07-17 5:10 ` Markus Armbruster
2020-07-17 16:23 ` Eduardo Habkost
2020-07-17 16:30 ` Daniel P. Berrangé
2020-07-17 17:15 ` Peter Maydell
2020-07-20 7:39 ` Markus Armbruster
2020-07-20 7:38 ` Markus Armbruster
2020-07-20 15:59 ` Eduardo Habkost
2020-07-21 6:00 ` Markus Armbruster
2020-07-27 14:29 ` Paolo Bonzini
2020-07-28 7:19 ` Markus Armbruster
2020-07-28 17:38 ` Paolo Bonzini
2020-07-28 22:47 ` Eduardo Habkost
2020-07-29 9:54 ` Paolo Bonzini
2020-07-29 13:18 ` Markus Armbruster
2020-07-29 16:08 ` Paolo Bonzini [this message]
2020-07-30 10:03 ` Markus Armbruster
2020-07-30 11:09 ` Paolo Bonzini
2020-07-30 12:36 ` Markus Armbruster
2020-07-30 13:38 ` Paolo Bonzini
2020-07-29 14:32 ` Eduardo Habkost
2020-07-29 16:01 ` Paolo Bonzini
2020-07-29 16:08 ` Eduardo Habkost
2020-07-29 16:14 ` Paolo Bonzini
2020-07-29 7:46 ` Markus Armbruster
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=6ee49ad2-8b6b-cb6f-c3c9-b440631cfc75@redhat.com \
--to=pbonzini@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=ehabkost@redhat.com \
--cc=philmd@redhat.com \
--cc=pratikp@vayavyalabs.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).