Received: from eggs.gnu.org ([2001:4830:134:3::10]:34038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhqvI-0002xO-5l for qemu-devel@nongnu.org; Thu, 08 Sep 2016 00:26:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhqvD-0004Ww-TA for qemu-devel@nongnu.org; Thu, 08 Sep 2016 00:26:47 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:55262) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhqvD-0004Wn-L9 for qemu-devel@nongnu.org; Thu, 08 Sep 2016 00:26:43 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u884MxbU007867 for ; Thu, 8 Sep 2016 00:26:41 -0400 Received: from e23smtp02.au.ibm.com (e23smtp02.au.ibm.com [202.81.31.144]) by mx0a-001b2d01.pphosted.com with ESMTP id 25atrhcbq0-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 08 Sep 2016 00:26:41 -0400 Received: from localhost by e23smtp02.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Sep 2016 14:26:39 +1000 Date: Thu, 8 Sep 2016 09:56:31 +0530 From: Bharata B Rao Reply-To: bharata@linux.vnet.ibm.com References: <1472808998-3030-1-git-send-email-bharata@linux.vnet.ibm.com> <20160908015132.GB3883@voom.fritz.box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160908015132.GB3883@voom.fritz.box> Message-Id: <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: David Gibson Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, thuth@redhat.com 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. > > > > 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. > > > > 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. > > > > In an unrelated cleanup, fix a typo in .get_hotplug_handler routine. > > > > Signed-off-by: Bharata B Rao > > I like the concept, but... > > [snip] > > static const TypeInfo spapr_cpu_core_type_info = { > > @@ -415,17 +377,26 @@ static const TypeInfo spapr_cpu_core_type_info = { > > .parent = TYPE_CPU_CORE, > > .abstract = true, > > .instance_size = sizeof(sPAPRCPUCore), > > - .class_init = spapr_cpu_core_class_init, > > .. I'm pretty sure you need .class_size = sizeof(sPAPRCPUCoreClass) > here, or initializing the cpu_class field will corrupt memory. Ok. 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 ? Regards, Bharata.