Received: from eggs.gnu.org ([2001:4830:134:3::10]:54573) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjGlJ-0000wm-54 for qemu-devel@nongnu.org; Sun, 11 Sep 2016 22:14:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjGlE-0002CA-Oq for qemu-devel@nongnu.org; Sun, 11 Sep 2016 22:14:20 -0400 Date: Mon, 12 Sep 2016 12:01:11 +1000 From: David Gibson Message-ID: <20160912020111.GA23201@voom.fritz.box> References: <1472808998-3030-1-git-send-email-bharata@linux.vnet.ibm.com> <20160908015132.GB3883@voom.fritz.box> <20160908042631.GE7228@in.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4Ckj6UjgE2iN1+kY" Content-Disposition: inline In-Reply-To: <20160908042631.GE7228@in.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH v0] spapr: Introduce sPAPRCPUCoreClass List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, thuth@redhat.com --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 08, 2016 at 09:56:31AM +0530, Bharata B Rao wrote: > On Thu, Sep 08, 2016 at 11:51:32AM +1000, David Gibson wrote: > > On Fri, Sep 02, 2016 at 03:06:38PM +0530, Bharata B Rao wrote: > > > Each spapr cpu core type defines an instance_init routine which just > > > populates the CPU class name. This can be done in the class_init > > > commonly for all core types which simplifies the registration. > > > This is inspired by how PowerNV core types are registered. > > >=20 > > > Certain types of spapr cpu cores ('host' and generic type based on ho= st > > > CPU) are initialized in target-ppc/kvm.c. To convert these type > > > registrations to use class_init, we need to expose > > > spapr_cpu_core_class_init() outside of spapr_cpu_core.c. > > >=20 > > > Commit d11b268e1765 added a generic sPAPR CPU core family > > > type to support cases like POWER8 CPU type on POWER8E host CPU. > > > Switching to class_init would fix such scenarios to use the right > > > CPU thread type instead of defaulting to host-powerpc64-cpu. > > >=20 > > > In an unrelated cleanup, fix a typo in .get_hotplug_handler routine. > > >=20 > > > Signed-off-by: Bharata B Rao > >=20 > > I like the concept, but... > >=20 > > [snip] > > > static const TypeInfo spapr_cpu_core_type_info =3D { > > > @@ -415,17 +377,26 @@ static const TypeInfo spapr_cpu_core_type_info = =3D { > > > .parent =3D TYPE_CPU_CORE, > > > .abstract =3D true, > > > .instance_size =3D sizeof(sPAPRCPUCore), > > > - .class_init =3D spapr_cpu_core_class_init, > >=20 > > .. I'm pretty sure you need .class_size =3D sizeof(sPAPRCPUCoreClass) > > here, or initializing the cpu_class field will corrupt memory. >=20 > Ok. >=20 > The other thing I am not comfortable with is exposing > .class_init routine outside of spapr_cpu_core.c so that cpu cores > can be initialized from target-ppc/kvm.c. Any opinion on that ? Not a strong one. I guess my feeling is that it's a bit ugly, but worth it for the other advantages of this approach. --=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 --4Ckj6UjgE2iN1+kY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJX1gxnAAoJEGw4ysog2bOSm+UP/RT0+onBG7nfqblcL290SsgE VELVvR6auzt22J9tSewtwzpPWrIQ2G6dw7NTmNIZ9hTcIAdOf8aZaS0wTfaULc8q p/EyIV7tj0iigs7XBqAcToC2c/akYLj13CFKlovG1pMBmwogvsFiNfdblFR0UQaw yfYAgSt42nhwJxwE4k23l/0FlPVjw7d60EhAksKMtgELcJBTfDKahkowycyykrSh UfeXA6u8pT8n3nL+NFYgEejdWLEbivir56I9+JFEUW+kT24inzUGxBfVLEFx8yiG pKQxZl11IXN9PlVlO/bkR8cQt4n6NetbyF2rPADzOSPZyChW7ORcq+jdCdcxGQvt HAQz/FGIs/iZOHo8AvZWJ8k6NXaj+eRf86/cas9Y4qkoqBZ4s9r3S0bRi/1mvhnI DuVMjTwl/Uxn28e75/SOf/zzFjrQCPupgZ7WrjTZQ+60EOBpQpNEEnRJDwsMf3an yCYRLJr/TLy/GHT80LqJUdibmlC7b+N+MakH2/zq+odt+gtmMq+zxTBMyhVs+wTk AOArWTuN4XifYMVn1elyFYUC+6GCk3U/hsAuBEVWN+zA3rfY/+tSvHmyqFpOWvFc QRgEGvRfFMm77oykM0NwL8vOSnfAFl/IofVk4ZXjCxm/jEMliCMBsla8wtFVnJrK OUJ5J1QviLzao4FYpude =7jqy -----END PGP SIGNATURE----- --4Ckj6UjgE2iN1+kY--