On 10/11/20 12:14, Mark Cave-Ayland wrote:
There are 2 possible solutions here: 1) ensure QOM objects that add
address spaces during instance init have a corresponding instance
finalize function to remove them or 2) move the creation of address
spaces from instance init to realize.
Does anyone have any arguments for which solution is preferred?
I slightly prefer (1) because there could be cases where you also create
subdevices using that address space, and in order to set properties of
subdevices before realize, you would have to create the subdevices in
instance_init as well.
Thanks,
Paolo
As part of this work I hacked up an address_space_count() function in
memory.c that returns the size of the address_spaces QTAILQ and added a
printf() to display the value during instance init and finalize which
demonstrates the problem nicely. This means it should be possible to add
a similar to check to device-introspect-test in future to prevent
similar errors from happening again.