From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhoVJ-0004kA-6i for qemu-devel@nongnu.org; Wed, 07 Sep 2016 21:51:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhoVF-00024h-1m for qemu-devel@nongnu.org; Wed, 07 Sep 2016 21:51:48 -0400 Date: Thu, 8 Sep 2016 11:51:32 +1000 From: David Gibson Message-ID: <20160908015132.GB3883@voom.fritz.box> References: <1472808998-3030-1-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4bRzO86E/ozDv8r1" Content-Disposition: inline In-Reply-To: <1472808998-3030-1-git-send-email-bharata@linux.vnet.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 --4bRzO86E/ozDv8r1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 host > 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 I like the concept, but... [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, =2E. I'm pretty sure you need .class_size =3D sizeof(sPAPRCPUCoreClass) here, or initializing the cpu_class field will corrupt memory. --=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 --4bRzO86E/ozDv8r1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJX0MQkAAoJEGw4ysog2bOSg0cP/jNbWi7uJAHKd0R+cPrsQsGg E0ap4sPF2Q13nK0iAXuxBRfuvyhk6gSQA0jbpDnEEeTAm+MDQOx70EV59tcqCTsu 5eZX0lj4wejho5rLDCMQabjvXL80gN7Ryl2SjUt/3IuaYXoN21uOlWMwDJ13ahPg sSU72A66Djv5AcGBEGMeGb3vIVK3TlozkUFWyjRPqP5npqCUHCM5kOS1wfPlBhs9 8IvSLwdG7oy0IAdgXKbfqCweNWHUBxjEjI89H/G5Uv0no9Yxe7PBO0Um8/KNEV3Y oCvn6ujW2szoBh0H5qF6AIDlyZcQ3slL3osZ825tgZ7h0XEWr9Ut+zdxzS/NS71L Q9MTfzD60XCVc//ar5pXDVD6nV8cxsA2WLk8X91okMtN/9hF0zHFmFM+37sMLvI7 HKkP7Cfy/cazI+bEr3FfPqtFO9FmkUfYbillbEQSWqKEGTnbZwrSkps/GmTHdeWY AMtJ+5zpriA09BuvwBT8ykmuNBRhyL/3Xw8vxw555LMCEJB99F2eCdCTnqwNZrLX ryVn2JIxsVqAqgVGZsIpvXsbqMOMPCOzVpYCI+mNpywBsZ4XkyJDhpXitjTZBkdF WK3pUuxS71jboGS+7xIYcByywYEsrk3U5RGn5zXpAN8+kx8XzgRIlfTAxGOS77l2 AtmhvBBKbn+dtlDF8b3V =6SoU -----END PGP SIGNATURE----- --4bRzO86E/ozDv8r1--