From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
qemu-devel@nongnu.org, "Pratik Parvati" <pratikp@vayavyalabs.com>
Subject: Re: sysbus_create_simple Vs qdev_create
Date: Mon, 27 Jul 2020 16:29:43 +0200 [thread overview]
Message-ID: <50e31ece-215c-a632-e5a2-86ae7ab3abab@redhat.com> (raw)
In-Reply-To: <87v9ihbe6u.fsf@dusky.pond.sub.org>
On 21/07/20 08:00, Markus Armbruster wrote:
>> 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.
There's links in both directions.
> 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?
Yes, it could be done.
>>> 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.
No, it was kept because:
1) the QOM graph wasn't embedding the qdev tree at the time. That was
added later.
2) 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. Children are usually embedded directly in a struct, for
example. Instead, peripherals are not created by the bus, they are
created by the device_add monitor command and the like.
3) accessing the QOM graph is slow (it requires hash table lookups,
string comparisons and all that), so the pointers that cache the
parent-child links are needed for use in hot paths.
next prev parent reply other threads:[~2020-07-27 14:30 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 [this message]
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
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=50e31ece-215c-a632-e5a2-86ae7ab3abab@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).