On 2/4/25 16:08, Philippe Mathieu-Daudé wrote:
Hi Paolo,

On 3/2/25 12:41, Paolo Bonzini wrote:
Currently, the instance_post_init calls are performed from the leaf
class and all the way up to Object.  This is incorrect because the
leaf class cannot observe property values applied by the superclasses;
for example, a compat property will be set on a device *after*
the class's post_init callback has run.

In particular this makes it impossible for implementations of
accel_cpu_instance_init() to operate based on the actual values of
the properties, though it seems that cxl_dsp_instance_post_init and
rp_instance_post_init might have similar issues.

I'm not opposed to this change as I had a similar issue there few weeks
ago, but I feel we are changing one problem by another. IIRC some class
post_init() handlers check the instance correctly did something.

There are five - one does not have any subclass and the other four are all mentioned in the commit message:

- x86 and risc-v use accel_cpu_instance_init(), which is where I found the bug

- the other two seem broken too

   * @instance_post_init: This function is called to finish
   *                      initialization of an object, after
   *                      all @instance_init functions were
   *                      called.

Yeah I didn't adjust it because it now is simply the same order as instance_init (and the opposite as instance_finalize). I can change it to "after all @instance_init functions were called, as well as the @instance_post_init functions for the parent classes".

Paolo


Reply via email to