[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sysbus_create_simple Vs qdev_create
From: |
Markus Armbruster |
Subject: |
Re: sysbus_create_simple Vs qdev_create |
Date: |
Wed, 29 Jul 2020 09:46:58 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Paolo Bonzini <pbonzini@redhat.com> writes:
> On 28/07/20 09:19, Markus Armbruster wrote:
>>> the composition tree generally mirrors things that are born and die
>>> at the same time, and creating children is generally reserved to the
>>> object itself.
>>
>> Yes. Notable exceptions: containers /machine/peripheral,
>> /machine/peripheral-anon, /machine/unattached.
>
> And /objects too. Apart from /machine/unattached, all these dynamic
> objects are created by the monitor or the command line.
>
>>> Children are usually embedded directly in a struct, for
>>> example.
>>
>> We sometimes use object_new() + object_property_add_child() instead.
>> Extra indirection. I guess we'd be better off without the extra
>> indirection most of the time. Implementation detail.
>>
>> We sometimes use object_new() without object_property_add_child(), and
>> have qdev_realize() put the device in the /machine/unattached orphanage.
>> Meh. I guess the orphanage feature exists to make conversion to QOM
>> slightly easier. Could we ban its use for new boards at least?
>
> Banning perhaps is too strong, but yes /machine/unattached is an
> anti-pattern.
A ban backed by an automated test will be effective. Writing "but don't
do that" on the list not so much.
The automated test could have a list of exceptions. Adding a new
instance of the anti-pattern then isn't impossible (you can update the
list of exceptions), but clearly visible to patch submitter and
reviewers.
[...]
- Re: sysbus_create_simple Vs qdev_create, (continued)
- Re: sysbus_create_simple Vs qdev_create, Markus Armbruster, 2020/07/28
- Re: sysbus_create_simple Vs qdev_create, Paolo Bonzini, 2020/07/28
- Re: sysbus_create_simple Vs qdev_create, Eduardo Habkost, 2020/07/28
- Re: sysbus_create_simple Vs qdev_create, Paolo Bonzini, 2020/07/29
- Re: sysbus_create_simple Vs qdev_create, Markus Armbruster, 2020/07/29
- Re: sysbus_create_simple Vs qdev_create, Paolo Bonzini, 2020/07/29
- Re: sysbus_create_simple Vs qdev_create, Eduardo Habkost, 2020/07/29
- Re: sysbus_create_simple Vs qdev_create, Paolo Bonzini, 2020/07/29
- Re: sysbus_create_simple Vs qdev_create, Eduardo Habkost, 2020/07/29
- Re: sysbus_create_simple Vs qdev_create, Paolo Bonzini, 2020/07/29
- Re: sysbus_create_simple Vs qdev_create,
Markus Armbruster <=