qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [RFC PATCH v0] spapr: Introduce sPAPRCPUCoreClass


From: David Gibson
Subject: Re: [Qemu-ppc] [RFC PATCH v0] spapr: Introduce sPAPRCPUCoreClass
Date: Thu, 8 Sep 2016 11:51:32 +1000
User-agent: Mutt/1.7.0 (2016-08-17)

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 <address@hidden>

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.

-- 
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

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]