linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
	"Sean Christopherson" <sean.j.christopherson@intel.com>,
	"Liran Alon" <liran.alon@oracle.com>,
	"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>
Subject: Re: [PATCH RESEND 2/4] KVM: X86: Emulate MSR_IA32_MISC_ENABLE MWAIT bit
Date: Mon, 20 May 2019 12:34:56 +0200	[thread overview]
Message-ID: <e96eecd6-7095-58b3-32a7-2cfde2f2ebcc@redhat.com> (raw)
In-Reply-To: <1558082990-7822-2-git-send-email-wanpengli@tencent.com>

On 17/05/19 10:49, Wanpeng Li wrote:
> MSR IA32_MSIC_ENABLE bit 18, according to SDM:
> 
> | When this bit is set to 0, the MONITOR feature flag is not set (CPUID.01H:ECX[bit 3] = 0).
> | This indicates that MONITOR/MWAIT are not supported.
> |
> | Software attempts to execute MONITOR/MWAIT will cause #UD when this bit is 0.
> |
> | When this bit is set to 1 (default), MONITOR/MWAIT are supported (CPUID.01H:ECX[bit 3] = 1).
> 
> The CPUID.01H:ECX[bit 3] ought to mirror the value of the MSR bit,
> CPUID.01H:ECX[bit 3] is a better guard than kvm_mwait_in_guest().
> kvm_mwait_in_guest() affects the behavior of MONITOR/MWAIT, not its
> guest visibility.
> 
> This patch implements toggling of the CPUID bit based on guest writes
> to the MSR.

Won't this disable mwait after migration, unless IA32_MISC_ENABLE is set
correctly by firmware or userspace?  I think you need to hide this
behind KVM_CAP_DISABLE_QUIRKS.  (Also, what is the reason for this
change in general besides making behavior closer to real hardware?)

Thanks,

Paolo

  reply	other threads:[~2019-05-20 10:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-17  8:49 [PATCH 1/4] KVM: x86: Disable intercept for CORE cstate read Wanpeng Li
2019-05-17  8:49 ` [PATCH RESEND 2/4] KVM: X86: Emulate MSR_IA32_MISC_ENABLE MWAIT bit Wanpeng Li
2019-05-20 10:34   ` Paolo Bonzini [this message]
2019-05-20 11:39     ` Wanpeng Li
2019-05-17  8:49 ` [PATCH 3/4] KVM: Fix spinlock taken warning during host resume Wanpeng Li
2019-05-20 10:36   ` Paolo Bonzini
2019-05-17  8:49 ` [PATCH 4/4] KVM: nVMX: Fix using __this_cpu_read() in preemptible context Wanpeng Li
2019-05-17 20:12   ` Sean Christopherson
2019-05-20 10:36   ` Paolo Bonzini
2019-05-20 10:30 ` [PATCH 1/4] KVM: x86: Disable intercept for CORE cstate read Paolo Bonzini
2019-05-20 11:29   ` Wanpeng Li

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=e96eecd6-7095-58b3-32a7-2cfde2f2ebcc@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kernellwp@gmail.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liran.alon@oracle.com \
    --cc=rkrcmar@redhat.com \
    --cc=sean.j.christopherson@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).