mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>,
	Xiaoyao Li <xiaoyao.li@linux.intel.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kvm/x86/vmx: Make the emulation of MSR_IA32_ARCH_CAPABILITIES only for vmx
Date: Thu, 7 Mar 2019 19:15:44 +0100	[thread overview]
Message-ID: <55caabc3-e075-3282-a000-88356ddb15c2@redhat.com> (raw)
In-Reply-To: <20190307173744.GB4986@linux.intel.com>

On 07/03/19 18:37, Sean Christopherson wrote:
> On Thu, Mar 07, 2019 at 05:31:43PM +0800, Xiaoyao Li wrote:
>> At present, we report F(ARCH_CAPABILITIES) for x86 arch(both vmx and svm)
>> unconditionally, but we only emulate this MSR in vmx. It will cause #GP
>> while guest kernel rdmsr(MSR_IA32_ARCH_CAPABILITIES) in an AMD host.
>>
>> Since MSR IA32_ARCH_CAPABILITIES is an intel-specific MSR, it makes no
>> sense to emulate it in svm. Thus this patch chooses to only emulate it
>> for vmx, and moves the related handling to vmx related files.
> 
> What about emulating the MSR on an AMD host for testing purpsoes?  It
> might be a useful way for someone without Intel hardware to test spectre
> related flows.
> 
> In other words, an alternative to restricting emulation of the MSR to
> Intel CPUS would be to move MSR_IA32_ARCH_CAPABILITIES handling into
> kvm_{get,set}_msr_common().  Guest access to MSR_IA32_ARCH_CAPABILITIES
> is gated by X86_FEATURE_ARCH_CAPABILITIES in the guest's CPUID, e.g.
> RDMSR will naturally #GP fault if userspace passes through the host's
> CPUID on a non-Intel system.

This is also better because it wouldn't change the guest ABI for AMD
processors.  Dropping CPUID flags is generally not a good idea.

Paolo

  parent reply	other threads:[~2019-03-07 18:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07  9:31 Xiaoyao Li
     [not found] ` <20190307173744.GB4986@linux.intel.com>
2019-03-07 18:15   ` Paolo Bonzini [this message]
2019-03-08  1:53     ` Xiaoyao 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=55caabc3-e075-3282-a000-88356ddb15c2@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xiaoyao.li@linux.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

Powered by JetHome