Paolo Bonzini <pbonz...@redhat.com> writes: > On 14/03/20 14:19, Mark Cave-Ayland wrote: >>> Observe that mac_via_init() has obvious side effects. In particular, it >>> creates two devices that are then visible in "info qtree", and that's >>> caught by device-introspect-test. >>> >>> I believe these things need to be done in .realize(). > > That is not a problem; the devices should be removed when the device is > finalized. In theory the steps would be: > > - the child properties are removed > > - this causes unparent to be called on the child devices > > - this causes the child devices to be unrealized > > - this causes the child devices to remove themselves from their bus (and > from "info qtree") > > - this causes the refcount to drop to zero and the devices to be > finalized themselves. > > The question is why they are not, i.e. where does the above reasoning break.
I don't know. But let's for the sake of the argument assume this actually worked. Asking for help in the monitor then *still* has side effects visible in the time span between .instance_init() and finalization. Why is that harmless? > So, sysbus_init_child_obj is fine.