All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, mst@redhat.com, afaerber@suse.de
Subject: Re: [PATCH v2] kvm: x86: emulate monitor and mwait instructions as nop
Date: Tue, 03 Jun 2014 17:37:08 +0200	[thread overview]
Message-ID: <538DEBA4.5020600@suse.de> (raw)
In-Reply-To: <20140603142157.GD1653@ERROL.INI.CMU.EDU>

On 06/03/2014 04:21 PM, Gabriel L. Somlo wrote:
> On Tue, Jun 03, 2014 at 11:17:48AM +0200, Paolo Bonzini wrote:
>> I think it's fine as it is now. :)
> On Mon, Jun 02, 2014 at 09:55:18PM -0400, Gabriel L. Somlo wrote:
>> W.r.t. monitor/mwait, a guest can do one of the following:
>>
>> 1. Never check CPUID, and never use monitor/mwait
>> 	- This is great, we don't have to do anything about these
>>
>> 2. Check CPUID for mwait, use it to idle in preference over hlt
>> 	- Linux, Windows, and Mavericks (10.9) do this
>> 	- we never want to have CPUID say "yes" to these, since
>> 	  monitor/mwait support will be clunky in the best case,
>> 	  and hlt is overwhelmingly preferable! [*]
>>
>> 3. Never check CPUID, use monitor/mwait with abandon
>> 	- OS X 10.6 .. 10.8 does this
>> 	- emulating monitor/mwait here allows us to boot the guest
>> 	  and use it, and perform sysadmin surgery to force a hlt
>> 	  based idle
>>
>> 4. Check CPUID, panic if unavailable
>> 	- OS X 10.5 did this, IIRC.
>> 	- whether I can do kext surgery and get it to stop checking
>> 	  CPUID *in addition to* falling back to hlt-based idle is
>> 	  TBD.
>> 	- emulating monitor/mwait allows us to boot this type of
>> 	  guest, BUT WE ALSO HAVE TO ADVERTISE IT VIA CPUID !!!
> As it is right now, #4 is not being addressed (and we can't just
> advertise mwait via cpuid, or we'd be screwing up #2).

I think we should be able to handle #4 by doing -cpu core2duo,+monitor 
on the QEMU command line which should override the cpuid bits that the 
kernel tells us.


Alex

>
> I also feel a bit weird about the "undocumented feature" aspect
> of NOT generating an invalid opcode for something that *should*
> be an invalid opcode according to the feature set advertised via
> cpuid...
>
> So if there's a way to make it so we can tell QEMU/KVM to
> "--enable-mwait" on a per-guest basis, I think that'd be better
> than an always-on "undocumented" behavior...
>
> But then again, I'm most likely missing something about the big
> picture... :)
>
> Thanks much,
> --Gabriel


  reply	other threads:[~2014-06-03 15: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 [this message]
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
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=538DEBA4.5020600@suse.de \
    --to=agraf@suse.de \
    --cc=afaerber@suse.de \
    --cc=gsomlo@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --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.