qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Eduardo Habkost <ehabkost@redhat.com>, qemu-devel@nongnu.org
Cc: libvir-list@redhat.com, Paolo Bonzini <pbonzini@redhat.com>,
	Jiri Denemark <jdenemar@redhat.com>,
	kvm@vger.kernel.org, Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-devel] [uq/master PATCH 7/7 v8] target-i386: CPU model subclasses
Date: Mon, 10 Feb 2014 01:23:37 +0100	[thread overview]
Message-ID: <52F81C09.6070504@suse.de> (raw)
In-Reply-To: <20140131181338.GB28427@otherpad.lan.raisama.net>

Am 31.01.2014 19:13, schrieb Eduardo Habkost:
> Register separate QOM classes for each x86 CPU model.
> 
> This will allow management code to more easily probe what each CPU model
> provides, by simply creating objects using the appropriate class name,
> without having to restart QEMU.
> 
> This also allows us to eliminate the qdev_prop_set_globals_for_type()
> hack to set CPU-model-specific global properties.
> 
> Instead of creating separate class_init functions for each class, I just
> used class_data to store a pointer to the X86CPUDefinition struct for
> each CPU model. This should make the patch shorter and easier to review.
> Later we can gradually convert each X86CPUDefinition field to lists of
> per-class property defaults.
> 
> Written based on the ideas from the patch "[RFC v5] target-i386: Slim
> conversion to X86CPU subclasses + KVM subclasses" written by Andreas
> Färber <afaerber@suse.de>, Igor Mammedov <imammedo@redhat.com>.
> 
> The "host" CPU model is special, as the feature flags depend on KVM
> being initialized. So it has its own class_init and instance_init
> function, and feature flags are set on instance_init instead of
> class_init.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> This patch is similar to the one sent by Andrea and then later
> resubmitted by Igor as "[RFC v5] target-i386: Slim conversion to X86CPU
> subclasses + KVM subclasses", as it doesn't create one new class_init
> function for each subclass.
> 
> Main differences v5 -> v6 are:
>  * Code was written from scratch (instead of using the previous patches
>    as base)
>    * I didn't mean to rewrite it entirely, but when doing additional
>      simplification of the CPU init logic on other patches, I ended up
>      rewriting it.
>    * I chose to keep the Signed-off-by lines because I built upon
>      Andreas's and Igor's ideas. Is that OK?

Yes, your From and our Sobs in order is the expected way in this case.
If Igor agrees I would propose to drop the textual repetition of this.

I am ~1/3 through reviewing this and it looks pretty promising so far!
Thanks a lot for your efforts. Meanwhile one cleanup idea inline...

>  * No KVM-specific subclasses, to keep things simpler.
>  * No embedding of X86CPUDefinition (x86_def_t) inside the class struct,
>    instead keeping a pointer to the existing X86CPUDefinition struct.
>  * The "host" class is registered on cpu.c, but the CPUID data
>    is filled on instance_init instead of class_init (because KVM has to
>    be initialized already).
>    * kvm_required field introduced to make sure the "host" class can't
>      be used without KVM.
> 
> Changes v6 -> v7:
>  * Rebase
> 
> Changes v7 -> v8:
>  * Removed CPU listing code (will be sent as a separate patch)
>  * Kept x86_cpudef_setup() (will be addressed in a separate patch)
> ---
>  target-i386/cpu-qom.h |  13 ++++
>  target-i386/cpu.c     | 197 ++++++++++++++++++++++++++++++++------------------
>  2 files changed, 138 insertions(+), 72 deletions(-)
> 
> diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h
> index 722f11a..60c5c32 100644
> --- a/target-i386/cpu-qom.h
> +++ b/target-i386/cpu-qom.h
> @@ -37,6 +37,9 @@
>  #define X86_CPU_GET_CLASS(obj) \
>      OBJECT_GET_CLASS(X86CPUClass, (obj), TYPE_X86_CPU)
>  
> +
> +typedef struct X86CPUDefinition X86CPUDefinition;
> +
>  /**
>   * X86CPUClass:
>   * @parent_realize: The parent class' realize handler.
> @@ -49,6 +52,16 @@ typedef struct X86CPUClass {
>      CPUClass parent_class;
>      /*< public >*/
>  
> +    /* CPU model definition
> +     * Should be eventually replaced by subclass-specific property defaults
> +     */
> +    X86CPUDefinition *cpu_def;
> +    /* CPU model requires KVM to be enabled */
> +    bool kvm_required;
> +    /* Optional description of CPU model.
> +     * If unavailable, cpu_def->model_id is used */
> +    const char *model_description;

Here I wondered why you needed this? For PowerPCCPU subclasses we have
reused DeviceClass::desc.

Regards,
Andreas

> +
>      DeviceRealize parent_realize;
>      void (*parent_reset)(CPUState *cpu);
>  } X86CPUClass;
[snip]

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2014-02-10  0:23 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-30 19:48 [Qemu-devel] [uq/master PATCH 0/7] x86 CPU subclasses, take 7 Eduardo Habkost
2014-01-30 19:48 ` [Qemu-devel] [uq/master PATCH 1/7] target-i386: Eliminate CONFIG_KVM #ifdefs Eduardo Habkost
2014-01-31 11:42   ` Paolo Bonzini
2014-01-30 19:48 ` [Qemu-devel] [uq/master PATCH 2/7] target-i386: Don't change x86_def_t struct on cpu_x86_register() Eduardo Habkost
2014-01-31 11:42   ` Paolo Bonzini
2014-01-30 19:48 ` [Qemu-devel] [uq/master PATCH 3/7] target-i386: Move KVM default-vendor hack to instance_init Eduardo Habkost
2014-01-31 11:42   ` Paolo Bonzini
2014-01-30 19:48 ` [Qemu-devel] [uq/master PATCH 4/7] target-i386: Rename cpu_x86_register() to x86_cpu_load_def() Eduardo Habkost
2014-01-31 11:42   ` Paolo Bonzini
2014-02-10  0:03     ` Andreas Färber
2014-01-30 19:48 ` [Qemu-devel] [uq/master PATCH 5/7] target-i386: Call x86_cpu_load_def() earlier Eduardo Habkost
2014-02-10  0:13   ` Andreas Färber
2014-01-30 19:48 ` [Qemu-devel] [uq/master PATCH 6/7] target-i386: Rename x86_def_t to X86CPUDefinition Eduardo Habkost
2014-01-31 11:42   ` Paolo Bonzini
2014-02-10  0:14     ` Andreas Färber
2014-01-30 19:48 ` [Qemu-devel] [uq/master PATCH 7/7] target-i386: CPU model subclasses Eduardo Habkost
2014-01-31 17:20   ` Eduardo Habkost
2014-01-31 18:13   ` [Qemu-devel] [uq/master PATCH 7/7 v8] " Eduardo Habkost
2014-02-10  0:23     ` Andreas Färber [this message]
2014-02-10  8:19       ` Eduardo Habkost
2014-02-10  8:26         ` Eduardo Habkost
2014-02-10 10:21           ` [Qemu-devel] [qom-cpu PATCH 7/7 v9] " Eduardo Habkost
2014-02-10 22:39             ` Andreas Färber
2014-02-11  8:05               ` Eduardo Habkost
2014-02-11  8:07               ` Paolo Bonzini
2014-02-10  9:48       ` [Qemu-devel] [uq/master PATCH 7/7 v8] " Igor Mammedov
2014-01-30 21:47 ` [Qemu-devel] [uq/master PATCH 0/7] x86 CPU subclasses, take 7 Paolo Bonzini
2014-01-31 11:30   ` Andreas Färber
2014-01-31 11:42     ` Paolo Bonzini
2014-01-31 12:17       ` Eduardo Habkost
2014-01-31 12:14     ` Eduardo Habkost
2014-01-31 14:36     ` Igor Mammedov
2014-01-31 14:48 ` Igor Mammedov
2014-01-31 14:50   ` Paolo Bonzini
2014-01-31 15:17     ` Eduardo Habkost
2014-01-31 16:06       ` Igor Mammedov
2014-01-31 16:42         ` Eduardo Habkost
2014-01-31 16:52           ` Paolo Bonzini
2014-01-31 18:51             ` Eduardo Habkost
2014-01-31 18:56               ` [Qemu-devel] [libvirt] " Eric Blake
2014-01-31 19:08                 ` Eduardo Habkost
2014-01-31 19:18                 ` Igor Mammedov
2014-01-31 19:25                   ` Eduardo Habkost
2014-01-31 15:10   ` [Qemu-devel] " Eduardo Habkost
2014-01-31 15:11     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52F81C09.6070504@suse.de \
    --to=afaerber@suse.de \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=jdenemar@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=libvir-list@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).