From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Daniel P. Berrange" <berrange@redhat.com>,
qemu-devel@nongnu.org, Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: Infinite loop in bus_unparent(), qdev bug or qdev misuse?
Date: Tue, 5 May 2020 18:26:57 +0200 [thread overview]
Message-ID: <a4df3ba3-4759-56ac-68f8-f75eea93e27e@redhat.com> (raw)
In-Reply-To: <875zda8j3m.fsf@dusky.pond.sub.org>
On 05/05/20 18:03, Markus Armbruster wrote:
>> That's a good one, and especially a safe one, since it matches
>> qdev_device_add. It has the disadvantage of having to touch all
>> qdev_create() calls.
>
> Also, it moves onboard devices from /machine/unattached/ to
> /machine/peripheral-anon/.
Uh indeed. No that's too ugly.
>> Even better however would be to move the bus argument (and thus
>> qdev_set_parent_bus) to qdev_init, and likewise in qdev_device_add move
>> qdev_set_id after qemu_opt_foreach. I looked at the property setters
>> and couldn't find anything suspicious (somewhat to my surprise), but I
>> haven't honestly tried.
>
> Thus, we satisfy bus_unparent()'s precondition "bus children have a QOM
> parent"[*] by moving "add to parent bus" next to the place where we
> ensure "has QOM parent" by putting orphans under /machine/unattached/.
> Makes sense.
>
> If we add to the bus first, the precondition ceases to hold until we
> realize. Ugly, but harmless unless we manage to actually call the
> function then.
Shouldn't be a big deal, since users should call either qdev_set_id or
object_property_add_child before device_set_realized.
> I suspect we can't realize first, because the realize method may want to
> use the parent bus.
Right.
Moving the bus to qdev_init would be quite large but hopefully scriptable.
Paolo
next prev parent reply other threads:[~2020-05-05 16:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-04 14:38 Infinite loop in bus_unparent(), qdev bug or qdev misuse? Markus Armbruster
2020-05-04 14:58 ` Paolo Bonzini
2020-05-04 15:25 ` Peter Maydell
2020-05-05 16:03 ` Markus Armbruster
2020-05-05 16:26 ` Paolo Bonzini [this message]
2020-05-06 6:39 ` Markus Armbruster
2020-05-12 15:58 ` Markus Armbruster
2020-05-12 18:43 ` Paolo Bonzini
2020-05-05 8:23 ` no-reply
2020-05-05 8:24 ` no-reply
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=a4df3ba3-4759-56ac-68f8-f75eea93e27e@redhat.com \
--to=pbonzini@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=ehabkost@redhat.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).