All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: aliguori@us.ibm.com,
	"kvm@vger.kernel.org list" <kvm@vger.kernel.org>,
	gleb@redhat.com, qemu-devel@nongnu.org, blauwirbel@gmail.com,
	anthony@codemonkey.ws, pbonzini@redhat.com,
	"Andreas Färber" <afaerber@suse.de>,
	rth@twiddle.net
Subject: Re: [PATCH 3/5] target-i386: Slim conversion to X86CPU subclasses
Date: Fri, 8 Feb 2013 13:08:39 -0200	[thread overview]
Message-ID: <20130208150839.GN9964@otherpad.lan.raisama.net> (raw)
In-Reply-To: <20130208145231.GK4138@otherpad.lan.raisama.net>

On Fri, Feb 08, 2013 at 12:52:31PM -0200, Eduardo Habkost wrote:
> On Fri, Feb 08, 2013 at 01:58:42PM +0100, Igor Mammedov wrote:
[...]
> > Continuing on theoretical issue:
> > > We could add an inited field to X86CPUClass that gets checked at initfn
> > > time (only ever getting set to true by the pre-defined models). Then it
> > > would be per model. And if we add a prototype for the ..._class_init we
> > > could even call it late as proposed for -cpu host if we take some
> >              ^^^^^^^^^^^^ is a tricky part, for global properties to work it
> > would require, calling this hook after kvm_init() is succeeds and before
> > any initfn() is called in general or as minimum before Device.initfn(). And it
> > anyway will not make all CPU classes to have correct defaults in KVM mode,
> > since only CPU class of created CPU instance will be fixed up.
> > 
> > 1. One way to make sure that built-in CPU classes have fixed up defaults is to
> > iterate over them in kvm_arch_init() and possibly calling their class_init()
> > again to reinitialize. It's still hack (due fixing something up), but it would
> > give at least correct KVM mode defaults, regardless of the order classes are
> > initialized.
> 
> Can't we do that more easily with the tcg-vendor/vendor properties?
> 
> It looks we are burning too much brain cycles trying to force a model
> that's really unintuitive to the outside, where the default-value of a
> class property depends on the options given to the QEMU command-line. We
> don't have to do that.
> 
> The point of initializing stuff in class_init is to make introspection
> easy. If we make the classes change how they look like depending on the
> command-line configuration, the classes and the class introspection
> system get less useful.
> 

Sorry for replying to myself, but extending my answer:

> > 
> > 2. But more correct way from POV of OOP would be one without any fixups, i.e.
> > create extra KVM-builtin-CPU-classes that are derived from host class.
> > and in object_class_by_name() lookup for them if kvm is enabled. But we could
> > do this as follow-up to #1.

Solution #2 would be 100% correct, strictly speaking, but isn't it
overkill to create separate classes if we could just add one additional
property in X86CPUClass, and let the CPU object choose which property is
important for the CPUID setup, depending if KVM is enabled or not?

-- 
Eduardo

  reply	other threads:[~2013-02-08 15:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1360082364-12475-1-git-send-email-imammedo@redhat.com>
     [not found] ` <1360082364-12475-4-git-send-email-imammedo@redhat.com>
     [not found]   ` <20130207150819.GD9964@otherpad.lan.raisama.net>
     [not found]     ` <20130208100329.2105a649@thinkpad.mammed.net>
2013-02-08 11:16       ` [PATCH 3/5] target-i386: Slim conversion to X86CPU subclasses Andreas Färber
2013-02-08 12:58         ` Igor Mammedov
2013-02-08 14:52           ` Eduardo Habkost
2013-02-08 15:08             ` Eduardo Habkost [this message]
2013-02-08 16:54             ` [Qemu-devel] " Andreas Färber
2013-02-08 18:13               ` Eduardo Habkost
2013-02-11  1:52                 ` Igor Mammedov
2013-02-12 14:48                   ` Eduardo Habkost
2013-02-13 15:20                     ` Igor Mammedov
2013-02-13 22:19                       ` Eduardo Habkost

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=20130208150839.GN9964@otherpad.lan.raisama.net \
    --to=ehabkost@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=anthony@codemonkey.ws \
    --cc=blauwirbel@gmail.com \
    --cc=gleb@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.