qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: lvivier@redhat.com, thuth@redhat.com, pkrempa@redhat.com,
	berrange@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org,
	libvir-list@redhat.com, armbru@redhat.com, jasowang@redhat.com,
	qemu-devel@nongnu.org, mreitz@redhat.com, kraxel@redhat.com
Subject: Re: [PATCH 00/18] qapi/qom: QAPIfy object-add
Date: Tue, 1 Dec 2020 18:16:14 +0100	[thread overview]
Message-ID: <db61f61a-1ffa-6185-10dc-3109ff111a35@redhat.com> (raw)
In-Reply-To: <20201201162042.GB6264@merkur.fritz.box>

On 01/12/20 17:20, Kevin Wolf wrote:
> Am 30.11.2020 um 20:35 hat Paolo Bonzini geschrieben:
>> For devices it's just the practical issue that there are too many to have
>> something like this series.  For machine types the main issue is that the
>> version-specific machine types would have to be defined in one more place.
>
> Sure, the number of devices means that we can't convert all of them at
> once. And we don't need to, we can make the change incrementally.

There's also the question that most devices are not present in all 
binaries.  So QAPI introspection would tell you what properties are 
supported but not what devices are.  Also the marshaling/unmarshaling 
code for hundreds of devices would bloat the QEMU executables 
unnecessarily (it'd all be reachable from visit_DeviceOptions so it'd 
not be possible to compile it out, even with LTO).

Plus the above issue with machine types.

>>>> The single struct doesn't bother me _too much_ actually.  What bothers me is
>>>> that it won't be a single source of all QOM objects, only those that happen
>>>> to be created by object-add.
>>>
>>> But isn't it only natural that a list of these objects will exist in
>>> some way, implicitly or explicitly? object-add must somehow decide which
>>> object types it allows the user to create.
>>
>> There's already one, it's objects that implement user creatable.  I don't
>> think having it as a QAPI enum (or discriminator) is worthwhile, and it's
>> one more thing that can go out of sync between the QAPI schema and the C
>> code.
> 
> Well, we all know that this series duplicates things. But at the same
> time, we also know that this isn't going to be the final state.
> 
> Once QAPI learns about QOM inheritance (which it has to if it should
> generate the boilerplate), it will know which objects are user creatable
> without a an explicitly defined separate enum.
> 
> I think it will still need to have the enum internally, but as long as
> it's automatically generated, that shouldn't be a big deal.

Right, I don't want to have the final state now but I'd like to have a 
rough idea of the plan:

1) whether to generate _all_ boilerplate or only properties

2) whether we want to introduce a separation between configuration 
schema and run-time state

3) in the latter case, whether properties will survive at all---iothread 
and throttle-groups don't really need them even if they're writable 
after creation.

These questions have a substantial effect on how to handle this series. 
  Without answers to this questions I cannot understand the long term 
and its interaction with other long term plans for QOM.

>>> A modified QOM might be the right solution, though. I would like to
>>> bring QAPI and QOM together because most of these weaknesses are
>>> strengths of QAPI.
>>
>> I agree wholeheartedly.  But your series goes to the opposite excess.
>> Eduardo is doing work in QOM to mitigate the issues you point out, and you
>> have to meet in the middle with him.  Starting with the user-visible parts
>> focuses on the irrelevant parts.
> 
> QAPI is first and foremost about user-visible parts, and in fact most of
> the problems I listed are about external interfaces.

Yes, but QAPI is also about interfacing with existing code.  Also, QAPI 
does not generate only structs, it also generate C function prototypes. 
I'm not sure whether a QOM object's more similar to the struct case 
(what you do here) or to the QMP command case:

- there's a 1:1 correspondence between ObjectOptions cases and 
ucc->complete implementations

- there's a registry of object types just like there's one for QMP commands.

So another possibility could be that the QAPI generator essentially 
generated the user_creatable_add_type function that called out to 
user-provided functions qom_scsi_pr_helper_complete, 
qom_throttle_group_complete, etc.  The arguments to those functions 
would be the configuration.  That is a very interesting prospect (though 
one that would require changes to the QAPI code generator).

> BlockdevOptions is about external interfaces, not about
> implementation details. Same thing as QOM properties are external
> interfaces, not implementation details. There may be fields in the
> internal state that correspond 1:1 to the externally visible QAPI
> type/QOM property, but it's not necessarily the case.

Right.  It may well be that we decide that, as a result of this series, 
QOM's property interface is declared essentially a failed experiment.  I 
wouldn't be surprised, and that's why I want to understand better where 
we want to go.

For example, Eduardo is focusing specifically on external interfaces 
that correspond 1:1 to the internal implementation.  If we decide that 
non-1:1-mappings and checks on mandatory properties are an important 
part of QOM, that may make large parts of his work moot.  If we decide 
that most QOM objects need no properties at all, then we don't want to 
move more qdev-specific stuff from to QOM.

> QAPI is already here and it's going to stay. QOM doesn't have to
> duplicate input validation that existing code can already perform.
> 
> I'm not sure which complexity you think I'm introducing: QAPI is already
> there. I'm adding the schema, which you agree is valuable documentation,
> so we want to have it either case. The actual change to QOM that we have
> in this series is this:

The complexity is that properties used to be split in two places, and 
now they're split in three places.

It may very well be that this is a good first step to at least have 
classes described in the QAPI schema.  But since _in the short term_ 
there are things that the series makes worse (and has a risk of bringing 
things out of sync), I'd like to understand the long term plan and 
ensure that the QAPI maintainers are on board with it.

Can you at least add a comment to all UserCreatable classes that says 
"if you add a property, remember to modify ... as well in the QAPI schema"?

>> Are there any validation bugs that you're fixing?  Is that
>> something that cannot be fixed elsewhere, or are you papering over bad QOM
>> coding?  (Again, I'm not debating that QOM properties are hard to write
>> correctly).
> 
> Yes, I found bugs that the QAPI schema would have prevented. They were
> generally about not checking whether mandatory propertes are actually
> set.

Okay, I found your series at 
https://patchew.org/QEMU/20201130105615.21799-1-kwolf@redhat.com/ too, 
good to know.

So that's another useful thing that can be chalked to this series at 
least if -object and object_add are converted (and also, another thing 
against QOM properties and 1:1 mappings between configuration schema and 
run-time state).

Paolo



  reply	other threads:[~2020-12-01 17:17 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 12:25 [PATCH 00/18] qapi/qom: QAPIfy object-add Kevin Wolf
2020-11-30 12:25 ` [PATCH 01/18] qapi/qom: Add ObjectOptions for iothread Kevin Wolf
2020-11-30 15:00   ` Paolo Bonzini
2020-11-30 15:54     ` Kevin Wolf
2020-11-30 12:25 ` [PATCH 02/18] qapi/qom: Add ObjectOptions for authz-* Kevin Wolf
2020-11-30 12:25 ` [PATCH 03/18] qapi/qom: Add ObjectOptions for cryptodev-* Kevin Wolf
2020-11-30 12:25 ` [PATCH 04/18] qapi/qom: Add ObjectOptions for dbus-vmstate Kevin Wolf
2020-11-30 12:25 ` [PATCH 05/18] qapi/qom: Add ObjectOptions for memory-backend-* Kevin Wolf
2020-11-30 12:25 ` [PATCH 06/18] qapi/qom: Add ObjectOptions for rng-*, deprecate 'opened' Kevin Wolf
2020-11-30 12:25 ` [PATCH 07/18] qapi/qom: Add ObjectOptions for throttle-group Kevin Wolf
2020-11-30 12:25 ` [PATCH 08/18] qapi/qom: Add ObjectOptions for secret*, deprecate 'loaded' Kevin Wolf
2020-11-30 12:25 ` [PATCH 09/18] qapi/qom: Add ObjectOptions for tls-*, " Kevin Wolf
2020-11-30 12:25 ` [PATCH 10/18] qapi/qom: Add ObjectOptions for can-* Kevin Wolf
2020-11-30 12:25 ` [PATCH 11/18] qapi/qom: Add ObjectOptions for colo-compare Kevin Wolf
2020-11-30 12:25 ` [PATCH 12/18] qapi/qom: Add ObjectOptions for filter-* Kevin Wolf
2020-11-30 12:25 ` [PATCH 13/18] qapi/qom: Add ObjectOptions for pr-manager-helper Kevin Wolf
2020-11-30 12:25 ` [PATCH 14/18] qapi/qom: Add ObjectOptions for sev-guest Kevin Wolf
2020-11-30 12:25 ` [PATCH 15/18] qapi/qom: Add ObjectOptions for input-* Kevin Wolf
2020-11-30 12:25 ` [PATCH 16/18] tests: Drop 'props' from object-add calls Kevin Wolf
2020-11-30 12:25 ` [PATCH 17/18] qapi/qom: Drop deprecated 'props' from object-add Kevin Wolf
2020-11-30 12:25 ` [PATCH 18/18] qapi/qom: QAPIfy object-add Kevin Wolf
2020-11-30 14:58 ` [PATCH 00/18] " Paolo Bonzini
2020-11-30 15:30   ` Daniel P. Berrangé
2020-11-30 16:13     ` Kevin Wolf
2020-11-30 16:52       ` Daniel P. Berrangé
2020-11-30 16:32     ` Paolo Bonzini
2020-12-01  8:36       ` Markus Armbruster
2020-11-30 15:46   ` Kevin Wolf
2020-11-30 16:57     ` Paolo Bonzini
2020-11-30 18:10       ` Kevin Wolf
2020-11-30 19:35         ` Paolo Bonzini
2020-12-01 16:20           ` Kevin Wolf
2020-12-01 17:16             ` Paolo Bonzini [this message]
2020-12-01 18:28               ` Eduardo Habkost
2020-12-01 19:35               ` Kevin Wolf
2020-12-01 21:23                 ` Paolo Bonzini
2020-12-01 22:08                   ` Eduardo Habkost
2020-12-02  9:30                     ` Paolo Bonzini
2020-12-02 10:38                       ` Kevin Wolf
2020-12-02 12:30                         ` Paolo Bonzini
2020-12-02 12:51                       ` Eduardo Habkost
2020-12-02 13:26                         ` Paolo Bonzini
2020-12-02 13:54                           ` Eduardo Habkost
2020-12-02 15:17                             ` Kevin Wolf
2020-12-02 16:05                               ` Eduardo Habkost
2020-12-02 17:35                                 ` Kevin Wolf
2020-12-02 19:45                                   ` Eduardo Habkost
2020-12-03  6:46                                   ` Gerd Hoffmann
2020-12-03 14:58                                     ` Eduardo Habkost
2020-12-03 11:11                                   ` Paolo Bonzini
2020-12-03 15:15                                     ` Kevin Wolf
2020-12-03 16:50                                       ` Paolo Bonzini
2020-12-03 17:43                                         ` Kevin Wolf
2020-12-03 18:01                                           ` Paolo Bonzini
2020-12-03 17:52                                         ` Eduardo Habkost
2020-12-03 18:10                                           ` Paolo Bonzini
2020-12-03 18:19                                             ` Eduardo Habkost
2020-12-02 10:27                   ` Kevin Wolf
2020-12-02 12:41                     ` Paolo Bonzini
2020-11-30 18:58 ` Peter Krempa

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=db61f61a-1ffa-6185-10dc-3109ff111a35@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-block@nongnu.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).