All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: Alexander Graf <agraf@suse.de>,
	Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org
Subject: Re: [PATCH v2] kvm: x86: emulate monitor and mwait instructions as nop
Date: Wed, 4 Jun 2014 22:37:39 +0300	[thread overview]
Message-ID: <20140604193738.GA744@redhat.com> (raw)
In-Reply-To: <20140604192405.GI1653@ERROL.INI.CMU.EDU>

On Wed, Jun 04, 2014 at 03:24:06PM -0400, Gabriel L. Somlo wrote:
> On Wed, Jun 04, 2014 at 10:06:18PM +0300, Michael S. Tsirkin wrote:
> > On Wed, Jun 04, 2014 at 01:07:21PM -0400, Gabriel L. Somlo wrote:
> > > Ah, so kvm_vcpu_ioctl_set_cpuid() and friends, morally similar to
> > > kvm_vcpu_ioctl_enable_cap() on ppc, except it turns on cpuid flags
> > > instead of entire kvm capabilities.
> > > 
> > > So we either have
> > > 
> > > 	1 always-on but masked-by-default monitor/mwait as
> > > 	  nop, and enable just the cpuid flag on demand via the
> > > 	  existing ioctl_enable_cap() mechanism (and I have to
> > > 	  check out the qemu parser for cpuid command-line flags),
> > > 
> > > or
> > > 
> > > 	2 off-by-default monitor/mwait/cpuid-flag, enabled via
> > > 	  ioctl_enable_cap(), which would have to first be ported
> > > 	  to x86, and would require somewhat more extensive qemu
> > > 	  hackery to take advantage of.
> > > 
> > > I think I sense a "path of least resistance" here, even though IMHO
> > > #2 is still "The Right Thing To Do (TM)"  :) :)
> > > 
> > > Thanks,
> > > --Gabriel
> > 
> > I think it's worng.
> > We really can't emulate mwait at the moment.
> > All we manage to do is a work-around for broken guests.
> > 
> > So let's not pretend that we can, just enable nop
> > unconditionally and be done with it.
> > Paolo already said it's OK with him, and I'll ack too.
> > 
> > Otherwise you are giving bad information to well-behaved guests,
> > so e.g. linux will try to use mwait. You don't want this.
> 
> That's why I suggested having it default to disabled, and only
> allowing it to be turned on per VM, explicitly.

Turn on the bit in CPUID? Why is it useful?
I thought the point of the nop hack is work around
for broken guests.

> > The advantage is that if at some point CPUs can
> > actually support mwait in VMs, at that point
> > we will enable the CPUID bit, and userspace and guests
> > will be able to detect that and rely on that bit
> > to mean "mwait works and is efficient".
> 
> OK, that makes sense. Thanks for helping me finally get over it ;)
> 
> --Gabriel

  reply	other threads:[~2014-06-04 19:37 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-07 20:52 [PATCH v2] kvm: x86: emulate monitor and mwait instructions as nop Gabriel L. Somlo
2014-06-02 19:25 ` Gabriel L. Somlo
2014-06-02 19:48   ` Alexander Graf
2014-06-02 20:20     ` Michael S. Tsirkin
2014-06-02 20:35       ` Alexander Graf
2014-06-02 20:41         ` Michael S. Tsirkin
2014-06-02 21:01           ` Alexander Graf
2014-06-03  1:55             ` Gabriel L. Somlo
2014-06-02 20:24   ` Michael S. Tsirkin
2014-06-03  9:17   ` Paolo Bonzini
2014-06-03 14:21     ` Gabriel L. Somlo
2014-06-03 15:37       ` Alexander Graf
2014-06-03 19:07         ` Gabriel L. Somlo
2014-06-10 10:16       ` Michael S. Tsirkin
2014-06-04 14:39     ` Gabriel L. Somlo
2014-06-04 14:44       ` Alexander Graf
2014-06-04 15:05         ` Gabriel L. Somlo
2014-06-04 15:09           ` Alexander Graf
2014-06-04 17:07             ` Gabriel L. Somlo
2014-06-04 19:06               ` Michael S. Tsirkin
2014-06-04 19:24                 ` Gabriel L. Somlo
2014-06-04 19:37                   ` Michael S. Tsirkin [this message]
2014-06-04 16:34         ` Paolo Bonzini
2014-06-04 19:08           ` Michael S. Tsirkin
2014-06-04 19:33             ` Gabriel L. Somlo
2014-06-04 19:40               ` Michael S. Tsirkin
2014-06-04 19:12           ` Nadav Amit
2014-06-04 19:43             ` Gabriel L. Somlo
2014-06-04 20:44           ` Borislav Petkov
2014-06-05 14:40             ` Eduardo Habkost
2014-06-05 20:59 ` Eric Northup
2014-06-05 21:19   ` Gabriel L. Somlo
     [not found] <46EF8587-E226-44C5-930A-49E4F7FBBC82@gmail.com>
2014-06-04 20:01 ` Nadav Amit
2014-06-04 20:11   ` Gabriel L. Somlo
2014-06-04 20:55     ` Nadav Amit

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=20140604193738.GA744@redhat.com \
    --to=mst@redhat.com \
    --cc=agraf@suse.de \
    --cc=gsomlo@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /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.