On Fri, Oct 14, 2016 at 04:12:20PM +0200, Laurent Vivier wrote: > > > On 14/10/2016 15:48, Eduardo Habkost wrote: > > On Fri, Oct 14, 2016 at 03:34:17PM +0200, Laurent Vivier wrote: > >> On 14/10/2016 15:33, Eduardo Habkost wrote: > >>> On Thu, Oct 13, 2016 at 06:24:44PM +0200, Laurent Vivier wrote: > >>>> We have now the cpu_exec_realize() in realize, > >>>> so the init part must be in init. > >>>> > >>>> I've removed the cannot_destroy_with_object_finalize_yet field as > >>>> unsafe references have been moved to cpu_exec_realize(). > >>>> (tested with QOM command provided by commit 4c315c27 with > >>>> "athlon-x86_64-cpu") > >>>> > >>>> CC: Eduardo Habkost <ehabk...@redhat.com> > >>>> Signed-off-by: Laurent Vivier <lviv...@redhat.com> > >>> > >>> Resending the question I asked in my reply to v1: > >>> > >>> Instead of creating requiring each subclass to manually call > >>> cpu_exec_init()) on instance_init, why don't we move parts of > >>> cpu_exec_init()/cpu_exec_realize() code to cpu_common_initfn()? > >>> (TYPE_CPU's instance_init) > >>> > >>> (And if there's any code that needs to be run after the > >>> subclasses instance_init functions, we can just add a > >>> instance_post_init function to TYPE_CPU). > >>> > >> > >> It's done in PATCH 20/20. > >> > >> Is that what you want? > > > > Yes (except that I would have inlined the the cpu_exec_init() > > code inside cpu_common_init()). > > > > I think I expected this to be done in a single step, that > > wouldn't require touching code for all architectures three times. > > Something like: > > Well, I've added several steps to help to review and break nothing.
To me, it made review harder. Architecture maintainers have to review 3 different patches that touch their code, instead of a single one. Anyway, I would still give my Reviewed-by line for the i386 part, if you believe it's better to do it this way. > > > 1) Move cpu->as, cpu->num_ases, cpu->thread_id, cpu->memory > > initialization, and "memory" property registration from > > cpu_exec_init() to cpu_common_init() (no architecture code > > touched). > > system_memory (for the "memory" property) is declared as static in > exec.c, so we can't move it to cpu_common_init(). In this case we can't inline it, that's true. But it still doesn't require touching each architecture 3 times (we could just create a cpu_exec_instance_init() function in exec.c and call it from cpu_common_init()). (Or we could move system_memory to MachineState, but that could be done in a follow-up patch). -- Eduardo