All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] kvm: x86: disable KVM_FAST_MMIO_BUS
Date: Thu, 17 Aug 2017 18:27:31 +0300	[thread overview]
Message-ID: <20170817182516-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20170817135130.GC2566@flask>

On Thu, Aug 17, 2017 at 03:51:31PM +0200, Radim Krčmář wrote:
> 2017-08-17 01:31+0300, Michael S. Tsirkin:
> > On Wed, Aug 16, 2017 at 11:25:35PM +0200, Paolo Bonzini wrote:
> > > On 16/08/2017 21:59, Michael S. Tsirkin wrote:
> > > > On Wed, Aug 16, 2017 at 09:03:17PM +0200, Radim Krčmář wrote:
> > > >>>> how about we blacklist nested virt for this optimization?
> > > >>
> > > >> Not every hypervisor can be easily detected ...
> > > > 
> > > > Hypervisors that don't set a hypervisor bit in CPUID are violating the
> > > > spec themselves, aren't they?  Anyway, we can add a management option
> > > > for use in a nested scenario.
> > > 
> > > No, the hypervisor bit only says that CPUID leaf 0x40000000 is defined.
> > > See for example
> > > https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1009458:
> > > "Intel and AMD have also reserved CPUID leaves 0x40000000 - 0x400000FF
> > > for software use. Hypervisors can use these leaves to provide an
> > > interface to pass information from the hypervisor to the guest operating
> > > system running inside a virtual machine. The hypervisor bit indicates
> > > the presence of a hypervisor and that it is safe to test these
> > > additional software leaves".
> > 
> > Looks like it's not a bug then. Still, most hypervisors do have this
> > leaf so it's a reasonable way that will catch most issues.  We can
> > always blacklist more as they are found. Additionally let's go ahead
> > and add ability for userspace to disable fast MMIO for these
> > hypervisors we failed to detect.
> 
> In the worst case, I'd make faster mmio an opt-in unsafe feature
> regardless of what we run on.  Users that just want KVM to work get the
> default and people who care about utmost performance can jump through
> loops.

Might have been reasonable originally but you do not want to slow
down everyone and then make them jump through hoops just to get
back where they were originally.

So I think it has to be opt-out, really for nested setups
at this point.

> > > >> KVM uses standard features and SDM clearly says that the
> > > >> instruction length field is undefined.
> > > > 
> > > > True. Let's see whether intel can commit to a stronger definition.
> > > > I don't think there's any rush to make this change.
> > > 
> > > I disagree.  Relying on undefined processor features is a bad idea.
> > 
> > Maybe it was a bad idea 3 years ago, yes. In 2012 I posted "kvm_para:
> > add mmio word store hypercall" as an alternative.  Was nacked as MMIO
> > was seen as safer and better. By now many people rely on mmio being
> > fast.  Let's talk to hardware guys to define the feature before we give
> > up and spend years designing an alternative.
> 
> The change is not backward-compatible wrt. SDM, but all processors might
> actually be behaving like we want ...  (I'd assert undefined behavior
> add a vm-exit flag if I were to allow it, though.)
> 
> > > > It's just that this has been there for 3 years and people have built a
> > > > product around this.
> > > 
> > > Around 700 clock cycles?
> > > 
> > > Paolo
> > 
> > About 30% the cost of exit, isn't it?  There are definitely workloads
> > where cost of exit gates performance. We didn't work on fast mmio based
> > on theoretical assumptions. But maybe I am wrong. We'll see. Jason here
> > volunteered to test your patch and we'll see what comes out of it. If
> > I'm wrong and it's about 1%, I won't split hairs.
> 
> I'm ok with waiting for the numbers as I hope that we won't have to
> resort to adding special cases.

  reply	other threads:[~2017-08-17 15:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-16 11:22 [PATCH] kvm: x86: disable KVM_FAST_MMIO_BUS Paolo Bonzini
2017-08-16 12:07 ` Radim Krčmář
2017-08-16 13:37   ` Paolo Bonzini
2017-08-16 14:06     ` Michael S. Tsirkin
2017-08-16 14:17       ` Paolo Bonzini
2017-08-17  8:15   ` David Hildenbrand
2017-08-16 12:58 ` Michael S. Tsirkin
2017-08-16 13:05   ` Paolo Bonzini
2017-08-16 13:16     ` Michael S. Tsirkin
2017-08-16 13:30       ` Paolo Bonzini
2017-08-16 14:03         ` Michael S. Tsirkin
2017-08-16 16:50         ` Michael S. Tsirkin
2017-08-16 17:19           ` Paolo Bonzini
2017-08-16 19:03             ` Radim Krčmář
2017-08-16 19:59               ` Michael S. Tsirkin
2017-08-16 21:25                 ` Paolo Bonzini
2017-08-16 22:31                   ` Michael S. Tsirkin
2017-08-17  9:00                     ` Paolo Bonzini
2017-08-17 12:14                       ` Paolo Bonzini
2017-08-17 13:23                         ` Radim Krčmář
2017-08-17 15:15                       ` Michael S. Tsirkin
2017-08-17 13:51                     ` Radim Krčmář
2017-08-17 15:27                       ` Michael S. Tsirkin [this message]
2017-08-16 19:47             ` Michael S. Tsirkin

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=20170817182516-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=stable@vger.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 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.