public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Andre Przywara" <andre@andrep.de>,
	"Borislav Petkov" <bp@alien8.de>,
	kvm@vger.kernel.org, "Jörg Rödel" <joro@8bytes.org>,
	"H. Peter Anvin" <hpa@zytor.com>, x86-ml <x86@kernel.org>,
	kvm@vger-kernel.org
Subject: Re: [RFC PATCH] Emulate MOVBE
Date: Wed, 17 Apr 2013 16:33:08 +0300	[thread overview]
Message-ID: <20130417133308.GG1682@redhat.com> (raw)
In-Reply-To: <516E7C96.3070800@redhat.com>

On Wed, Apr 17, 2013 at 12:42:30PM +0200, Paolo Bonzini wrote:
> Il 16/04/2013 19:28, Gleb Natapov ha scritto:
> > > This does highlight a weakness in CPU_GET_SUPPORTED_CPUID, but I think
> > > this is not a problem in practice.
> > > 
> > > With a management layer such as oVirt it's not a problem.  For example,
> > > oVirt has its own library of processors.  It doesn't care if KVM enables
> > > movbe.  If you tell it your datacenter is a mix of Haswells and Sandy
> > > Bridges it will pick the CPUID bits that are common to all.
> > > 
> > > However, even without a suitable management layer it is also not really
> > > a problem.
> > > 
> > > The only processors that support MOVBE are Atom and Haswell.  Haswell
> > > adds a whole lot of extra CPUID features, hence "-cpu Haswell,enforce"
> > > will fail with or without movbe emulation.  "-cpu Haswell" will disable
> > > all Haswell new features except movbe will remain slow; that's fine, I
> > > think, anyway it's not what you'ld do except to play with CPU models.
> >
> > No that's not fine. KVM should not trick userspace (QEMU is just one of
> > them) into nonoptimal configuration. And you forgot about -cpu host in your
> > analysis.
> 
> "-cpu host" enables bits that are not in the host, but that's a QEMU
> bug.  If the host lacks x2apic, for example, "-cpu host" should not
> enable it even if it is there in KVM_GET_SUPPORTED_CPUID.
> 
Why? We always said that if performance is the only thing user cares
about he should use "-cpu host". Not exposing emulated x2apic to a guest
will not provide best configuration possible. If user uses -cpu guest_cpu_model
and the guest_cpu_model is the same as host cpu model and host cpu
model does not have x2apic then guest should not see x2apic either, but
this works correctly today already.

> Now, KVM_GET_SUPPORTED_CPUID is a pretty bad interface for implementing
> a sane "CPU as similar to the host's as possible" policy.  That's
> another story and I agree.  It's a very sane policy for simple
> userspaces like lkvm.
> 
Thats because -cpu host is a misnomer. It really should be -cpu best
since its task is too create most efficient configuration given host
cpu. So you can wave -cpu host problem by saying that it should filter
non host cpuid bits from KVM_GET_SUPPORTED_CPUID, but then you will want
to implement -cpu best and you will encounter the same problem, but
without any excuse now :)

--
			Gleb.

      reply	other threads:[~2013-04-17 13:33 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-09 23:46 [RFC PATCH] Emulate MOVBE Borislav Petkov
2013-04-10  0:03 ` Borislav Petkov
2013-04-10  0:04   ` H. Peter Anvin
2013-04-10  9:53     ` Borislav Petkov
2013-04-10  9:29 ` Andre Przywara
2013-04-10 10:08   ` Gleb Natapov
2013-04-10 10:17     ` Borislav Petkov
2013-04-10 10:21       ` Gleb Natapov
2013-04-10 10:39     ` Andre Przywara
2013-04-10 12:16       ` Gleb Natapov
2013-04-11  0:18         ` [PATCH -v2] kvm: " Borislav Petkov
2013-04-11 14:28           ` Gleb Natapov
2013-04-11 15:37             ` Borislav Petkov
2013-04-14  7:41               ` Gleb Natapov
2013-04-14 17:32                 ` Borislav Petkov
2013-04-14 18:36                   ` H. Peter Anvin
2013-04-14 19:09                     ` Borislav Petkov
2013-04-14 19:40                       ` H. Peter Anvin
2013-04-16 17:42                   ` Gleb Natapov
2013-04-17 11:04                     ` Borislav Petkov
2013-04-17 13:38                       ` Gleb Natapov
2013-04-17 14:02                         ` Borislav Petkov
2013-04-18 22:48                           ` Borislav Petkov
2013-04-21  9:46                             ` Gleb Natapov
2013-04-21 11:30                               ` Borislav Petkov
2013-04-21 12:51                                 ` Gleb Natapov
2013-04-23 23:41                                   ` Borislav Petkov
2013-04-23 23:50                                     ` H. Peter Anvin
2013-04-24  8:42                                       ` Gleb Natapov
2013-04-24  8:47                                       ` Borislav Petkov
2013-04-14  8:43           ` Gleb Natapov
2013-04-14 21:02             ` Borislav Petkov
2013-04-16 11:36               ` Paolo Bonzini
2013-04-21 11:46                 ` Borislav Petkov
2013-04-21 12:23                   ` Borislav Petkov
2013-04-22  8:53                     ` Paolo Bonzini
2013-04-22  9:38                       ` Borislav Petkov
2013-04-22  9:42                         ` Gleb Natapov
2013-04-22  9:52                           ` Borislav Petkov
2013-04-22  9:58                             ` Gleb Natapov
2013-04-22 13:49                               ` Borislav Petkov
2013-04-26 16:08                         ` Borislav Petkov
2013-04-16 11:47     ` [RFC PATCH] " Paolo Bonzini
2013-04-16 12:08       ` Borislav Petkov
2013-04-16 12:13         ` H. Peter Anvin
2013-04-16 17:28       ` Gleb Natapov
2013-04-17 10:42         ` Paolo Bonzini
2013-04-17 13:33           ` Gleb Natapov [this message]

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=20130417133308.GG1682@redhat.com \
    --to=gleb@redhat.com \
    --cc=andre@andrep.de \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger-kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=x86@kernel.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