From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Jim Mattson <jmattson@google.com>
Cc: Aaron Lewis <aaronlewis@google.com>,
kvm list <kvm@vger.kernel.org>,
Janakarajan Natarajan <Janakarajan.Natarajan@amd.com>
Subject: Re: [Patch] KVM: SVM: Fix svm_xsaves_supported
Date: Mon, 09 Sep 2019 10:54:20 +0200 [thread overview]
Message-ID: <87sgp5g88z.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <CALMp9eRbDAB0NF=WVjHJWJNPgsTfE_s+4CeGMkpJpXSGP9zOyg@mail.gmail.com>
Jim Mattson <jmattson@google.com> writes:
> On Wed, Sep 4, 2019 at 9:51 AM Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
>
>> Currently, VMX code only supports writing '0' to MSR_IA32_XSS:
>>
>> case MSR_IA32_XSS:
>> if (!vmx_xsaves_supported() ||
>> (!msr_info->host_initiated &&
>> !(guest_cpuid_has(vcpu, X86_FEATURE_XSAVE) &&
>> guest_cpuid_has(vcpu, X86_FEATURE_XSAVES))))
>> return 1;
>> /*
>> * The only supported bit as of Skylake is bit 8, but
>> * it is not supported on KVM.
>> */
>> if (data != 0)
>> return 1;
>>
>>
>> we will probably need the same limitation for SVM, however, I'd vote for
>> creating separate kvm_x86_ops->set_xss() implementations.
>
> I hope separate implementations are unnecessary. The allowed IA32_XSS
> bits should be derivable from guest_cpuid_has() in a
> vendor-independent way. Otherwise, the CPU vendors have messed up. :-)
>
> At present, we use the MSR-load area to swap guest/host values of
> IA32_XSS on Intel (when the host and guest values differ), but it
> seems to me that IA32_XSS and %xcr0 should be swapped at the same
> time, in kvm_load_guest_xcr0/kvm_put_guest_xcr0. This potentially adds
> an additional L1 WRMSR VM-exit to every emulated VM-entry or VM-exit
> for nVMX, but since the host currently sets IA32_XSS to 0 and we only
> allow the guest to set IA32_XSS to 0, we can probably worry about this
> later.
Yea, I was suggesting to split implementations as a future proof but a
comment like "This ought to be 0 for now" would also do)
>
> I have to say, this is an awful lot of effort for an MSR that's never used!
Agreed :-)
--
Vitaly
next prev parent reply other threads:[~2019-09-09 8:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-04 0:14 [Patch] KVM: SVM: Fix svm_xsaves_supported Aaron Lewis
2019-09-04 16:51 ` Vitaly Kuznetsov
2019-09-04 19:03 ` Aaron Lewis
2019-09-05 12:46 ` Vitaly Kuznetsov
2019-09-06 17:55 ` Jim Mattson
2019-09-09 8:54 ` Vitaly Kuznetsov [this message]
2019-10-03 16:02 ` Moger, Babu
2019-10-03 16:15 ` Jim Mattson
2019-10-03 16:20 ` Moger, Babu
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=87sgp5g88z.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=Janakarajan.Natarajan@amd.com \
--cc=aaronlewis@google.com \
--cc=jmattson@google.com \
--cc=kvm@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox