On Thu, Mar 10, 2022 at 01:45:31PM +0000, Peter Maydell wrote:
> The other theory I had was "maybe if you put an MR into another
> MR and they both have the same owner then don't bump the refcount"
> but I haven't thought that through at all.

Maybe it'll work, it just sounds a bit more tricky.

> 
> > That means, perhaps in object_init_with_type() we should make sure the
> > object refcount==1 after the ->instance_init() call?
> 
> That's probably a useful invariant, which I bet we don't
> currently get right for every object :-)

Yeah same feeling.. :)

We could have looped over each device and try creating them and fix one by
one?  But I think that doesn't cover all the cases, because instance_init()
could have some sub-regions conditionally added depending on the device
parameters and so on, so they may not be covered by the default values
being tested with.

-- 
Peter Xu


Reply via email to