All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Markus Armbruster" <armbru@redhat.com>,
	qemu-devel@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
	"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] Object instantiation vs. device realization: what to do when?
Date: Mon, 18 Feb 2019 17:01:16 +0100	[thread overview]
Message-ID: <878syd84s3.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <8de162fa-0be0-6d40-0127-4dea571014f3@redhat.com> (Paolo Bonzini's message of "Thu, 14 Feb 2019 17:58:06 +0100")

Paolo Bonzini <pbonzini@redhat.com> writes:

> On 14/02/19 17:21, Markus Armbruster wrote:
>>  * As an interim step, the #DeviceState:realized property can also be
>>  * set with qdev_init_nofail().
>>  * In the future, devices will propagate this state change to their children
>>  * and along busses they expose.
>> 
>> This sentence is five years old.  Any progress?  If not, any intentions
>> to make progress?
>
> Good news, it's done!  What we still don't do is removing
> qdev_init_nofail and realizing the whole machine in one fell swoop.
>
> Bad news, it's been done for five years:
>
>     commit 5c21ce77d7e5643089ceec556c0408445d017f32
>     Author: Bandan Das <bsd@redhat.com>
>     Date:   Wed Mar 12 21:02:12 2014 +0100
>
>     qdev: Realize buses on device realization
>
>     Integrate (un)realization of child buses with
>     realization/unrealization
>     of the device hosting them. Code in device_unparent() is reordered
>     for unrealization of buses to work as part of device unrealization.
>
>     That way no changes need to be made to bus instantiation.
>
>     Signed-off-by: Bandan Das <bsd@redhat.com>
>     Signed-off-by: Andreas Färber <afaerber@suse.de>
>
> so I don't expect that the next step will ever happen...

Sigh...  can you suggest an update to the comment then?

Out of curiosity, what would have to be done?  Any particular problems
other than the practical problem of manhandling 300+ qdev_init_nofail()
calls?

>>  * The point in time will be deferred to machine creation, so that values
>>  * set in @realize will not be introspectable beforehand. Therefore devices
>>  * must not create children during @realize; they should initialize them via
>>  * object_initialize() in their own #TypeInfo.instance_init and forward the
>>  * realization events appropriately.
>> 
>> This is mostly greek to me.  Pity the developer who knows less about
>> qdev than I do.
>
> The first part refers to what virtio_instance_init_common does:
>
>     object_initialize(vdev, vdev_size, vdev_name);
>     object_property_add_child(proxy_obj, "virtio-backend", OBJECT(vdev),
>                               NULL);
>     object_unref(OBJECT(vdev));
>
> The second part doesn't apply to virtio because it has a bus (so the
> code from the above commit handles recursive realization automatically).
>
> hw/sd/milkymist-memcard.c has an example of this:
>
>     object_property_set_bool(OBJECT(carddev), true, "realized", &err);
>
> but it should create the device in milkymist_memcard_init rather than
> milkymist_memcard_realize, in order to obey the directives of the sacred
> book of QEMU.

I see.

Thanks!

  reply	other threads:[~2019-02-18 16:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14 16:21 [Qemu-devel] Object instantiation vs. device realization: what to do when? Markus Armbruster
2019-02-14 16:33 ` Peter Maydell
2019-02-15  7:03   ` Thomas Huth
2019-02-18 19:08   ` Markus Armbruster
2019-02-14 16:58 ` Paolo Bonzini
2019-02-18 16:01   ` Markus Armbruster [this message]
2019-02-18 16:38     ` Paolo Bonzini
2019-02-19 10:38   ` Igor Mammedov

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=878syd84s3.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=afaerber@suse.de \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.