From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bv3Xv-0003iH-5V for qemu-devel@nongnu.org; Fri, 14 Oct 2016 10:33:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bv3Xr-0006ly-LF for qemu-devel@nongnu.org; Fri, 14 Oct 2016 10:33:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bv3Xr-0006lj-CG for qemu-devel@nongnu.org; Fri, 14 Oct 2016 10:33:11 -0400 Date: Fri, 14 Oct 2016 16:33:07 +0200 From: Igor Mammedov Message-ID: <20161014163307.526c7edc@nial.brq.redhat.com> In-Reply-To: <20161014134858.GG3275@thinpad.lan.raisama.net> References: <1476375902-11715-1-git-send-email-lvivier@redhat.com> <1476375902-11715-3-git-send-email-lvivier@redhat.com> <20161014133310.GF3275@thinpad.lan.raisama.net> <38cc28b0-f087-6435-9fb3-136a5b6def7e@redhat.com> <20161014134858.GG3275@thinpad.lan.raisama.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 02/20] target-i386: move back cpu_exec_init() to init List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Laurent Vivier , Matthew Rosato , Peter Maydell , qemu-devel@nongnu.org, Markus Armbruster , Bharata B Rao , Paolo Bonzini , David Gibson On Fri, 14 Oct 2016 10:48:58 -0300 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 > > >> Signed-off-by: Laurent Vivier > > > > > > 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: > > 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). > 2) (optional) Rename cpu_exec_init() to cpu_exec_realize() (only > trivial changes in architecture code) I'd do all of it in 1 step - split cpu_exec_init on init/realize parts (comment in cpu_exec_init says that qom/cpu.c can't be used for "memory" property) - call cpu_exec_init() from cpu_common_init() - s/cpu_exec_init/cpu_exec_realize/ in target-* Follow up patches 2) 1 patch, could move parts of split cpu_exec_init() to cpu_common_init() if that makes sense. 3) 1 patch, could move cpu_exec_realize() into per target *_realizefn() it would be not small patch but still trivial 4) 1 patch, do similar (#3) thing for unrealize Perhaps #3,4 could be done in a more generic way in qom/cpu.c but I don't have a good idea how to do it.