Received: from eggs.gnu.org ([2001:4830:134:3::10]:38085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bs0tH-0006pd-O7 for qemu-devel@nongnu.org; Thu, 06 Oct 2016 01:06:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bs0tG-0004Kg-5W for qemu-devel@nongnu.org; Thu, 06 Oct 2016 01:06:43 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:42473) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bs0tF-0004Jw-5W for qemu-devel@nongnu.org; Thu, 06 Oct 2016 01:06:42 -0400 Date: Thu, 6 Oct 2016 16:02:07 +1100 From: David Gibson Message-ID: <20161006050207.GH18733@umbus.fritz.box> References: <1475696333-8706-1-git-send-email-lvivier@redhat.com> <1475696333-8706-2-git-send-email-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="h3LYUU6HlUDSAOzy" Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 01/19] exec: split cpu_exec_init() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Laurent Vivier , QEMU Developers , Paolo Bonzini , Markus Armbruster , Eduardo Habkost , Bharata B Rao , Matthew Rosato --h3LYUU6HlUDSAOzy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 05, 2016 at 01:13:18PM -0700, Peter Maydell wrote: > On 5 October 2016 at 12:38, Laurent Vivier wrote: > > Extract the realize part to cpu_exec_realize(), update all > > calls to cpu_exec_init() to add cpu_exec_realize() to > > have no functionnal change. > > > > Put in cpu_exec_init() what initializes the CPU, > > in cpu_exec_realize() what adds it to the environment. > > > > CC: Paolo Bonzini > > Signed-off-by: Laurent Vivier > > --- > > exec.c | 8 +++++--- > > include/exec/exec-all.h | 1 + > > target-alpha/cpu.c | 1 + > > target-arm/cpu.c | 1 + > > target-cris/cpu.c | 1 + > > target-i386/cpu.c | 1 + > > target-lm32/cpu.c | 1 + > > target-m68k/cpu.c | 1 + > > target-microblaze/cpu.c | 1 + > > target-mips/cpu.c | 1 + > > target-moxie/cpu.c | 1 + > > target-openrisc/cpu.c | 1 + > > target-ppc/translate_init.c | 5 +++++ > > target-s390x/cpu.c | 4 ++++ > > target-sh4/cpu.c | 1 + > > target-sparc/cpu.c | 1 + > > target-tilegx/cpu.c | 1 + > > target-tricore/cpu.c | 1 + > > target-unicore32/cpu.c | 1 + > > target-xtensa/cpu.c | 1 + > > 20 files changed, 31 insertions(+), 3 deletions(-) > > > > diff --git a/exec.c b/exec.c > > index c8389f9..95b0aee 100644 > > --- a/exec.c > > +++ b/exec.c > > @@ -614,9 +614,6 @@ void cpu_exec_exit(CPUState *cpu) > > > > void cpu_exec_init(CPUState *cpu, Error **errp) > > { > > - CPUClass *cc ATTRIBUTE_UNUSED =3D CPU_GET_CLASS(cpu); > > - Error *local_err ATTRIBUTE_UNUSED =3D NULL; > > - > > cpu->as =3D NULL; > > cpu->num_ases =3D 0; > > > > @@ -637,6 +634,11 @@ void cpu_exec_init(CPUState *cpu, Error **errp) > > cpu->memory =3D system_memory; > > object_ref(OBJECT(cpu->memory)); > > #endif > > +} > > + > > +void cpu_exec_realize(CPUState *cpu, Error **errp) > > +{ > > + CPUClass *cc ATTRIBUTE_UNUSED =3D CPU_GET_CLASS(cpu); > > > > cpu_list_add(cpu); >=20 > I think cpu_list_add() needs to be in init, because > this is where we set cpu->cpu_index, and (after patch 5) > target-arm assumes that cpu_index has been set by > init but before realize. So I guess we should do it > in init and then roll back in the destructor? That will need to be fixed on the ARM side then. The whole new cpu_index assignment model (which allows cross-platform hotplug) relies on it not being fixed until realize() time. --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --h3LYUU6HlUDSAOzy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJX9drPAAoJEGw4ysog2bOSJMYP/jMrR2bJMewkE+jjLNHbE8pd mF+tKOz6A0znT2krs1FNJxU9lRq879i8wvs3KYhFlsmfZZFzVsVwt2G6O1672oDt sD8qgQG+eaepbMXyI0QLiCnmA7y+msY5vE0gqX/TJdFkzOaAUPUkW63ZBvPQbfoZ nzmeOXf+KxhX9itD1SXIZ6g4q1oGIuStUv8ibyRuEFcUEm8skh5tS28Lp5afaFHP O5cexNS33uyYZn+AZokkFK961A4F/XYu8++uKQMChBzYzRanrnxx8ssWv9Jz481v 5gd4TU8u7EnE028sd8CDh7BqfDtRuzLEQ0KhQZE5WgQvGx74HhigyWhuvaILK/Gi wrsPsrCa1pY9LkA+qSwnFfxJg6c2sJUmom/ROXIRNMfGISmqHKXh+eDZ8/WZp4F7 3hZesruqcYfdMw+g68jQVzcyKgdQF7oYDbLmBsZ978Hz++/NLEETznnJKcbMGent 5qOsXpIk00IdD1ltup09raaqyy6EHdRFMtU/UEGZoAPiUexYajKLHSBbkLk9yXt/ FnTAsmbIJUM1cam2bWNqBQNIJXE4pNw4OvPAkv4BybD+BwBWjK4GUIgKn64PKq9N OZjoUjcjB585o6130F0cejbRAKEMorNkJpIvNKASP3EOTt5HCn15pw/tQx2rHtiF buVPN5q4NFhVoQmwgwRO =quY8 -----END PGP SIGNATURE----- --h3LYUU6HlUDSAOzy--