qemu-devel
[Top][All Lists]
Advanced

[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: Tue, 21 Jul 2020 08:00:09 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Eduardo Habkost <ehabkost@redhat.com> writes:

> On Mon, Jul 20, 2020 at 09:38:24AM +0200, Markus Armbruster wrote:
>> Eduardo Habkost <ehabkost@redhat.com> writes:
>> 
>> > On Fri, Jul 17, 2020 at 07:10:57AM +0200, Markus Armbruster wrote:
>> >> Eduardo Habkost <ehabkost@redhat.com> writes:
>> >> 
>> >> > I'd also note that the use of "parent" in the code is also
>> >> > ambiguous.  It can mean:
>> >> >
>> >> > * QOM parent type, i.e. TypeInfo.parent.  Related fields:
>> >> >   * parent_class members of class structs
>> >> >   * parent_obj members of object structs
>> >> 
>> >> I hate the use of "parent" and "child" for a super- / subtype relation.
>> >> 
>> >> Correcting the terminology there would be short term pain for long term
>> >> gain.  Worthwhile?
>> >
>> > I don't know.  It looks like the terminology came from GObject.
>> >
>> >> 
>> >> > * QOM composition tree parent object, i.e. Object::parent
>> >> > * qdev device parent bus, i.e. DeviceState::parent_bus
>> >> > * parent device of of qdev bus, i.e. BusState::parent
>> >> 
>> >> These are tree relations.  Use of "parent" and "child" is perfectly
>> >> fine.
>> >
>> > The terms are fine but still ambiguous, as devices belong to two
>> > separate trees at the same time (the QOM composition tree, and
>> > the qdev tree).
>> >
>> > I never understood why we have two separate independent object
>> > trees.
>> 
>> When we rebased qdev onto QOM, we left the qdev tree alone, we did not
>> embed it into the QOM composition tree.
>> 
>> The qdev tree edge from bus to device providing the bus is commonly
>> mirrored in the QOM composition tree: both are QOM objects, and the bus
>> is commonly a QOM composition child of the device providing it.  I hedge
>> with "commonly", because nothing enforces this as far as I know.
>> 
>> We do not mirror the edge from device to the bus it's plugged into.  I
>> believe we could have.  I guess we could mirror it as a link even now
>> (but note links are not children).
>
> They are already mirrored as links, and guess what's the link
> name: "child[...]".

You're right, except for the link name: it's parent_bus.

So the qtree is actually embedded in the QOM graph: it's the device and
bus nodes connected by the child edges from device to provided bus and
parent_bus link egdes from device to bus it's plugged into, except the
latter are backward rather than forward.

Strange: even bus-less devices have this parent_bus link, and its value
is "" (the underlying pointer is null, and null gets mapped to "", for
better or worse).

Should the property be limited to devices that actually have a parent
bus?

>> I don't know why the rebase of qdev onto QOM was done that way.  Perhaps
>> Paolo remembers.
>
> I'm guessing this is because QOM parent/child relationships
> represent ownership, while there's no ownership relationship
> between buses and devices.

Plausible.  I guess the separate qtree was kept even though it's
redundant with the QOM graph because switching its users to the QOM
graph would be work.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]