qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 03/55] qdev: New qdev_new(), qdev_realize(), etc.


From: Markus Armbruster
Subject: Re: [PATCH 03/55] qdev: New qdev_new(), qdev_realize(), etc.
Date: Mon, 25 May 2020 08:30:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Paolo Bonzini <address@hidden> writes:

> On 20/05/20 16:42, Markus Armbruster wrote:
>> If something goes
>> wrong there, we execute
>> 
>>     fail:
>>         error_propagate(errp, local_err);
>>         if (unattached_parent) {
>>             /*
>>              * Beware, this doesn't just revert
>>              * object_property_add_child(), it also runs bus_remove()!
>>              */
>>             object_unparent(OBJECT(dev));
>>             unattached_count--;
>>         }
>> 
>> and bus_remove() drops the reference count to zero.
>
> Whoa whoa...  I didn't expect this from a failure to realize.

Me neither.  But by the time I understood what's going on here, my
appetite for big, structural QOM changes was pretty much gone, so I
merely added the "Beware" comment.

> I think we should move the whole /machine/unattached dance into
> qdev_realize, and just assert that a device being realized already has a
> parent.  Then the ref/unref _will_ be unnecessary.  In the meanwhile, I
> agree to either keep it or move it inside device_set_realized.

Could be done on top.  I might try for v2, if I can find the time.




reply via email to

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