Received: from eggs.gnu.org ([2001:4830:134:3::10]:57198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYayo-00057D-Gc for qemu-devel@nongnu.org; Thu, 19 Mar 2015 09:59:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYayl-00054a-8w for qemu-devel@nongnu.org; Thu, 19 Mar 2015 09:59:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYayl-00054S-1S for qemu-devel@nongnu.org; Thu, 19 Mar 2015 09:59:19 -0400 Date: Thu, 19 Mar 2015 10:58:59 -0300 From: Eduardo Habkost Message-ID: <20150319135859.GO3513@thinpad.lan.raisama.net> References: <1426247796-1657-1-git-send-email-bharata@linux.vnet.ibm.com> <5507D029.8040608@suse.de> <20150317083951.GB21610@in.ibm.com> <55080844.5070302@suse.de> <20150318062004.GC21610@in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20150318062004.GC21610@in.ibm.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC v0 PATCH] cpus: Convert cpu_index into a bitmap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: zhugh.fnst@cn.fujitsu.com, qemu-devel@nongnu.org, Alexander Graf , Bharata B Rao , imammedo@redhat.com, Andreas =?iso-8859-1?Q?F=E4rber?= , david@gibson.dropbear.id.au On Wed, Mar 18, 2015 at 11:50:04AM +0530, Bharata B Rao wrote: > On Tue, Mar 17, 2015 at 11:56:04AM +0100, Andreas F=E4rber wrote: > > Am 17.03.2015 um 09:39 schrieb Bharata B Rao: > > > On Tue, Mar 17, 2015 at 07:56:41AM +0100, Alexander Graf wrote: > > >> > > >> > > >> On 13.03.15 12:56, Bharata B Rao wrote: > > >>> From: Bharata B Rao [...] > > >>> =20 > > >>> +static void alpha_cpu_finalize(Object *obj) > > >>> +{ > > >>> + cpu_exec_exit(CPU(obj)); > > >>> +} > > >>> + > > >>> static void alpha_cpu_initfn(Object *obj) > > >>> { > > >>> CPUState *cs =3D CPU(obj); > > >>> @@ -305,6 +310,7 @@ static const TypeInfo alpha_cpu_type_info =3D= { > > >>> .parent =3D TYPE_CPU, > > >>> .instance_size =3D sizeof(AlphaCPU), > > >>> .instance_init =3D alpha_cpu_initfn, > > >>> + .instance_finalize =3D alpha_cpu_finalize, > > >> > > >> Would it be possible to put this into TYPE_CPU->instance_finalize = instead? > > >=20 > > > Yes possible and that would be much cleaner since I wouldn't have t= o touch > > > all archs. But it will be asymmetric in some sense as cpu_exec_init= () is > > > called from all individual cpus' instance_init but cpu_exec_exit() = will be > > > called from parent's (TYPE_CPU) instance_finalize. If that is fine,= I shall > > > post v2 with this change. > >=20 > > Could you check: Wasn't there a patch from Fujitsu to move > > cpu_exec_init() to generic code? If both were generic, that would be > > fine. If that is problematic, I would accept the mismatch as long as = it > > is "safe". That is, instance_finalize needs to handle any state of th= e > > object, >=20 > There is a patch from Zhu to move only vmstate_register related bits > from cpu_exec_init to cpu_common_realizefn. >=20 > http://lists.gnu.org/archive/html/qemu-devel/2015-01/msg01550.html >=20 > > and I think these two are better suited for realize/unrealize > > than instance_init/instance_finalize. >=20 > And Eduardo has a patch to move cpu_exec_init call from instance_init > to realize for target-i386. >=20 > https://lists.gnu.org/archive/html/qemu-devel/2015-03/msg01056.html >=20 > So if the preferred way is to call cpu_exec_init from realize, then > Eduardo - Can you do this for all archs ? My limited testing shows > that it (moving cpu_exec_init from instance_init to realize) works for > sPAPR PowerPC too, but not sure about other targets. I can submit a RFC for all arches, but I don't have the ability to test all of them. I think it is likely that some architectures have additional code inside instance_init that depends on cpu_exec_init() being called (i386 was one of them, until we removed cpu_index-based default apic_id calculation). We need to call cpu_exec_init() from realize because instance_init shouldn't have any side-effects except on the state of the object itself. See the discussion at: http://thread.gmane.org/gmane.comp.emulators.qemu/326307 Subject: [PATCH] qdev: Make -device FOO, help help again when FOO is no= t pluggable Message-Id: <1426527232-15044-1-git-send-email-armbru@redhat.com> --=20 Eduardo